mcp: the native client works with mcp 2 as well as mcp 1 - #35
Merged
Merged
Conversation
mcp 2 renamed the streamable-HTTP client to `streamable_http_client`, which yields the read and write streams only; mcp 1's `streamablehttp_client` yields a session-id getter after them. The client now opens whichever the installed package has and takes the first two streams, and says to upgrade when it has neither. mcp 2's models also have snake_case attributes (`is_error`, `input_schema`) and keep the camelCase names only as JSON aliases, so a tool call's error flag and a listing's schemas are read under either name.
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.
mcp 2 renamed the streamable-HTTP client to
streamable_http_client, which yields the read and write streams only; mcp 1'sstreamablehttp_clientyields a session-id getter after them. The client now opens whichever the installed package has and takes the first two streams, and still says to upgrade when it has neither.mcp 2's models also have snake_case attributes (
is_error,input_schema) and keep the camelCase names only as JSON aliases. A new_field()reads the snake_case name and falls back to mcp 1's, so a tool call's error flag and a listing's schemas are right under either version.Tests: new
tests/test_mcp_client.pywith a fakemcppackage (the[dev]extra does not install the real one), covering both client names, the missing-client error,is_error/isErrorandinput_schema/inputSchema.