What happened
PEBBLE MCP gateway integrated Traceo (26-tool requirements management server) via HTTP transport protocol instead of subprocess invocation. This required understanding and fixing three critical issues that aren’t documented in FastMCP’s public HTTP documentation.The three issues
1. Accept Header Incompleteness
Problem: HTTP requests to FastMCP servers fail silently if the Accept header includes onlyapplication/json.
Root cause: FastMCP uses Server-Sent Events (SSE) for streaming responses. The server checks that both application/json AND text/event-stream are acceptable before responding.
Fix: Change the Accept header from:
2. SSE Response Wrapping
Problem: FastMCP HTTP responses are wrapped in Server-Sent Event format, not raw JSON. Expected response:{"jsonrpc": "2.0", "result": {...}, "id": 1}
Actual response:
json.JSONDecodeError.
3. Session ID Requirement
Problem: After the initial handshake, FastMCP HTTP servers require amcp-session-id header in every subsequent request.
Why it’s needed: HTTP is stateless, but the MCP protocol expects session context. The server assigns a session ID during initialization and validates it on every call.
Discovery: This isn’t mentioned in FastMCP docs. Found by examining response headers:
Why this matters
These three issues are not surfaced in error messages. The stack looks like:- Accept header incomplete → HTTP 415 (but some clients retry)
- SSE wrapper present → JSON parsing fails silently
- Session ID missing → 401 Unauthorized (looks like auth failure, not session failure)
Organizational takeaway
When integrating HTTP MCP servers into any platform:- Assume SSE wrapping. Don’t assume raw JSON.
- Always include both content types in Accept. Make it a constant.
- Capture and validate session headers. Treat HTTP MCP like stateful protocol despite HTTP being stateless.
- Log the raw response before parsing. When things fail, the SSE wrapper often reveals the real error nested in the
data:line.
Current state
- PEBBLE: HttpTransport class in
src/pebble/infrastructure/mcp/transports/http.pyimplements all three fixes - Traceo: Running on Railway at
https://mcp.traceo.cat, health endpoint verified - Integration: 16 core tools discovered and tested via HTTP MCP
- Testing: 11 integration tests passing, all scenarios covered