You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Restore mcp.server.fastmcp as a deprecated import alias for MCPServer
`from mcp.server.fastmcp import FastMCP` (and the Context, Image,
Audio, Icon names v1 exported alongside it) resolves again, to the v2
objects, and emits MCPDeprecationWarning at import. Only the package
init is shimmed; the fastmcp submodule tree still raises
ModuleNotFoundError. The alias is removed in v3.
MCPServer's constructor now takes everything after `name` as
keyword-only, matching the lowlevel Server. A v1 call that passed
`instructions` positionally previously landed the text in the new
`title` parameter silently; it now raises TypeError, which matters
more once the old import path stops forcing users through the guide.
Copy file name to clipboardExpand all lines: docs/migration.md
+8-6Lines changed: 8 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ Every section heading below names the API it affects, so searching this page for
12
12
13
13
| Change | First symptom | Section |
14
14
|---|---|---|
15
-
|`FastMCP` renamed to `MCPServer`|`ModuleNotFoundError: No module named 'mcp.server.fastmcp'`|[`FastMCP` renamed](#fastmcp-renamed-to-mcpserver)|
15
+
|`FastMCP` renamed to `MCPServer`|`MCPDeprecationWarning: mcp.server.fastmcp is deprecated`, or `ModuleNotFoundError` for its submodules|[`FastMCP` renamed](#fastmcp-renamed-to-mcpserver)|
16
16
| Fields renamed from camelCase to snake_case |`AttributeError: 'Tool' object has no attribute 'inputSchema'`|[snake_case fields](#field-names-changed-from-camelcase-to-snake_case)|
17
17
|`mcp.types` moved to the `mcp-types` package |`ModuleNotFoundError: No module named 'mcp.types'`|[`mcp.types` moved](#mcptypes-moved-to-the-mcp-types-package)|
18
18
|`McpError` renamed to `MCPError`|`ImportError: cannot import name 'McpError' from 'mcp'`|[`McpError` renamed](#mcperror-renamed-to-mcperror)|
@@ -552,6 +552,8 @@ mcp = MCPServer("Demo")
552
552
553
553
`Context` is the type annotation for the `ctx` parameter injected into tools, resources, and prompts (see [`get_context()` removed](#mcpserverget_context-removed) below). The `ctx.fastmcp` property is now `ctx.mcp_server`.
554
554
555
+
The old import path is not gone entirely: `from mcp.server.fastmcp import FastMCP` (and `Context`, `Image`, `Audio`, `Icon` — the names v1 exported there) still resolves, to the v2 objects, and emits an `MCPDeprecationWarning` at import. That is a bridge, not a compatibility layer: `FastMCP` is `MCPServer` under its old name, with every v2 change on this page in effect, and the warning names the ones that don't announce themselves. The path is removed in v3. Nothing beneath it is shimmed, so `mcp.server.fastmcp.server`, `mcp.server.fastmcp.prompts.base`, and the rest raise `ModuleNotFoundError`.
556
+
555
557
All submodules under `mcp.server.fastmcp.*` are now under `mcp.server.mcpserver.*` with the same structure. Common imports:
556
558
557
559
-`Image`, `Audio` — from `mcp.server.mcpserver` (or `.utilities.types`)
If test suites assert on the initialize result, or anything keys configuration or allow-lists off `serverInfo.name`, pass a name explicitly: `MCPServer("FastMCP")` preserves the old value, though a real name for your server is better.
583
585
584
-
### `MCPServer` constructor: `title`, `description`, and `version` added to the positional parameters
586
+
### `MCPServer` constructor: parameters after `name` are now keyword-only
585
587
586
-
The constructor's positional parameter order changed. v2 inserts `title` and `description`before `instructions`, and `version`after `icons`, so the order is now `name`, `title`, `description`, `instructions`, `website_url`, `icons`, `version`. In v1 the order was `name`, `instructions`, `website_url`, `icons`.
588
+
As with the [lowlevel `Server`](#lowlevel-server-constructor-parameters-are-now-keyword-only), only `name` is positional. `title` and `description`were added to the constructor and `version`moved off the installed package (see below), which reshuffled the parameter order relative to v1's `name`, `instructions`, `website_url`, `icons`. Rather than let a v1 call that passed `instructions` positionally quietly land its text in `title`, v2 makes every parameter after `name` keyword-only, so that call raises instead:
587
589
588
-
A v1 call that passed `instructions` positionally still runs without error on v2, because both slots are `str | None`. The text silently lands in `title` instead: the server sends it as `serverInfo.title` and stops sending `instructions` in the initialize result, which clients feed to the model.
590
+
```text
591
+
TypeError: MCPServer.__init__() takes from 1 to 2 positional arguments but 3 were given
592
+
```
589
593
590
594
**Before (v1):**
591
595
@@ -604,8 +608,6 @@ from mcp.server.mcpserver import MCPServer
604
608
mcp = MCPServer("Demo", instructions="You answer questions about the weather.")
605
609
```
606
610
607
-
Keep `name` positional and pass everything else by keyword.
608
-
609
611
### Unversioned servers report an empty version
610
612
611
613
In v1, a server constructed without a `version` reported the installed `mcp`
0 commit comments