Skip to content

fix: make HTTP transport more lenient for Claude Code compatibility#26

Draft
GiggleLiu wants to merge 1 commit intoJuliaSMLM:mainfrom
GiggleLiu:fix/lenient-http-health-check
Draft

fix: make HTTP transport more lenient for Claude Code compatibility#26
GiggleLiu wants to merge 1 commit intoJuliaSMLM:mainfrom
GiggleLiu:fix/lenient-http-health-check

Conversation

@GiggleLiu
Copy link

Summary

  • Plain GET requests now return health check JSON instead of HTTP 406, allowing Claude Code's health check to succeed
  • Accept header check for POST requests relaxed from strict 406 to debug warning, as Claude Code may not send the full Accept header per MCP 2025-06-18 spec

Background

Claude Code's HTTP MCP transport has known issues:

  • Health check sends plain GET without Accept: text/event-stream header
  • POST requests may not include both application/json and text/event-stream in Accept header

These issues are documented in:

The issues are closed as "not planned" on Claude Code's side, so server-side leniency is needed for compatibility.

Changes

  1. Plain GET health check (src/transports/http.jl:283-294):

    • Before: HTTP 406 "Not Acceptable"
    • After: HTTP 200 with JSON {"status":"ok","protocol_version":"2025-06-18","session_id":null}
  2. Lenient Accept header (src/transports/http.jl:347-353):

    • Before: HTTP 406 if Accept doesn't include both types
    • After: Debug log warning, continue processing

Test plan

  • Added test for plain GET health check response
  • Added test for lenient Accept header on POST requests
  • All existing tests pass (267 tests)

🤖 Generated with Claude Code

Changes:
- Plain GET requests now return health check JSON instead of HTTP 406
  This allows Claude Code's health check to succeed
- Accept header check for POST relaxed from strict 406 to debug warning
  Claude Code may not send the full Accept header per MCP 2025-06-18 spec

The MCP protocol version header was already lenient (debug log only).
These changes improve compatibility with clients that don't fully
implement the MCP 2025-06-18 specification.

Fixes connection issues with Claude Code HTTP MCP transport.
See: anthropics/claude-code#11633
See: anthropics/claude-code#9492

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@GiggleLiu GiggleLiu marked this pull request as draft January 22, 2026 11:14
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