feat(mcp): replace hand-rolled HTTP with SDK streamable_http_client#3491
Open
Hundao wants to merge 1 commit intoadenhq:mainfrom
Open
feat(mcp): replace hand-rolled HTTP with SDK streamable_http_client#3491Hundao wants to merge 1 commit intoadenhq:mainfrom
Hundao wants to merge 1 commit intoadenhq:mainfrom
Conversation
Use the MCP SDK's streamable_http_client for spec-compliant Streamable HTTP transport, unifying both STDIO and HTTP paths to share the same ClientSession-based tool listing, invocation, and cleanup logic. - Remove httpx dependency and hand-rolled JSON-RPC calls - Auto-append /mcp to URLs without a path (FastMCP default) - Add unit tests (15) and integration tests (7) for the HTTP transport
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.
Description
Replace the hand-rolled
httpx-basedHTTP implementation inMCPClientwith the MCP SDK'sstreamable_http_client, making the HTTP transport spec-compliant and unifying both STDIO and HTTP code paths.Type of Change
Related Issues
Fixes #3152 (Step 1 — Transport Protocol)
Changes Made
httpx.Client+ hand-rolled JSON-RPC with MCP SDK'sstreamable_http_client+ClientSession/mcpto URLs without a path (matches FastMCP's default Streamable HTTP endpoint)import httpxtop-level dependencyhttpx.AsyncClientin_cleanup_async()(SDK does not auto-close a provided client)test_mcp_client.py) covering URL handling, validation, unified interface, cleanup, and configtest_mcp_client_integration.py) with an in-process FastMCP server over real HTTPTesting
cd core && pytest tests/test_mcp_client.py) — 15/15cd core && pytest tests/test_mcp_client_integration.py) — 7/7ruff check)ruff format --check)https://mapstools.googleapis.com/mcpChecklist
Screenshots (if applicable)
E2E: web_research_agent (STDIO transport)
E2E: place_finder_agent (HTTP transport → Google Maps MCP)