Skip to content

Commit ab4f998

Browse files
committed
update migration
1 parent 49b0ca4 commit ab4f998

File tree

1 file changed

+29
-5
lines changed

1 file changed

+29
-5
lines changed

docs/migration.md

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,26 @@ result = await session.list_resources(params=PaginatedRequestParams(cursor="next
116116
result = await session.list_tools(params=PaginatedRequestParams(cursor="next_page_token"))
117117
```
118118

119+
### `FastMCP` renamed to `MCPServer`
120+
121+
The `FastMCP` class has been renamed to `MCPServer` to better reflect its role as the main server class in the SDK. This is a simple rename with no functional changes to the class itself.
122+
123+
**Before (v1):**
124+
125+
```python
126+
from mcp.server.fastmcp import FastMCP
127+
128+
mcp = FastMCP("Demo")
129+
```
130+
131+
**After (v2):**
132+
133+
```python
134+
from mcp.server.mcpserver import MCPServer
135+
136+
mcp = MCPServer("Demo")
137+
```
138+
119139
### `mount_path` parameter removed from MCPServer
120140

121141
The `mount_path` parameter has been removed from `MCPServer.__init__()`, `MCPServer.run()`, `MCPServer.run_sse_async()`, and `MCPServer.sse_app()`. It was also removed from the `Settings` class.
@@ -138,14 +158,14 @@ Transport-specific parameters have been moved from the `MCPServer` constructor t
138158
**Before (v1):**
139159

140160
```python
141-
from mcp.server.mcpserver import MCPServer
161+
from mcp.server.fastmcp import FastMCP
142162

143163
# Transport params in constructor
144-
mcp = MCPServer("Demo", json_response=True, stateless_http=True)
164+
mcp = FastMCP("Demo", json_response=True, stateless_http=True)
145165
mcp.run(transport="streamable-http")
146166

147167
# Or for SSE
148-
mcp = MCPServer("Server", host="0.0.0.0", port=9000, sse_path="/events")
168+
mcp = FastMCP("Server", host="0.0.0.0", port=9000, sse_path="/events")
149169
mcp.run(transport="sse")
150170
```
151171

@@ -165,14 +185,18 @@ mcp.run(transport="sse", host="0.0.0.0", port=9000, sse_path="/events")
165185

166186
**For mounted apps:**
167187

168-
When mounting MCPServer in a Starlette app, pass transport params to the app methods:
188+
When mounting in a Starlette app, pass transport params to the app methods:
169189

170190
```python
171191
# Before (v1)
172-
mcp = MCPServer("App", json_response=True)
192+
from mcp.server.fastmcp import FastMCP
193+
194+
mcp = FastMCP("App", json_response=True)
173195
app = Starlette(routes=[Mount("/", app=mcp.streamable_http_app())])
174196

175197
# After (v2)
198+
from mcp.server.mcpserver import MCPServer
199+
176200
mcp = MCPServer("App")
177201
app = Starlette(routes=[Mount("/", app=mcp.streamable_http_app(json_response=True))])
178202
```

0 commit comments

Comments
 (0)