Skip to content

Migrate servers to MCP Python SDK v2 and remove the mcp[cli]<2.0.0 cap (48 servers) #4448

Description

@scottschreckengaust

Summary

PR #4360 added mcp[cli]>=...,<2.0.0 to 44 servers as a stopgap for #4354, pinning the
ecosystem to SDK 1.x. This issue tracks removing that cap by porting the servers to v2.

SDK 2.0.0 removed mcp.server.fastmcp (it is gone, not deprecated) and renamed
FastMCP -> MCPServer. Every capped server would crash at import under 2.x, so the cap
is load-bearing and cannot simply be dropped.

Actual scope: 48 servers / 246 files

Larger than PR #4360's pyproject count suggests. Four servers (amazon-keyspaces,
amazon-translate, aws-iot-sitewise, ecs) declare the standalone fastmcp package
and import mcp.server.fastmcp, so they are affected too and can't be set aside as
"different dependency."

API surface

Verified by importing from an installed mcp 2.0.0 rather than reading the migration
guide. All seven v1 import forms present in src/ move under mcp.server.mcpserver:

v1 import files v2 import
from mcp.server.fastmcp import Context 143 from mcp.server.mcpserver import Context
from mcp.server.fastmcp import Context, FastMCP 45 from mcp.server.mcpserver import Context, MCPServer
from mcp.server.fastmcp import FastMCP 41 from mcp.server.mcpserver import MCPServer
from mcp.server.fastmcp.tools import Tool 10 from mcp.server.mcpserver.tools import Tool
from mcp.server.fastmcp.prompts import Prompt 5 from mcp.server.mcpserver.prompts import Prompt
from mcp.server.fastmcp.exceptions import ToolError 3 from mcp.server.mcpserver.exceptions import ToolError
from mcp.server.fastmcp.server import Context 1 from mcp.server.mcpserver.server import Context

Constructor kwargs (instructions, dependencies), the mcp.tool() decorator, and
mcp.run() are unchanged. For a stdio server the migration is effectively an import
rename. No file in src/ uses the 3-parameter Context[ServerSessionT, ...] form, so
that v2 delta doesn't apply here.

Approach

Per-server: rename imports -> bump cap to >=2.0.0,<3.0.0 -> uv lock -> run that
server's own test suite. Rename and cap bump must land atomically per server, since
v2-only imports break under a 1.x resolution.

Stateless / streamable-HTTP / cache-hint adoption is out of scope — it matters for
remote-deployed servers and is a separate per-server decision.

Rejected: a try/except ImportError shim supporting both 1.x and 2.x. It would add
dual-path complexity to 48 servers for a transitional benefit, and the repo pins via
lockfiles anyway.

Needs individual review

  • Heaviest surfaceamazon-bedrock-agentcore (33 files), aws-dataprocessing (32),
    aws-serverless (26), aws-healthomics (25), eks (16), aws-iot-sitewise (15),
    aws-transform (15).
  • stateless_http=aws-api-mcp-server passes it to the constructor; in v2 it moves
    to run(). The one confirmed non-mechanical change. (Not among the 48 — it uses the
    standalone fastmcp package.)
  • String monkeypatch targets — 3 files patch 'mcp.server.fastmcp.FastMCP' as a
    string. Both halves must be renamed together; rewriting only the module yields
    mcp.server.mcpserver.FastMCP, which doesn't exist and fails at patch time rather than
    import time.
  • Standalone fastmcp servers — the 4 above need a dependency decision alongside the
    rename.

Separate latent bug

ecs-mcp-server imports mcp.server.fastmcp but declares no mcp dependency at all
(only fastmcp>=3.0.0) — it receives mcp transitively. Worth fixing independently of
this migration.

Plan

First server + tooling, then the rest in follow-up PRs (individually or batched), each
gated on its own test suite so one failure doesn't block the others.

  • lambda-tool-mcp-server + scripts/migrate-mcp-v2.py codemod
  • Remaining 47 servers
  • ecs-mcp-server missing mcp dependency (separate)

Related: #4354, #4360, #2533.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    To triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions