fix(mcp): reject unsupported streams and close request resources #13793

Merged
tiensonqin opened 1:05am on October 18, 2026 wanted to merge 5 Ξ” into logseq/logseq master from
fix/mcp-stateless-http
Diff Delta:
5
About 1 Diff Delta/hour
Classified as:  General

tiensonqin's Description of Work

GET /mcp opens an SSE stream on a stateless, per-request server with no producer to send messages or close it. Repeated client probes cause Cloudflare Workers to cancel hung requests and generate error logs.


  • Reject non-POST methods with 405 and Allow: POST before loading the API spec or constructing MCP services.

  • Return stateless JSON responses for POST requests and close each server in finally.

  • Add Workers runtime regression coverage for SSE probes, resume headers, unsupported methods, JSON-RPC responses and errors, 50 concurrent reconnects, and a real SDK client.

  • Install Wrangler locally and gate CI and staging/production release scripts on the runtime tests.

Validation on the master-based branch:
- pnpm test:chatgpt-app: 31 tests passed.
- pnpm test:mcp: clean Worker/API docs builds, 21 runtime tests passed, and deployment dry-run passed.
- JavaScript syntax checks and git diff --check passed.

5 total changed files
(4 files ignored)
Loading changes...
You’ve completed the full review pass
You have reached the final β€œwhy is this here?”