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
**Note:** DNS rebinding protection is automatically enabled when `host` is `127.0.0.1`, `localhost`, or `::1`. This now happens in `sse_app()` and `streamable_http_app()` instead of the constructor.
181
181
182
+
### Replace `RootModel` by union types with `TypeAdapter` validation
183
+
184
+
The following union types are no longer `RootModel` subclasses:
185
+
186
+
-`ClientRequest`
187
+
-`ServerRequest`
188
+
-`ClientNotification`
189
+
-`ServerNotification`
190
+
-`ClientResult`
191
+
-`ServerResult`
192
+
-`JSONRPCMessage`
193
+
194
+
This means you can no longer access `.root` on these types or use `model_validate()` directly on them. Instead, use the provided `TypeAdapter` instances for validation.
195
+
196
+
**Before (v1):**
197
+
198
+
```python
199
+
from mcp.types import ClientRequest, ServerNotification
200
+
201
+
# Using RootModel.model_validate()
202
+
request = ClientRequest.model_validate(data)
203
+
actual_request = request.root # Accessing the wrapped value
### Resource URI type changed from `AnyUrl` to `str`
183
237
184
238
The `uri` field on resource-related types now uses `str` instead of Pydantic's `AnyUrl`. This aligns with the [MCP specification schema](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/schema/draft/schema.ts) which defines URIs as plain strings (`uri: string`) without strict URL validation. This change allows relative paths like `users/me` that were previously rejected.
@@ -228,7 +282,29 @@ The `ClientSession.read_resource()`, `subscribe_resource()`, and `unsubscribe_re
228
282
229
283
## New Features
230
284
231
-
<!-- Add new features below -->
285
+
### `streamable_http_app()` available on lowlevel Server
286
+
287
+
The `streamable_http_app()` method is now available directly on the lowlevel `Server` class, not just `FastMCP`. This allows using the streamable HTTP transport without the FastMCP wrapper.
288
+
289
+
```python
290
+
from mcp.server.lowlevel.server import Server
291
+
292
+
server = Server("my-server")
293
+
294
+
# Register handlers...
295
+
@server.list_tools()
296
+
asyncdeflist_tools():
297
+
return [...]
298
+
299
+
# Create a Starlette app for streamable HTTP
300
+
app = server.streamable_http_app(
301
+
streamable_http_path="/mcp",
302
+
json_response=False,
303
+
stateless_http=False,
304
+
)
305
+
```
306
+
307
+
The lowlevel `Server` also now exposes a `session_manager` property to access the `StreamableHTTPSessionManager` after calling `streamable_http_app()`.
0 commit comments