Point imports of mcp.server.fastmcp at the migration guide (#3388)
This commit is contained in:
parent
4d6f87e8d2
commit
0921d94a74
1 changed files with 80 additions and 6 deletions
16
src/mcp/server/fastmcp.py
Normal file
16
src/mcp/server/fastmcp.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
"""Removed in mcp 2: `FastMCP` is now `mcp.server.mcpserver.MCPServer`.
|
||||
|
||||
This module has no API. Importing it, or anything below it, raises
|
||||
`ModuleNotFoundError` with a message that points at the migration guide. It
|
||||
exists only because the bare "No module named 'mcp.server.fastmcp'" gave v1
|
||||
code no hint that the installed SDK is a different major version.
|
||||
"""
|
||||
|
||||
_MESSAGE = (
|
||||
"No module named 'mcp.server.fastmcp'. This is mcp 2.x, where FastMCP was renamed to MCPServer "
|
||||
"(from mcp.server.mcpserver import MCPServer) and other APIs changed; see the migration guide at "
|
||||
"https://py.sdk.modelcontextprotocol.io/v2/migration/#fastmcp-renamed-to-mcpserver "
|
||||
"or pin 'mcp<2' to keep running v1 code."
|
||||
)
|
||||
|
||||
raise ModuleNotFoundError(_MESSAGE, name=__name__)
|
||||
Loading…
Reference in a new issue