Moving a small FastMCP server + client from mcp 1.26.0 to 2.3.0 hit 8 breakages in order: renamed client and error classes, httpx no longer installed, FastMCP renamed to MCPServer, host/port moved to run(), snake_case result fields, a new MCPError signature, a 2-tuple HTTP client, and plain exceptions from tools no longer reaching the model. Each error, cause and fix, reproduced in Docker.
Upgrading a working FastMCP server and client from mcp==1.26.0 to mcp==2.3.0 broke in 8 places. The import errors come with helpful hints, but two of them don't: the server crashes on import httpx (mcp 2.x installs httpx2 instead), which the client only reports as MCPError: Connection closed. And a plain ValueError raised in a tool no longer shows its message to the model. Fixes: rename the imports, add httpx to your own dependencies, pass host/port to run(), use snake_case result fields, and raise ToolError for errors the model should read.
mcp.shared.exceptions.MCPError: Connection closedEnvironment: Docker python:3.12-slim (Python 3.12.16). Before: mcp 1.26.0, httpx 0.29.0, pydantic 2.14.4. After: mcp 2.3.0, mcp-types 2.3.0, httpx2 2.17.0, plus httpx 0.29.0 added by hand. Reproduced 2026-11-30.
The project: a notes server with three tools (one uses Context, one raises an error, one calls an HTTP API through httpx), a resource template and a prompt. A client calls all of them over stdio and over streamable HTTP. On 1.26.0 every call succeeds (repro/step0-baseline-mcp1.26.log). I then bumped only mcp and fixed one error at a time.
1. mcp 2.x: cannot import name 'streamablehttp_client'
ImportError: cannot import name 'streamablehttp_client' from 'mcp.client.streamable_http' (...). Did you mean: 'streamable_http_client'?In mcp 2.x the function is streamable_http_client. Rename it. Its signature changed as well (see section 7).
2. mcp 2.x: cannot import name 'McpError'
ImportError: cannot import name 'McpError' from 'mcp.shared.exceptions' (...). Did you mean: 'MCPError'?Rename it to MCPError everywhere. The constructor changed too (section 8).
3. mcp 2.x: client fails with "MCPError: Connection closed" because the server can't import httpx
The client only shows MCPError: Connection closed from session.initialize(). The cause is on the server's stderr:
ModuleNotFoundError: No module named 'httpx'mcp 1.x depended on httpx, so server code could import httpx without declaring it. mcp 2.3.0 depends on httpx2/httpcore2 instead, so httpx is no longer installed. Fix: add httpx to your own requirements (pip install httpx==0.29.0). Don't rewrite your code for httpx2. When a stdio client reports "Connection closed", run the server by hand (python server.py) to see the real error.
4. mcp 2.x: No module named 'mcp.server.fastmcp'
ModuleNotFoundError: No module named 'mcp.server.fastmcp'. This is mcp 2.x, where FastMCP was renamed to MCPServer (from mcp.server.mcpserver import MCPServer) ...Use from mcp.server.mcpserver import MCPServer, Context and MCPServer("notes"). The decorators (@mcp.tool(), @mcp.resource(...), @mcp.prompt()) worked unchanged.
5. mcp 2.x: MCPServer.__init__() got an unexpected keyword argument 'host'
TypeError: MCPServer.__init__() got an unexpected keyword argument 'host'In 2.x, host and port are passed to run() instead: mcp.run("streamable-http", host="127.0.0.1", port=8765). Keep mcp.run("stdio") for stdio.
6. mcp 2.x: 'CallToolResult' object has no attribute 'isError'
AttributeError: 'CallToolResult' object has no attribute 'isError'. Did you mean: 'is_error'?Result models now use snake_case: is_error, structured_content. I also got MCPDeprecationWarning: The logging capability is deprecated as of 2026-07-28 (SEP-2577) from await ctx.info(...). It is only a warning, and I removed the call.
7. mcp 2.x: streamable_http_client: not enough values to unpack (expected 3, got 2)
ValueError: not enough values to unpack (expected 3, got 2)streamable_http_client(url) now yields (read, write), without the session-id callback. Use async with streamable_http_client(url) as (read, write):. Custom headers or auth now go through http_client= (an httpx2.AsyncClient).
8. mcp 2.x: MCPError() signature changed, and tool exceptions are hidden
Raising the 1.x-style McpError(ErrorData(...)) (renamed to MCPError) inside a tool gives:
TypeError: MCPError.__init__() missing 1 required positional argument: 'message'The new signature is MCPError(code, message, data=None), and it is meant for protocol errors. For "this input is wrong" errors the model should read, raise mcp.server.mcpserver.exceptions.ToolError("no note 'missing'"). The call then returns is_error=True with your message.
This also matters for plain exceptions. With the same tool raising ValueError, the result text was (repro/valueerror/valueerror-compare.log):
mcp 1.26.0 -> Error executing tool parse_qty: quantity must be digits, got 'ten'mcp 2.3.0 -> Error executing tool parse_qtyNothing crashes, but the model no longer sees why the call failed, so it can't correct its arguments. Convert expected failures to ToolError.
What didn't work
- Switching your own code to
httpx2to match mcp: it isn't needed. Declarehttpxyourself. - Treating "Connection closed" as a transport bug: in every case here, the server process had died on import.
Final working setup
requirements.txt: mcp==2.3.0, httpx==0.29.0. The full diff is repro/app → repro/app-v2. repro/step8-toolerror-and-http-unpack.log matches the 1.26 baseline over stdio and HTTP. If you can't migrate yet, pin mcp<2.
Sources
- Migration guide (linked from the SDK's own error): https://py.sdk.modelcontextprotocol.io/v2/migration/#fastmcp-renamed-to-mcpserver
- Supporting 1.x and 2.x at once: https://github.com/modelcontextprotocol/python-sdk/issues/3309
ToolErrorvs crash semantics: docstrings inmcp/server/mcpserver/exceptions.py(2.3.0)