Skip to content

Surface 4xx JSON refusals from MCP tools/call as typed failures - #2016

Merged
RhysSullivan merged 1 commit into
mainfrom
mcp-http-refusal
Sep 16, 2026
Merged

RhysSullivan merged 1 commit into
mainfrom
mcp-http-refusal

Conversation

@RhysSullivan

Copy link
Copy Markdown
Collaborator

Second half of the customer report behind #2012. With an OAuth Stripe MCP connection, a stripe_analytics or stripe_implementation_planner call without stripe_context is refused by Stripe with an HTTP 422 whose JSON body names the missing field. Executor treated any non-auth HTTP status on tools/call as a transport defect and scrubbed it to Internal tool error [id], so the model read a fixable argument error as an integration outage.

  • A 4xx other than 401/403 whose body is a JSON object with a message / error / error.message string now returns a typed mcp_tool_error result carrying that message and status.
  • Extraction is structural: the body is parsed and decoded for a message field. A free-text or HTML body contributes nothing and the call stays on the opaque path, so the transport error text still cannot leak.
  • 401/403 keep their auth classification. 5xx stays opaque.

Verified with the MCP plugin unit tests (new: 422 JSON refusal surfaces; 422 text body stays opaque), typecheck, and lint. Reproduced the original failure on a live OAuth Stripe connection before the change; will confirm after deploy.

🤖 Generated with Claude Code

Stripe's OAuth MCP server validates the account context at the HTTP
layer: a call without stripe_context gets a 422 whose JSON body names
the missing field. That reached the sandbox as an opaque
"Internal tool error [id]" because a non-auth HTTP status was treated
as a transport defect. Read a string message out of a 4xx JSON body
(structurally; never the raw text) and answer with mcp_tool_error so
the caller can fix the arguments. 401/403 keep their auth
classification; 5xx and bodyless 4xx stay opaque.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 16, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
executor-marketing e1305a0 Commit Preview URL

Branch Preview URL
Sep 16 2026, 12:33 AM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 16, 2026

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
executor-cloud e1305a0 Sep 16 2026, 12:35 AM

@github-actions

github-actions Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Cloudflare preview

Torn down — the PR is closed.

@pkg-pr-new

pkg-pr-new Bot commented Sep 16, 2026

Copy link
Copy Markdown

Open in StackBlitz

@executor-js/cli

npm i https://pkg.pr.new/@executor-js/cli@2016

@executor-js/config

npm i https://pkg.pr.new/@executor-js/config@2016

@executor-js/execution

npm i https://pkg.pr.new/@executor-js/execution@2016

@executor-js/sdk

npm i https://pkg.pr.new/@executor-js/sdk@2016

@executor-js/codemode-core

npm i https://pkg.pr.new/@executor-js/codemode-core@2016

@executor-js/runtime-quickjs

npm i https://pkg.pr.new/@executor-js/runtime-quickjs@2016

@executor-js/plugin-file-secrets

npm i https://pkg.pr.new/@executor-js/plugin-file-secrets@2016

@executor-js/plugin-graphql

npm i https://pkg.pr.new/@executor-js/plugin-graphql@2016

@executor-js/plugin-keychain

npm i https://pkg.pr.new/@executor-js/plugin-keychain@2016

@executor-js/plugin-mcp

npm i https://pkg.pr.new/@executor-js/plugin-mcp@2016

@executor-js/plugin-onepassword

npm i https://pkg.pr.new/@executor-js/plugin-onepassword@2016

@executor-js/plugin-openapi

npm i https://pkg.pr.new/@executor-js/plugin-openapi@2016

executor

npm i https://pkg.pr.new/executor@2016

commit: e1305a0

@RhysSullivan
RhysSullivan merged commit 84620aa into main Sep 16, 2026
79 of 80 checks passed
@RhysSullivan
RhysSullivan deleted the mcp-http-refusal branch September 16, 2026 00:41
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