Skip to content

fix(mcp): fall back to the legacy HTTP+SSE transport - #2530

Merged
vastsa merged 2 commits into
mainfrom
fix/mcp-legacy-sse-fallback
Nov 23, 2026
Merged

vastsa merged 2 commits into
mainfrom
fix/mcp-legacy-sse-fallback

Conversation

@vastsa

@vastsa vastsa commented Nov 23, 2026

Copy link
Copy Markdown
Owner

Servers on the 2024-11-05 HTTP+SSE transport reject the streamable initialize POST with 405 (#2528). Following the MCP backwards-compatibility path, a 400/404/405 on initialize now opens GET <url> as an event stream, waits for the endpoint event, and posts messages there.

  • Endpoint must share the configured origin (it receives the configured headers).
  • 401 and other statuses never fall back; a server speaking neither transport keeps the original error.
  • Closing the client aborts the stream; a stream that ends closes the session.

Tests: apps/desktop/test/mcp-legacy-sse.test.mjs (fails on old code), existing MCP suites (88 pass), desktop tsc --noEmit.

fixes #2528

Servers still built on the 2024-11-05 HTTP+SSE transport only accept
GET on their configured URL, so the streamable initialize POST failed
with "mcp server returned 405" and the server could not be used.

When initialize is rejected with 400, 404 or 405, the client now follows
the MCP backwards-compatibility path: open the event stream, wait for
the endpoint event and post messages there. The endpoint must share the
configured origin because it receives the configured headers; other
statuses never fall back, and a server that speaks neither transport
keeps its original error.

fixes #2528
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Deploying pi-desktop with  Cloudflare Pages  Cloudflare Pages

Latest commit: 9a6c43f
Status: ✅  Deploy successful!
Preview URL: https://ca26203f.pi-desktop.pages.dev
Branch Preview URL: https://fix-mcp-legacy-sse-fallback.pi-desktop.pages.dev

View logs

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.

[Bug] mcp使用http的方式报错405

1 participant