Skip to content

Migrate the MCP adapter to mcp 2.0 #260

Description

@hellices

Dependabot proposed mcp 1.28.1 → 2.0.0 in #256. It is a breaking release, and the migration is its own piece of work rather than a dependency bump.

What 2.0 changes, from the failing type check

symptom meaning
"Server" expects between 0 and 1 type arguments, but 2 given the second type parameter is gone
"Server[Any]" has no attribute "list_tools" / call_tool the decorator-factory registration surface moved
"Server[Any]" has no attribute "request_context" per-request context is reached differently
Unexpected keyword argument "inputSchema" for "Tool"; did you mean "input_schema"? the schema field was renamed
Need more than 2 values to unpack (3 expected) streamable_http_client returns two values, not three

Ten call sites across src/korvid/mcp/server.py, tests/mcp/test_server.py and tests/ui/test_mcp_ui_context.py.

Why it is not being done as part of the bump

The rename and the unpack change are mechanical, but Server.request_context and the registration surface are not — they decide how a call reaches the UI bridge, which is where the approval gate lives. That is exactly the code that must not be migrated by guesswork.

Deferred rather than rushed: mcp ships in the optional [mcp] extra, so 1.28.1 is what users install today and nothing regresses by waiting.

Scope

  • Migrate the registration surface and per-request context.
  • inputSchemainput_schema.
  • Fix the two-value streamable_http_client unpacking in both test modules.
  • Re-verify the security invariants the MCP path carries: the approval gate, the masking pipeline, and the DNS-rebinding/Origin checks in tests/mcp/test_server.py.
  • Remove the mcp major-version ignore from .github/dependabot.yml in the same change.

Acceptance

uv sync --locked --dev --all-extras resolves with mcp>=2, mypy is clean, and the full MCP test module passes unchanged in intent — no assertion weakened to accommodate the new API.

Metadata

Metadata

Assignees

Labels

area: mcpModel Context Protocol server and external host integration

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions