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
### `RequestParams.Meta` replaced with `RequestParamsMeta` TypedDict
237
+
238
+
The nested `RequestParams.Meta` Pydantic model class has been replaced with a top-level `RequestParamsMeta` TypedDict. This affects the `ctx.meta` field in request handlers and any code that imports or references this type.
### Resource URI type changed from `AnyUrl` to `str`
237
266
238
267
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.
@@ -274,12 +303,48 @@ Affected types:
274
303
-`UnsubscribeRequestParams.uri`
275
304
-`ResourceUpdatedNotificationParams.uri`
276
305
277
-
The `ClientSession.read_resource()`, `subscribe_resource()`, and `unsubscribe_resource()` methods now accept both `str` and `AnyUrl` for backwards compatibility.
306
+
The `Client` and `ClientSession` methods `read_resource()`, `subscribe_resource()`, and `unsubscribe_resource()` now only accept `str` for the `uri` parameter. If you were passing `AnyUrl` objects, convert them to strings:
### Extra fields no longer allowed on top-level MCP types
327
+
328
+
MCP protocol types no longer accept arbitrary extra fields at the top level. This matches the MCP specification which only allows extra fields within `_meta` objects, not on the types themselves.
329
+
330
+
```python
331
+
# This will now raise a validation error
332
+
from mcp.types import CallToolRequestParams
333
+
334
+
params = CallToolRequestParams(
335
+
name="my_tool",
336
+
arguments={},
337
+
unknown_field="value", # ValidationError: extra fields not permitted
338
+
)
339
+
340
+
# Extra fields are still allowed in _meta
341
+
params = CallToolRequestParams(
342
+
name="my_tool",
343
+
arguments={},
344
+
_meta={"progressToken": "tok", "customField": "value"}, # OK
345
+
)
346
+
```
347
+
283
348
## New Features
284
349
285
350
### `streamable_http_app()` available on lowlevel Server
0 commit comments