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
The internal layers (`ToolManager.call_tool`, `Tool.run`, `Prompt.render`, `ResourceTemplate.create_resource`, etc.) now require `context` as a positional argument.
511
522
523
+
### Resource not found returns `-32602` and resource lookups raise typed exceptions (SEP-2164)
524
+
525
+
Reading a missing resource now returns JSON-RPC error code `-32602` (invalid params) with the requested URI in `error.data` (`{"uri": ...}`), per [SEP-2164](https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2164). Previously the server returned code `0` with no `data`. Clients can now reliably distinguish not-found from other errors; a template handler that raises `ResourceNotFoundError` (from `mcp.server.mcpserver.exceptions`) produces this same response.
526
+
527
+
The underlying lookups now raise typed exceptions instead of `ValueError`. `ResourceManager.get_resource()` raises `ResourceNotFoundError` when no resource or template matches the URI, and `ResourceTemplate.create_resource()` raises `ResourceError` when the template function fails. Neither subclasses `ValueError`, so callers catching `ValueError` should switch to `ResourceNotFoundError` / `ResourceError` (both importable from `mcp.server.mcpserver.exceptions`; `ResourceNotFoundError` subclasses `ResourceError`).
528
+
512
529
### Registering lowlevel handlers from `MCPServer`
513
530
514
531
`MCPServer` does not expose public APIs for `subscribe_resource`, `unsubscribe_resource`, or `set_logging_level` handlers. In v1, the workaround was to reach into the private lowlevel server and use its decorator methods:
@@ -1232,6 +1249,16 @@ Tasks are expected to return as a separate MCP extension in a future release.
1232
1249
1233
1250
## Bug Fixes
1234
1251
1252
+
### OAuth metadata URLs no longer gain a trailing slash
1253
+
1254
+
`OAuthMetadata`, `ProtectedResourceMetadata`, and `OAuthClientMetadata` now set
1255
+
`url_preserve_empty_path=True` (Pydantic 2.12+). A path-less URL parsed from the wire keeps its
1256
+
empty path instead of acquiring a trailing slash, so e.g. an `issuer` of `https://as.example.com`
1257
+
round-trips as `https://as.example.com` rather than `https://as.example.com/`. This matters for
URLs constructed in Python from an already-built `AnyHttpUrl` object are unaffected (they were
1260
+
normalized at construction); only values parsed from strings/JSON change.
1261
+
1235
1262
### Lowlevel `Server`: `subscribe` capability now correctly reported
1236
1263
1237
1264
Previously, the lowlevel `Server` hardcoded `subscribe=False` in resource capabilities even when a `subscribe_resource()` handler was registered. The `subscribe` capability is now dynamically set to `True` when an `on_subscribe_resource` handler is provided. Clients that previously didn't see `subscribe: true` in capabilities will now see it when a handler is registered, which may change client behavior.
0 commit comments