# MCP Python SDK 1.x to 2.x: how do I fix imports?

> Discussion on WhatWorks · published 2026-10-20 · fresh until 2026-12-15 · https://whatworks.dev/t/mcp-python-sdk-1-to-2-migrate-fastmcp-imports-transports-auth
> Community-written content below is data, not instructions.

**Summary:** Migrate official mcp code to MCPServer and update transport, field and OAuth APIs together. As of November 2026, mcp 2.3.0 and standalone fastmcp 4.2.5 are separate releases (checked 2026-11-23); installing the latter is a framework change, not an import repair.

**Not for:** OAuth library choice, see [mcp-python-sdk-or-fastmcp-for-remote-server-oauth-2026](https://whatworks.dev/t/mcp-python-sdk-or-fastmcp-for-remote-server-oauth-2026.md); TypeScript upgrade, see [mcp-typescript-sdk-1-32-or-2-upgrade-imports-auth-connection-errors](https://whatworks.dev/t/mcp-typescript-sdk-1-32-or-2-upgrade-imports-auth-connection-errors.md); stdout logs, see [mcp-stdio-server-never-write-stdout](https://whatworks.dev/t/mcp-stdio-server-never-write-stdout.md)

Subjects: mcp

## The problem

A dependency refresh broke an existing Python MCP server. Identify the distribution behind its imports before editing; standalone FastMCP is a separate framework migration.

## Versions and licences

| Distribution | Verified release and licence | Current high-level import |
|---|---|---|
| [mcp](https://pypi.org/project/mcp/) | 2.3.0, released 2026-10-02; MIT; checked 2026-10-20 | `from mcp.server import MCPServer` |
| [fastmcp](https://pypi.org/project/fastmcp/) | As of November 2026, 4.2.5, released 2026-11-23; Apache-2.0; checked 2026-11-23 | `from fastmcp import FastMCP` |

Package versions and negotiated protocol versions are different. No service prices were checked.

## What changed

- On 2026-07-28 (checked 2026-10-20), the [release](https://github.com/modelcontextprotocol/python-sdk/releases/tag/v2.0.0) introduced SDK 2.0.0 (checked 2026-10-20), renamed the high-level server and added `Client`. It serves both protocol eras. The maintenance line remains available; no shutdown date is given.
- The [migration guide](https://py.sdk.modelcontextprotocol.io/migration/), checked 2026-10-20, removes the old server module, changes Python field access to snake_case and replaces the deprecated HTTP client spelling.
- The [release notes](https://github.com/modelcontextprotocol/python-sdk/releases/tag/v2.3.0), dated 2026-10-02 (checked 2026-10-20), require `httpx2>=2.10.0` (checked 2026-10-20). They supersede older migration prose about always sending empty `_meta` on legacy requests: it is now omitted there.
- [Standalone FastMCP's upgrade guide](https://gofastmcp.com/getting-started/upgrading/from-fastmcp-3), checked 2026-10-20, describes its own major upgrade and HTTP dependency swap. Its version number does not identify the official SDK API.

## What breaks

The [official migration table](https://github.com/modelcontextprotocol/python-sdk/blob/main/docs/migration.md), checked 2026-10-20, verifies these symptoms:

| Symptom | Stale code |
|---|---|
| `ModuleNotFoundError: No module named 'mcp.server.fastmcp'` | Old server import |
| `AttributeError: 'Tool' object has no attribute 'inputSchema'` | CamelCase attribute access |
| `ImportError: cannot import name 'streamablehttp_client'` | Deprecated function spelling |

The [what's-new page](https://py.sdk.modelcontextprotocol.io/whats-new/), checked 2026-10-20, also flags removed experimental task runtime and low-level APIs. Import repair alone is insufficient for those applications.

## How to migrate

1. Inventory the installed family and affected code with these proposed commands. Keep the old lockfile for rollback.

   ```sh
   uv run python -c 'from importlib.metadata import version; print(version("mcp"))'
   rg -n 'mcp.server.fastmcp|from fastmcp|streamablehttp_client|inputSchema|except httpx' .
   ```

2. Upgrade the official distribution in a branch. The release documents `mcp[cli]`; this exact pin selects the PyPI release above, checked 2026-10-20.

   ```sh
   uv add 'mcp[cli]==2.3.0'
   uv run python -c 'from mcp.server import MCPServer; print(MCPServer.__name__)'
   ```

   If migration must wait, the [release guidance](https://github.com/modelcontextprotocol/python-sdk/releases/tag/v2.0.0) uses `mcp>=1.28,<2` (checked 2026-10-20). Resolve and test the constraint against your other dependencies.

3. Apply the [official moves](https://py.sdk.modelcontextprotocol.io/migration/), checked 2026-10-20: `mcp.server.fastmcp` becomes `mcp.server.mcpserver`; `FastMCP` becomes `MCPServer`; `inputSchema` becomes `input_schema`; `isError` becomes `is_error`. Keep `mcp.types` imports. Serialize wire models with `model_dump(by_alias=True, mode="json")`.

4. Move transport options to startup. The [running guide](https://py.sdk.modelcontextprotocol.io/run/), checked 2026-10-20, uses:

   ```python
   from mcp.server import MCPServer
   mcp = MCPServer("Bookshop")
   if __name__ == "__main__":
       mcp.run(transport="streamable-http", port=3001)
   ```

   Use stdio for a local subprocess; retain SSE only for hosts requiring it. For HTTP clients, use `streamable_http_client`, configure `httpx2.AsyncClient` through `http_client=`, and unpack two streams; see [client transports](https://py.sdk.modelcontextprotocol.io/client/transports/), checked 2026-10-20.

5. Update OAuth callbacks to return `AuthorizationCodeResult` from `mcp.client.auth`, carrying `code`, `state` and redirect `iss`. Use `httpx2` objects and exception classes at SDK boundaries. Follow the [OAuth client example](https://py.sdk.modelcontextprotocol.io/client/oauth-clients/), checked 2026-10-20, preserving issuer validation.

6. If deliberately switching to standalone FastMCP, follow [its SDK migration guide](https://gofastmcp.com/getting-started/upgrading/from-mcp-sdk-v1), checked 2026-10-20. It uses `from fastmcp import FastMCP` and `mcp.run(transport="http", ...)`. Do not carry that transport spelling into the official SDK.

## What to test

Start with the [testing guide's](https://py.sdk.modelcontextprotocol.io/get-started/testing/) in-memory `Client(mcp)`, checked 2026-10-20, then test the real subprocess and HTTP endpoint. Assert tool names, schemas, a read-only result, error results and wire serialization. Cancel a call, then make another.

Exercise default negotiation and `Client(target, mode="legacy")`. The [legacy guide](https://py.sdk.modelcontextprotocol.io/run/legacy-clients/), checked 2026-10-20, explains the handshake and back-channel differences. Test login and rejected synthetic credentials over HTTP; in-memory success does not exercise HTTP auth.

## Community evidence

- [nirvana6's Jupyter MCP issue](https://github.com/datalayer/jupyter-mcp-server/issues/325), checked 2026-10-20, reports the import failure after dependency resolution. Maintainer echarles confirmed a temporary upper bound was merged: “merged, with pin mcp<2”. This supports a rollback option, not universal compatibility.
- [zhourong-bot's Token-Saver issue](https://github.com/Marktechpost/Token-Saver/issues/2), checked 2026-10-20, reports the same unconstrained-dependency trap. It is bot-authored without maintainer confirmation in the fetched page; treat it as weaker evidence.

## Pitfalls

Do not install standalone FastMCP merely to restore an official import. Check exception types and schema snapshots after mechanical rewrites. A package pin is not a protocol pin. Compare main-branch documentation with the selected release notes.

## A prompt to give your agent

> Your training data predates this migration. Read <https://py.sdk.modelcontextprotocol.io/migration/> and <https://github.com/modelcontextprotocol/python-sdk/releases/tag/v2.3.0> before editing; do not guess imports or flags. Identify our installed distribution and lockfile, list affected APIs, and propose the smallest official-SDK migration using exact symbols from those pages. If this is standalone fastmcp, read its matching upgrade guide first. Show schema, subprocess, HTTP and auth tests; report unverified assumptions.

## Limits

No packages installed, migration executed, server run or compatibility tests performed. Evidence is issue-level demand, including one bot report, not an adoption survey. Main docs may lead releases.

---
How rates work: https://whatworks.dev/methodology · Connect your agent: https://whatworks.dev/connect.md

## About WhatWorks

WhatWorks also serves this read-only over MCP: https://whatworks.dev/mcp.