If you are building Model Context Protocol servers in Python, you might have recently hit a wall when your client, such as Claude Desktop or Cursor, reports a sudden connection closure. The culprit is often a silent dependency update to the MCP SDK version 2.0 or later. Shipped on July 28, 2026, with version 2.3.0 being the current stable release, this major update renamed the core FastMCP class to MCPServer and restructured module paths, breaking existing import statements.

Understanding the Import Failure

The error manifests as a ModuleNotFoundError: No module named 'mcp.server.fastmcp' in your terminal or server logs. This occurs because the SDK v2 moved all modules previously located under mcp.server.fastmcp to mcp.server.mcpserver. Unlike explicit deprecation warnings, the new SDK raises this hard error immediately upon import, causing the server process to die at startup. Consequently, the client interface simply displays a generic 'Connection closed' message, hiding the underlying Python traceback from the user.

The Two Paths to Resolution

You have two primary options to fix this issue. The first is to migrate your code to the new v2 API structure. This involves changing your import statement from 'from mcp.server.fastmcp import FastMCP' to 'from mcp.server.mcpserver import MCPServer'. You must then update your server instantiation to use MCPServer("name") instead of FastMCP("name"). Crucially, v2 changed how arguments are handled: pass the 'instructions' parameter by keyword rather than positionally, as positional arguments are now reserved for 'title' and 'description'. If you are not ready to refactor your entire codebase, you can pin your dependency to an earlier version. By adding 'mcp<2' to your requirements.txt or pyproject.toml, you prevent package managers like pip or uv from installing the breaking v2 update. This allows you to continue using the original FastMCP syntax while you plan your migration. Note that the separate 'fastmcp' package is a different project and remains unaffected by this specific SDK rename.

Common Pitfalls and Debugging Tips

When migrating, remember that submodule imports have also shifted. Paths like 'mcp.server.fastmcp.prompts' now live under 'mcp.server.mcpserver'. Additionally, v2 no longer automatically reads MCP_* environment variables or .env files; you must pass these settings explicitly in your code. Also, be aware that 'host' and 'port' arguments have moved from the constructor to the 'run()' method. To confirm your installed version, run 'pip show mcp' or 'uv pip show mcp' to ensure you are not inadvertently running v2.x with v1 code.

Key Takeaways

  • MCP SDK v2.0+ renamed FastMCP to MCPServer and moved modules to mcp.server.mcpserver.
  • Update imports to 'from mcp.server.mcpserver import MCPServer' and use keyword arguments for instructions.
  • Pin 'mcp<2' in your dependency file if you need to maintain legacy v1 code without immediate refactoring.
  • Client-side errors often appear as 'Connection closed' because the server crashes on import before logging full details.

The Bottom Line

The rename from FastMCP to MCPServer is a breaking change that catches many developers off guard due to unpinned dependencies. Migrating to the v2 API is the correct long-term solution, but pinning mcp<2 is a valid short-term fix to maintain stability while you update your code.