GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Restore mcp.server.fastmcp as a deprecated import alias for MCPServer by maxisbey · Pull Request #3189 · modelcontextprotocol/python-sdk Conversation
Contributor
Adds a deprecated Motivation and Context
Scope is deliberately narrow:
The keyword-only constructor closes the one hazard the shim would otherwise make silent. v2 inserted How Has This Been Tested?
Breaking Changes
Types of changes
Checklist
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions`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.
|
There was an error while loading. Please reload this page.
📚 Documentation preview
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
No issues found across 5 files
Sorry, something went wrong.
There was an error while loading. Please reload this page.
The rename section still called it a simple rename with no functional changes, contradicting the bridge paragraph and the runtime warning, and it claimed the warning enumerates the silent behaviour changes when it points at the guide instead. No-Verification-Needed: doc-only change
| """Deprecated import path: `FastMCP` was renamed to `MCPServer` in v2. | ||
|
|
||
| This module keeps `from mcp.server.fastmcp import FastMCP` working so v1 code | ||
| runs, but importing it emits an `MCPDeprecationWarning`. It is not a | ||
| behaviour-preserving alias: v2 changed defaults and semantics beyond the name | ||
| (the default server name, transport parameters moving off the constructor, | ||
| sync handlers running on a worker thread). Read the migration guide before | ||
| relying on it: | ||
|
|
||
| https://py.sdk.modelcontextprotocol.io/v2/migration/ | ||
|
|
||
| Only this package init is shimmed. Submodules such as | ||
| `mcp.server.fastmcp.server` or `mcp.server.fastmcp.prompts.base` no longer | ||
| exist; their contents live under `mcp.server.mcpserver`. This module is removed | ||
| in v3. | ||
| """ |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
🟡 docs/whats-new.md line 19 still says the old mcp.server.fastmcp import path "is gone rather than deprecated" — after this PR that sentence is wrong on both counts, since the path exists again and emits an MCPDeprecationWarning (only its submodules still raise ModuleNotFoundError). A one-sentence edit to whats-new.md (mirroring the updated symptom row in docs/migration.md) brings it in line.
What's wrong: docs/whats-new.md line 19, in the "FastMCP is now MCPServer" section, reads: "This is the first thing every v1 server hits, because the old import path is gone rather than deprecated." This PR's headline change is precisely that the old import path is no longer gone and is now deprecated: the new src/mcp/server/fastmcp/__init__.py shim makes from mcp.server.fastmcp import FastMCP (plus Context, Image, Audio, Icon) resolve to the v2 objects while emitting an MCPDeprecationWarning. The sentence is therefore false on both counts once this PR merges.
Why it slipped through: the PR did update the docs for this behaviour change — docs/migration.md's quick-reference table now says MCPDeprecationWarning: mcp.server.fastmcp is deprecated, or ModuleNotFoundError for its submodules, and a new paragraph in the "FastMCP renamed" section describes the bridge. But docs/whats-new.md covers the same rename in its own words and wasn't touched, so the two pages now contradict each other about the PR's central feature. AGENTS.md asks that changes affecting user-visible behaviour update the relevant docs/ pages in the same PR, which suggests this is an oversight rather than a scoping decision.
Concrete walkthrough: a v1 user upgrading to v2 reads whats-new.md, which tells them their first symptom will be an import error because "the old import path is gone." They then run their server: from mcp.server.fastmcp import FastMCP succeeds with a warning, and FastMCP("Demo") works (it's MCPServer under the old name). The doc's claim doesn't match what they observe — and worse, a user who trusts the doc might not realize the warning-emitting shim is a temporary bridge removed in v3. Meanwhile migration.md (correctly) tells the same reader the path "is not gone entirely."
Impact: documentation-only. Nothing breaks at runtime; the shim, warning, and tests in this PR all behave as intended. The cost is reader confusion between two docs pages describing the same rename, on the exact behaviour this PR changes.
Fix: a one-sentence edit to docs/whats-new.md line 19, e.g.: "This is the first thing every v1 server hits — the top-level import now resolves with an MCPDeprecationWarning (removed in v3), while submodules like mcp.server.fastmcp.server still raise ModuleNotFoundError." That matches the framing the PR already adopted in docs/migration.md.
All three verifiers confirmed the finding; two rated it nit and one normal. Since the code is correct and only a doc sentence is stale, this doesn't warrant blocking the merge — nit severity.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I don't think this is worth doing |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.