Skip to content

fix(mcp): fix streamable HTTP transport protocol compliance#190

Merged
everettjf merged 4 commits intomicroclaw:mainfrom
tdonovic:fix/mcp-streamable-http
Mar 5, 2026
Merged

fix(mcp): fix streamable HTTP transport protocol compliance#190
everettjf merged 4 commits intomicroclaw:mainfrom
tdonovic:fix/mcp-streamable-http

Conversation

@tdonovic
Copy link
Contributor

@tdonovic tdonovic commented Mar 5, 2026

Summary

  • Replaced hand-rolled JSON-RPC/MCP implementation with the rmcp crate for both stdio (child process) and streamable HTTP transports
  • Fixes protocol compliance issues with MCP streamable HTTP transport
  • Significant reduction in code: ~860 lines of custom transport logic replaced by ~200 lines using rmcp

Test plan

  • Test stdio MCP server connections (child process transport)
  • Test streamable HTTP MCP server connections
  • Verify tool discovery and execution work for both transport types
  • Check health monitoring and circuit breaker still function correctly

🤖 Generated with Claude Code

tdonovic and others added 3 commits March 5, 2026 21:01
- Fix DEFAULT_PROTOCOL_VERSION typo: 2025-11-05 → 2024-11-05 (non-existent version caused 400s on servers that validate it)
- Parse SSE-framed response bodies (data: ...) returned by streamable HTTP servers per MCP spec
- Capture mcp-session-id from initialize response and send it on all subsequent requests
- Include response body in HTTP notification error messages for easier debugging
- Add debug logging for raw HTTP MCP responses

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@tdonovic
Copy link
Contributor Author

tdonovic commented Mar 5, 2026

@everettjf I tried using streaming http mcp tools and they didnt work. I started fixing the implementation in the codebase, but quickly ran into more issues. So I replaced the implementation with the library one. MCP is not simple to implement, so many tricky little cases. Now it works great with my http servers (fast mcp python servers)

@everettjf
Copy link
Contributor

Good job. Thank you :)

@everettjf
Copy link
Contributor

@tdonovic Codex did a quick optimization:

  1. Re-enabled MCP request timeouts
    request_timeout_secs (and global fallback) now actually apply to both tool listing and tool calls via tokio::time::timeout.
  2. Reintroduced retry behavior
    max_retries is now honored for transient transport/time-based failures, with exponential backoff.
  3. Restored protocol version configurability
    protocol_version / default_protocol_version are again used during client initialization by building ClientInfo with the requested
    ProtocolVersion, instead of being parsed but ignored.
  4. Corrected sample/docs protocol default
    Updated defaultProtocolVersion examples from 2025-11-05 to valid 2024-11-05 to avoid handshake failures on strict MCP servers.

@everettjf everettjf merged commit 92d3c7a into microclaw:main Mar 5, 2026
6 checks passed
@tdonovic tdonovic deleted the fix/mcp-streamable-http branch March 6, 2026 00:55
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.

2 participants