Skip to content

fix: enable JSON response mode on MCP transport#58

Merged
volod-vana merged 1 commit intovana-com:mainfrom
maciejwitowski:fix/mcp-enable-json-response
Mar 2, 2026
Merged

fix: enable JSON response mode on MCP transport#58
volod-vana merged 1 commit intovana-com:mainfrom
maciejwitowski:fix/mcp-enable-json-response

Conversation

@maciejwitowski
Copy link
Contributor

Summary

  • Enables enableJsonResponse: true on WebStandardStreamableHTTPServerTransport in the MCP route
  • Fixes tool execution errors when Claude connects through a proxy chain (Anthropic → Cloudflare → FRP tunnel → local server)

Problem

The default SSE streaming mode sends HTTP 200 immediately, then writes tool results asynchronously as SSE events. When proxies sit between the MCP client and server, they can buffer, truncate, or close the SSE connection before the result event arrives. This causes Claude to receive {"error": "Error occurred during tool execution"} even though the server processed the request successfully.

Fix

Setting enableJsonResponse: true makes each MCP response a single atomic application/json reply instead of a long-lived SSE stream. This is reliable through any number of intermediary proxies.

Test plan

  • list_files tool call via Claude returns results instead of error
  • OAuth-authenticated and unauthenticated paths both patched
  • Verified end-to-end with DataConnect personal server through FRP tunnel

🤖 Generated with Claude Code

The default SSE streaming mode is unreliable when the request passes
through a proxy chain (e.g. Anthropic → Cloudflare → FRP tunnel →
local server). Proxies can buffer, truncate, or close the SSE
connection before the tool result event arrives, causing Claude to
receive `{"error": "Error occurred during tool execution"}` despite
the server returning HTTP 200.

Setting `enableJsonResponse: true` makes each MCP response a single
atomic `application/json` reply instead of a long-lived SSE stream,
which is reliable through any number of intermediary proxies.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@github-actions github-actions bot added the server label Mar 2, 2026
@volod-vana volod-vana merged commit b75bcfa into vana-com:main Mar 2, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants