Skip to content

Commit b978383

Browse files
committed
docs: record the unknown-method error-code change in the migration guide
The -32602 -> -32601 change for unknown request methods is wire-visible, so it gets a Bug Fixes entry. Also add the new protocol_version property to the ServerSession surface enumeration.
1 parent 22176ef commit b978383

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

docs/migration.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1135,7 +1135,7 @@ from mcp.server import ServerRequestContext
11351135

11361136
### `ServerSession` is now a thin proxy (no longer a `BaseSession`)
11371137

1138-
`ServerSession` no longer subclasses `BaseSession`. It is now a small connection-scoped proxy that exposes `send_request`, `send_notification`, the typed convenience helpers (`create_message`, `elicit_form`, `send_log_message`, `send_tool_list_changed`, ...), `client_params`, and `check_client_capability`. The receive loop, `initialize` handling, and per-request task isolation that previously lived in `ServerSession` have moved to `JSONRPCDispatcher` and `ServerRunner`.
1138+
`ServerSession` no longer subclasses `BaseSession`. It is now a small connection-scoped proxy that exposes `send_request`, `send_notification`, the typed convenience helpers (`create_message`, `elicit_form`, `send_log_message`, `send_tool_list_changed`, ...), `client_params`, `protocol_version`, and `check_client_capability`. The receive loop, `initialize` handling, and per-request task isolation that previously lived in `ServerSession` have moved to `JSONRPCDispatcher` and `ServerRunner`.
11391139

11401140
`ServerSession` is normally constructed for you by `Server.run()` and reached via `ctx.session` in handlers, so most servers are unaffected. If you were constructing or subclassing it directly:
11411141

@@ -1182,6 +1182,10 @@ Tasks are expected to return as a separate MCP extension in a future release.
11821182

11831183
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.
11841184

1185+
### Unknown request methods now return `-32601` (Method not found)
1186+
1187+
In v1, a request for a method the SDK didn't recognize failed request-union validation and was answered with `-32602` (`"Invalid request parameters"`, empty `data`). Unknown methods are now answered with the JSON-RPC-specified `-32601` (`"Method not found"`), with the method name in `data` — on both the server and the client side, including before initialization completes. Update anything that matched on the old code for this case.
1188+
11851189
### Extra fields on MCP types are no longer preserved
11861190

11871191
In v1, MCP protocol types were configured with `extra="allow"`: unknown fields passed to a constructor or received from a peer were kept on the model and re-serialized on output.

0 commit comments

Comments
 (0)