Skip to content

feat(mcp): support remote Streamable HTTP tool servers - #41

Open
Morrow588 wants to merge 5 commits into
he-yufeng:mainfrom
Morrow588:feature/mcp-streamable-http
Open

Morrow588 wants to merge 5 commits into
he-yufeng:mainfrom
Morrow588:feature/mcp-streamable-http

Conversation

@Morrow588

Copy link
Copy Markdown

Summary

Add the small Streamable HTTP transport discussed in #40. A server configured with url and optional static headers now exposes its tools through the existing MCP wrappers, consent gate, hooks and explicit reconnect flow. The transport is 121 lines and adds no runtime dependency.

  • Share initialization and tool discovery with stdio; accept JSON and SSE POST responses, including multiline UTF-8 events and notifications before the matching reply.
  • Negotiate the protocol version, retain session IDs, and terminate stateful sessions with best-effort DELETE. Stateless servers work too.
  • Bound reads, refuse redirects, and surface transport/protocol errors as MCP errors. Never automatically replay tools/call after a lost response or expired session; users explicitly reconnect.
  • Add 25 HTTP test cases using a real loopback HTTP server, plus English/Chinese setup documentation and a configuration walkthrough. Refresh source counts enforced by documentation tests.

Validation

  • pytest tests/ -q: 251 passed, 1 skipped. The existing opt-in live LLM smoke test needs an API key and was not enabled. HTTP tests need no external service or LLM credentials.
  • ruff check corecoder tests: passed.
  • python -m compileall -q corecoder tests: passed.
  • python -m build and twine check dist/*: passed from a clean tracked-source snapshot; verified the wheel includes mcp_http.py.

Scope

Tools only, with protocol versions 2025-06-18 and 2025-03-26. OAuth discovery, resources/prompts, legacy HTTP+SSE and resumable server-initiated streams remain outside this transport.

AI disclosure: implementation, tests and this description were generated with OpenAI Codex and validated locally.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant