Skip to content

fix(mcp): serve streamable HTTP GET#50

Merged
JustAGhosT merged 1 commit into
mainfrom
fix/mcp-get-stream
Jun 8, 2026
Merged

fix(mcp): serve streamable HTTP GET#50
JustAGhosT merged 1 commit into
mainfrom
fix/mcp-get-stream

Conversation

@JustAGhosT

@JustAGhosT JustAGhosT commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Route GET /mcp through the existing bearer-protected MCP handler.
  • Preserve current POST /mcp behavior while allowing Claude Code to open the streamable HTTP SSE channel.

Verification

  • pnpm --dir backend typecheck
  • pnpm --dir backend test
  • pnpm --dir backend build
  • Local smoke: GET /mcp with bearer + Accept: text/event-stream returns 200 text/event-stream.

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced error handling for request processing with improved logging and appropriate error responses.

@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e7e272fe-432c-4ecb-b0c2-2eb900989629

📥 Commits

Reviewing files that changed from the base of the PR and between 1ce82da and 4dd2ce8.

📒 Files selected for processing (1)
  • backend/src/mcp/server.ts

📝 Walkthrough

Walkthrough

Refactored MCP HTTP handling by extracting request-processing logic into a shared handleMcpHttpRequest helper function and wiring both POST / and GET / routes to call it, with the helper receiving req.body for POST requests and undefined for GET requests.

Changes

MCP HTTP Request Handler Extraction

Layer / File(s) Summary
HTTP request handler extraction and routing
backend/src/mcp/server.ts
New handleMcpHttpRequest helper function encapsulates transport creation, server connection, and request delegation; both POST / and GET / routes call this helper with body data passed conditionally, and error handling logs unhandled errors and returns 500 JSON only if headers have not been sent.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • phoenixvc/baton#48: Both PRs adjust MCP HTTP handling around StreamableHTTPServerTransport; this PR routes GET/POST / through the transport handler while the related PR updates orgClient to send matching Accept headers that the transport expects.

Poem

🐰 A helper born from duplication's sting,
Routes now dance to the same shared thing,
POST and GET in harmony agree,
One transport handler, clean and spry! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately and concisely describes the main change: fixing the MCP server to serve streamable HTTP GET requests, which directly matches the refactoring that enables GET /mcp routing through the bearer-protected handler.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/mcp-get-stream

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@JustAGhosT JustAGhosT merged commit 137c0bd into main Jun 8, 2026
3 checks passed
@JustAGhosT JustAGhosT deleted the fix/mcp-get-stream branch June 8, 2026 13:53
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.

1 participant