Repository navigation
Support mcp 2.x - #43
Merged
Merged
Conversation
The runtime declares mcp>=1.26.0 but fails to start on mcp 2.x
("'Server' object has no attribute 'list_tools'"), because mcp 2 replaced
the low-level decorator API. This ports the server to mcp 2 (>=2.3.0,<3)
and keeps the mcp 1.x behaviour where mcp 2 changed it.
Handlers
- Passed to Server(on_list_tools=..., on_call_tool=..., on_list_resources=...,
on_read_resource=...); the request context comes from the handler's ctx
(progress token: ctx.meta["progress_token"])
- Tool arguments are validated against the listed schema as before; a schema
that cannot be used is an error result, not a protocol error
- tools/list leaves out (and logs) a tool whose schema the negotiated
protocol rejects, instead of failing the whole list
- resources/read errors keep their message on every protocol version
- serverInfo.version is the runtime's version
Transports
- SSE: each POST sets its own request headers and user for the tool call
(mcp 2 runs the handler in the POST's context; mcp 1 used the GET stream's)
- Progress on protocol 2026-07-28 is sent with the request's response
(report_progress); earlier protocol versions are unchanged
- New config: max_request_body_size (sse, streamable-http), plus
session_idle_timeout and max_sessions (streamable-http). The defaults (None)
keep mcp 1.x behaviour instead of mcp 2's 4 MiB / 30 min / 10,000.
Other
- openai_compatibility: an object schema without properties gets
"properties": {}, and a bare property map no longer lists "required" as a
property
- mcp 2 types use snake_case attributes (input_schema, mime_type) and plain
string resource URIs
- Tests: FakeServer captures the on_* handlers; new tests run the real mcp
Server with the mcp client on both protocol generations
- README: the new options in the Configuration Reference
Verified stdio, SSE and streamable HTTP (stateless and stateful, JSON and SSE
responses) with mcp 1.28.1 and mcp 2.3.0 clients: tools, validation, errors,
resources, artifacts, bearer auth and progress behave as on main with mcp 1.28.1.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Justinas Aželis <Justinas.Azelis@ibm.com>
Review follow-up: - max_request_body_size now defaults to 50 MiB (sse, streamable-http), enough for tool arguments that carry base64 files or images. An explicit null still disables the limit. mcp 2's own default is 4 MiB. - README: "What's New in v0.12.0" with upgrade notes for servers built on the runtime (mcp pin, httpx no longer installed by mcp, McpError -> MCPError, snake_case type attributes, request context meta) and the transport limit defaults, including that mcp 2's 30 min / 10,000 session defaults are not used - Version 0.12.0, since this release requires mcp 2 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Justinas Aželis <Justinas.Azelis@ibm.com>
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
Release the mcp 2.x migration as an alpha first (tag v0.12.0-alpha). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Justinas Aželis <Justinas.Azelis@ibm.com>
ChrisPC-39
approved these changes
Oct 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The runtime fails to start on mcp 2.x (
'Server' object has no attribute 'list_tools') because mcp 2 removed the low-level decorator API. This PR moves the server to mcp 2 (>=2.3.0,<3); mcp 1.x is no longer supported as a dependency. mcp 1.x clients keep working as before.Changes
Server(on_list_tools=..., on_call_tool=..., ...)instead of registered with decorators. The request context and progress token come from the handler'sctx.Input validation error: ...); mcp 2's low-level server no longer does this.resources/readkeeps its error messages on every protocol version.tools/listskips and logs a tool whose schema the client's protocol rejects, instead of failing the whole list.max_request_body_size(sse, streamable-http), plussession_idle_timeoutandmax_sessions(streamable-http). They default toNone, which keeps mcp 1.x behaviour instead of mcp 2's limits (4 MiB, 30 min, 10,000 sessions). The README documents them."properties": {}, and a bare property map no longer treatsrequiredas a property.serverInfo.versionnow reports the runtime's version.input_schema,mime_type);jsonschemais now a declared dependency.Testing
main, except for the progress limitation below.Notes for servers built on the runtime
mcp<2must lift the pin, code that reads camelCase attributes onmcp.typesobjects needs the snake_case names, andget_request_context().metais now a dict.stateless: falseandjson_response: true, clients on protocol 2026-07-28 get no progress notifications, because a JSON response can't carry them. Usejson_response: falseif that matters.