Skip to content

fix(mcp): name the reason on the workflow MCP serve route's malformed-message 400s - #10482

Merged
waleedlatif1 merged 1 commit into
stagingfrom
fix/mcp-serve-400-reason
Nov 28, 2026
Merged

waleedlatif1 merged 1 commit into
stagingfrom
fix/mcp-serve-400-reason

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Follow-up to fix(mcp): name the reason on MCP route 400 log lines #10475. The workflow MCP serve route (/api/mcp/serve/[serverId]) builds its own JSON-RPC 400s for malformed messages instead of going through parseRequest, so they still reached the RouteHandler line with no reason.
  • A new malformedMessageResponse helper records errorCode (the JSON-RPC code) and a fixed errorReason with describeResponseError for each 400: invalid_json, invalid_notification, not_a_request and invalid_request.
  • Response bodies, statuses and headers are unchanged. The request body is never logged.

Type of Change

  • Bug fix

Testing

  • app/api/mcp/serve/[serverId]/route.test.ts: 48 passed. The 2 new cases (unparseable body, JSON-RPC 1.0 envelope) fail against the pre-fix route.
  • biome on the changed files; type-check and audits run in CI

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing (new tests pass the test-audit authoring gate)
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

…-message 400s

The serve route builds its own JSON-RPC 400s for an unparseable body, an invalid notification, a
non-request message and an invalid request, so they reached the route log line with no reason.
Record the JSON-RPC code and a fixed reason for each; response bodies and statuses are unchanged.
@vercel

vercel Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated
docs Skipped Skipped Nov 28, 2026 1:20pm UTC

Request Review

@greptile-apps

greptile-apps Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The PR appears safe to merge.RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge.

Summary

Adds fixed reasons to malformed-message 400 responses from the workflow MCP route.

  • Malformed workflow MCP messages now carry a fixed reason into the route log.

Reviews (1) · Last reviewed commit: "fix(mcp): name the reason on the workflo..." · Reviewed by Greptile

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Turn on auto-fix | Re-trigger cubic

@waleedlatif1
waleedlatif1 merged commit 5a4deba into staging Nov 28, 2026
84 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/mcp-serve-400-reason branch November 28, 2026 13:30

This branch was previously deployed

1 inactive deployment
Preview — 7cc827a3 Deployed Nov 28, 2026 by vercel[bot]
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