Skip to content

fix(mcp): answer workflow MCP JSON-RPC errors over HTTP 200 instead of session-loss statuses - #9561

Merged
waleedlatif1 merged 2 commits into
stagingfrom
fix/mcp-serve-method-not-found
Nov 2, 2026
Merged

waleedlatif1 merged 2 commits into
stagingfrom
fix/mcp-serve-method-not-found

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Workflow MCP servers answered some JSON-RPC errors to well-formed requests with HTTP 404 (unknown method, unknown tool) or 400 (invalid tools/call params, undeployed workflow, and workflow-service 400/404 failures passed through). In Streamable HTTP those statuses mean a lost or bad session: the MCP SDK client turns any non-2xx into a StreamableHTTPError and drops the JSON-RPC body, and Sim's own MCP client treats 400/404 as a dead session, retires the pooled connection, and retries a call that can never succeed
  • New jsonRpcErrorResponse decides the status for every request-scoped JSON-RPC error in one place: 400/401/404 go out at 200 (as the SDK's reference server sends protocol errors); 408/409/413/429/499/500/503 keep their retry, limit, and alarm meaning. data.httpStatus still records the workflow service's status
  • Malformed messages (parse error, invalid JSON-RPC envelope) keep their 400, matching the SDK server
  • Clients that accept text/event-stream already received every tools/call error at 200 inside the stream; this makes the JSON path agree
  • Removes an unreachable Tool name required branch (the params schema already requires a non-empty name)

Type of Change

  • Bug fix

Testing

  • route.test.ts: drives the route with the real SDK Client + StreamableHTTPClientTransport (MethodNotFound now arrives as McpError), plus a table over the JSON path for invalid params, unknown tool, undeployed workflow, and workflow-service 404/400 failures
  • All 6 new cases fail against the current staging route; the 39 existing cases (which pin the 408/409/413/429/499/403 statuses) pass both before and after — 45/45 green
  • bun run lint, check:test-patterns, check:comment-hygiene, check:source-conventions, check:explicit-any; full type-check and audits left to 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)

@vercel

vercel Bot commented Nov 2, 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 2, 2026 7:52am UTC

Request Review

@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

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cubic-dev-ai review this PR

@cubic-dev-ai

cubic-dev-ai Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

@cubic-dev-ai review this PR

@waleedlatif1 I have started the AI code review. It will take a few minutes to complete.

@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

Copy link
Copy Markdown
Collaborator Author

@greptile review

@greptile-apps

greptile-apps Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; no actionable issues were found.

Summary

Workflow MCP requests now receive JSON-RPC errors over HTTP 200 instead of misleading HTTP 400/401/404 responses.

  • Workflow MCP clients can read well-formed request errors as JSON-RPC replies.

Reviews (1) · Last reviewed commit: "fix(mcp): build the routed test request ..." · Reviewed by Greptile

@waleedlatif1
waleedlatif1 merged commit e3ce679 into staging Nov 2, 2026
135 of 137 checks passed
@waleedlatif1
waleedlatif1 deleted the fix/mcp-serve-method-not-found branch November 2, 2026 17:45

This branch was previously deployed

1 inactive deployment
Preview — e6853688 Deployed Nov 2, 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