Skip to content

refactor(keycardai-fastmcp): drop the keycardai-mcp dependency - #243

Merged
Larry-Osakwe merged 2 commits into
mainfrom
devin/1787869865-fastmcp-drop-mcp-dep
Aug 27, 2026
Merged

refactor(keycardai-fastmcp): drop the keycardai-mcp dependency#243
Larry-Osakwe merged 2 commits into
mainfrom
devin/1787869865-fastmcp-drop-mcp-dep

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

keycardai-fastmcp imported 19 symbols from keycardai.mcp; 17 were pure re-export shims of keycardai-oauth, which this package already depends on directly. Those now come from their canonical modules, MCPServerError stays the same alias (OAuthServerError), and MissingContextError — the only class actually defined in keycardai-mcp — is defined locally in keycardai/fastmcp/exceptions.py. __all__ is unchanged.

Resolution before/after

uv pip compile of the local packages/fastmcp loses 11 packages:

-aiohappyeyeballs==2.7.1
-aiohttp==3.14.3
-aiosignal==1.4.0
-aiosqlite==0.22.1
-frozenlist==1.8.0
-keycardai-mcp==1.0.0
-keycardai-starlette==0.12.0
-multidict==6.7.1
-nanoid==2.0.0
-propcache==0.5.2
-yarl==1.24.5

Before (79 packages):

aiofile==3.12.3 aiohappyeyeballs==2.7.1 aiohttp==3.14.3 aiosignal==1.4.0 aiosqlite==0.22.1
annotated-types==0.8.0 anyio==4.14.2 attrs==26.1.0 authlib==1.7.2 beartype==0.22.9
cachetools==7.1.7 caio==0.12.2 certifi==2026.7.22 cffi==2.1.1 click==8.5.0
cryptography==50.0.1 cyclopts==4.23.3 dnspython==2.8.0 docstring-parser==0.18.0
email-validator==2.3.0 exceptiongroup==1.3.1 fastmcp==3.4.7 fastmcp-slim==3.4.7
frozenlist==1.8.0 griffelib==2.2.0 h11==0.16.0 httpcore==1.0.9 httpx==0.28.1
httpx-sse==0.4.3 idna==3.19 jaraco-classes==3.4.0 jaraco-context==6.1.2
jaraco-functools==4.6.0 jeepney==0.9.0 joserfc==1.7.4 jsonref==1.1.0
jsonschema==4.26.0 jsonschema-path==0.5.0 jsonschema-specifications==2025.9.1
keycardai-mcp==1.0.0 keycardai-starlette==0.12.0 keyring==25.7.0 markdown-it-py==4.2.0
mcp==1.29.1 mdurl==0.1.2 more-itertools==11.1.0 multidict==6.7.1 nanoid==2.0.0
openapi-pydantic==0.5.1 opentelemetry-api==1.44.0 packaging==26.3 pathable==0.6.0
platformdirs==4.11.5 propcache==0.5.2 py-key-value-aio==0.4.5 pycparser==3.0
pydantic==2.13.4 pydantic-core==2.46.4 pydantic-settings==2.15.0 pygments==2.21.0
pyjwt==2.13.0 pyperclip==1.11.0 python-dotenv==1.2.3 python-multipart==0.0.32
pyyaml==6.0.3 referencing==0.37.0 rich==15.0.0 rich-rst==2.1.0 rpds-py==2026.6.3
secretstorage==3.5.0 sse-starlette==3.4.8 starlette==1.6.0 typing-extensions==4.16.0
typing-inspection==0.4.4 uncalled-for==0.4.0 uvicorn==0.52.4 watchfiles==1.2.0
websockets==17.1 yarl==1.24.5

After (68 packages): the same list minus the 11 removed above.

Behavior change to be aware of

MissingContextError raised by keycardai-fastmcp is now a different class from keycardai.mcp.server.exceptions.MissingContextError. Anyone catching the keycardai-mcp class around a FastMCP tool stops catching it; the documented path (from keycardai.fastmcp import MissingContextError) is unaffected, and both subclass OAuthServerError, so except MCPServerError still catches it.

User-visible fix

The default MissingContextError message told FastMCP developers to write from mcp.server.mcpserver import Context (both raise sites in provider.py pass no message, so that was the guidance shipped today). Both branches now say from fastmcp import Context.

Verification

just build, just test-package fastmcp (85 passed), just check, and pytest --cov-fail-under=60 (85.29%) pass. just typecheck fails identically on main (715 diagnostics) and on this branch (607) — packages/fastmcp is outside the uv workspace, so the root ty environment cannot resolve fastmcp/keycardai.fastmcp; no new diagnostics come from this change.

grep -rn "keycardai\.mcp" packages/fastmcp/ is clean apart from CHANGELOG.md and one line in README.md, which documents the retired keycardai.mcp.integrations.fastmcp import path for users migrating off keycardai-mcp-fastmcp — historical prose, not an import, so it is left as-is.

Link to Devin session: https://app.devin.ai/sessions/8b148bceda6344b691340a9ea7ea7523
Open in Devin Desktop: https://app.devin.ai/desktop/session/8b148bceda6344b691340a9ea7ea7523?variant=devin
Requested by: @Larry-Osakwe

Co-Authored-By: Larry Osakwe <larry@keycard.ai>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

…old module path

tests/keycardai/mcp/integrations/fastmcp/test_provider.py mirrored the
pre-rename module layout. The file tests keycardai.fastmcp.provider, so it
sits at tests/test_provider.py alongside test_access_context.py; the
integration-style AuthProvider tests already live in
tests/integration/test_auth_provider.py.

Pure rename, no content change. 85 passed, coverage 85.29%.

@Larry-Osakwe Larry-Osakwe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified: 17 re-exports repointed at their canonical keycardai.oauth modules, MCPServerError preserved as the OAuthServerError alias so class identity is unchanged, MissingContextError defined locally with FastMCP-correct guidance (from fastmcp import Context, and async def in the examples). __all__ unchanged. Lock drops 12 packages, 101 to 89, confirmed by name for keycardai-mcp, keycardai-starlette, aiosqlite, nanoid and aiohttp. CI ran the fastmcp suite: 85 passed, 85.29% coverage against a 60% gate.

@Larry-Osakwe
Larry-Osakwe merged commit 83a7394 into main Aug 27, 2026
5 checks passed
@Larry-Osakwe
Larry-Osakwe deleted the devin/1787869865-fastmcp-drop-mcp-dep branch August 27, 2026 22:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants