Skip to content

Commit 2b3a8ea

Browse files
committed
docs: add new low-level server APIs to migration guide
1 parent 34bcf2d commit 2b3a8ea

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

docs/migration.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,60 @@ The `ClientSession.read_resource()`, `subscribe_resource()`, and `unsubscribe_re
165165

166166
## New Features
167167

168+
### Low-level StreamableHTTP server APIs
169+
170+
New exports from `mcp.server` for building custom StreamableHTTP servers without FastMCP:
171+
172+
- `StreamableHTTPSessionManager` - Manages MCP sessions for StreamableHTTP transport
173+
- `create_streamable_http_app()` - Creates a configured Starlette app from a session manager
174+
175+
```python
176+
from mcp.server import Server, StreamableHTTPSessionManager, create_streamable_http_app
177+
178+
server = Server("my-server")
179+
# ... configure handlers ...
180+
181+
session_manager = StreamableHTTPSessionManager(
182+
app=server,
183+
event_store=my_event_store, # Optional, for resumability
184+
json_response=False,
185+
stateless=False,
186+
)
187+
188+
app = create_streamable_http_app(
189+
session_manager,
190+
endpoint_path="/mcp",
191+
additional_routes=[...],
192+
middleware=[...],
193+
)
194+
```
195+
196+
### Reusable auth components
197+
198+
New exports from `mcp.server.auth` for adding OAuth 2.0 authentication to custom servers:
199+
200+
- `AuthComponents` - Dataclass containing middleware, endpoint wrapper, and routes
201+
- `build_auth_components()` - Builds auth components from configuration
202+
203+
```python
204+
from mcp.server.auth import build_auth_components
205+
206+
auth = build_auth_components(
207+
token_verifier=my_verifier,
208+
issuer_url="https://auth.example.com",
209+
required_scopes=["mcp:read"],
210+
resource_server_url="https://api.example.com", # Optional
211+
auth_server_provider=my_provider, # Optional, if acting as OAuth AS
212+
)
213+
214+
app = create_streamable_http_app(
215+
session_manager,
216+
additional_routes=auth.routes,
217+
middleware=auth.middleware,
218+
endpoint_wrapper=auth.endpoint_wrapper,
219+
)
220+
```
221+
168222
<!-- Add new features below -->
169223

170224
## Need Help?

0 commit comments

Comments
 (0)