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.
0 commit comments