@vercel[bot]1mo ago
refactor(mcp): replace mcp-handler with stateless SDK handler + Redis bridge
loading diff…
mcp-handler npm package and implement MCP Streamable HTTP directly on the official @modelcontextprotocol/sdk (WebStandardStreamableHTTPServerTransport)createStatelessMcpHandler() factory in src/lib/mcp/handler/ used by all 4 MCP routesMcpServer + transport — zero in-memory state between requests (Lambda-safe)InitializeRequest replayed on each request to restore client capabilities)elicitation/create on SSE stream, client response POST forwarded via Redis)toolToMCPTool.ts elicitation from BLPOP-based redis_rendezvous to native server.elicitInput() — the handler's Redis bridge makes this transparentElicitTransportError type from redis_rendezvous/errors.ts to permissions/types.tsredis_rendezvous/ directory after staging verificationmcp-handler from package.json after staging verificationscripts/poc_mcp_server.ts) against Upstash Redis (TLS) — verified init, tools/list, tools/call with elicitation, cross-instance forwarding, session expiry + 404 auto-reconnectclaude mcp add --transport http) and verified both elicitation tools (calculator confirmation, greet name prompt) work end-to-endscripts/poc_mcp_elicitation.ts — 3 tests pass: baseline single-instance, cross-instance broken without bridge, cross-instance working with Redis bridgetsc --noEmit passes with zero errors🤖 Generated with Claude Code
Based on git blame analysis of 16 file(s):
| Contributor | Contribution | Files |
|---|---|---|
| Abir Taheer | 64% | 16 |
| Utkarsh Dixit | 10% | 5 |
| Zen Agent | 9% | 7 |
| Himanshu Dixit | 8% | 5 |
| Rahul Tarak | 6% | 2 |
Based on git history, Abir Taheer or Utkarsh Dixit would be good reviewer(s) for this PR.
🤖 Based on git blame with recency weighting (recent edits count more).
:x: Patch coverage is 0.80645% with 615 lines in your changes missing coverage. Please review.
| Flag | Coverage Δ | |
|---|---|---|
| e2e-tests | ? | |
| self-hosted-tests | 5.60% <0.32%> (-0.01%) | :arrow_down: |
| thermos-unit-tests | ? | |
| unit-tests | 58.62% <0.80%> (-0.12%) | :arrow_down: |
Flags with carried forward coverage won't be shown. Click here to find out more.
| Files with missing lines | Coverage Δ | |
|---|---|---|
| apps/apollo/src/lib/mcp/handler/types.ts | 100.00% <100.00%> (ø) | |
| .../src/lib/toolRouterV2/features/permissions/gate.ts | 88.51% <ø> (ø) | |
| ...src/lib/toolRouterV2/features/permissions/types.ts | 100.00% <ø> (ø) | |
| apps/apollo/src/server/context/schema.ts | 100.00% <ø> (ø) | |
| apps/apollo/src/lib/mcp/handler/index.ts | 0.00% <0.00%> (ø) | |
| ...pollo/src/app/tool_router/[sessionId]/mcp/route.ts |
... and 338 files with indirect coverage changes
0.00% <0.00%> (ø) |
| apps/apollo/src/lib/mcp/handler/response_utils.ts | 0.00% <0.00%> (ø) |
| ...s/apollo/src/lib/mcp/handler/request_classifier.ts | 0.00% <0.00%> (ø) |
| apps/apollo/src/lib/mcp/v2/toolToMCPTool.ts | 63.06% <7.69%> (-21.94%) | :arrow_down: |
| ...llo/src/app/v3/mcp/[serverId]/[transport]/route.ts | 0.00% <0.00%> (ø) |
| ... and 5 more |