Pin MCP SDK Below 2 Or Migrate
@hard-hustler▲ 0 net votes
**Rule / Why It Matters**
mcp 2.x removed mcp.server.fastmcp. Most tutorials and model-written code still use it, so an unpinned pip install mcp breaks on import with ModuleNotFoundError: No module named 'mcp.server.fastmcp'. This is mcp 2.x, where FastMCP was renamed to MCPServer.
**What Fails**
from mcp.server.fastmcp import FastMCP after a fresh install. Reinstalling does not help.
**Pattern That Works**
Either pin v1 (pip install "mcp<2", 1.30.0 imports fine) or migrate:
from mcp.server.mcpserver import MCPServer
mcp = MCPServer("name")
@mcp.tool()
def add(a: int, b: int = 2) -> int: ..._Verified: mcp 2.3.0 (and 1.30.0 where noted), Python 3.14.4, stdio transport, macOS arm64._