Skip to content

MCP probe: handle real-world 401 shapes + live snapshot tests#736

Merged
RhysSullivan merged 4 commits intomainfrom
mcp-probe-followup
May 9, 2026
Merged

MCP probe: handle real-world 401 shapes + live snapshot tests#736
RhysSullivan merged 4 commits intomainfrom
mcp-probe-followup

Conversation

@RhysSullivan
Copy link
Copy Markdown
Owner

Summary

  • Accept resource_metadata= in WWW-Authenticate as a sufficient MCP+auth signal on 401, so spec-compliant OAuth-protected servers (Sentry, Stripe, Linear, Notion, Context7) are no longer rejected when their 401 body is RFC 6750 OAuth-shape rather than JSON-RPC.
  • Accept RFC 6750 OAuth Bearer error envelopes ({error:"invalid_token",...}) on 401 + bare Bearer for servers that omit resource_metadata= (Atlassian). GraphQL-style {errors:[...]} 401s still reject so non-MCP OAuth-protected APIs aren't misclassified.
  • Add an opt-in live snapshot suite (MCP_PROBE_LIVE=1) that POSTs the canonical MCP initialize to 11 real public MCP servers (Sentry, Stripe, Linear, Notion, Atlassian, Zapier, Cubic, ref.tools, Hugging Face, DeepWiki, Context7), captures status/headers/body alongside the probe classification, and pins them as vitest snapshots so behavior shifts surface as reviewable diffs (-u regenerates).

Test plan

  • bun run test — full suite passes with the live file skipped by default
  • bun run lint and bun run typecheck clean
  • MCP_PROBE_LIVE=1 vitest run packages/plugins/mcp/src/sdk/probe-shape-real-servers.live.test.ts — all 11 live snapshots match
  • Pasting https://mcp.sentry.dev/mcp/ into Add MCP Source still triggers the OAuth popup
  • Pasting https://mcp.atlassian.com/v1/sse triggers the OAuth popup
  • Pasting https://www.cubic.dev/api/mcp (API-key MCP) is detected and surfaces as MCP+auth so user can paste credentials

The body-shape gate rejected sentry.dev's 401 because its body is a
spec-compliant RFC 6750 OAuth error envelope (`{error:"invalid_token",
...}`), not JSON-RPC. Sentry advertises full RFC 9728/8414 metadata via
the `resource_metadata=` attribute of WWW-Authenticate, which is the
MCP authorization spec's mandated signal.

Accept `resource_metadata=` as sufficient for MCP+auth on 401, falling
back to the JSON-RPC body check only for bare Bearer challenges (the
cubic.dev / static-API-key path). Railway-style OAuth-protected
non-MCP endpoints still get rejected because they don't include
`resource_metadata=` and don't return JSON-RPC bodies.
Add an opt-in test that fires the canonical MCP `initialize` POST at
each of 11 real public MCP servers (Sentry, Stripe, Linear, Notion,
Atlassian, Zapier, Cubic, ref.tools, Hugging Face, DeepWiki, Context7),
captures the raw status / WWW-Authenticate / content-type / body
snippet alongside the resulting probe classification, and pins them as
vitest snapshots. Default test runs stay offline; opt in via
`MCP_PROBE_LIVE=1`. When a real server's behavior shifts the snapshot
diff makes the change reviewable, and `vitest -u` regenerates.

While running the live suite Atlassian failed: it omits
`resource_metadata=` from its WWW-Authenticate and returns an RFC 6750
Bearer error envelope (`{error:"invalid_token", ...}`) rather than
JSON-RPC. Add an OAuth-error-body accept path to probe-shape so 401 +
bare Bearer + RFC 6750 envelope classifies as MCP+auth, while the
GraphQL `{errors:[...]}` shape that motivated the body gate still
rejects.
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 9, 2026

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 fcffb2c Commit Preview URL

Branch Preview URL
May 09 2026, 08:28 AM

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented May 9, 2026

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 fcffb2c May 09 2026, 08:28 AM

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 9, 2026

Open in StackBlitz

@executor-js/cli

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

@executor-js/config

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

@executor-js/execution

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

@executor-js/sdk

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

@executor-js/storage-core

npm i https://pkg.pr.new/@executor-js/storage-core@736

@executor-js/codemode-core

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

@executor-js/runtime-quickjs

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

@executor-js/plugin-file-secrets

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

@executor-js/plugin-google-discovery

npm i https://pkg.pr.new/@executor-js/plugin-google-discovery@736

@executor-js/plugin-graphql

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

@executor-js/plugin-keychain

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

@executor-js/plugin-mcp

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

@executor-js/plugin-onepassword

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

@executor-js/plugin-openapi

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

executor

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

commit: fcffb2c

Expand the live-fetch snapshot file from 11 to 29 servers, adding
Asana, Canva, Cloudflare bindings/observability/radar, Figma, GitHub
Copilot, Intercom, Neon, Netlify, PayPal, Replicate, Square, Supabase,
Tavily, Vercel, Webflow, Wix.

Several of those (Supabase, GitHub Copilot, Vercel, Neon, Tavily,
Replicate) carry RFC 6750 §3.1 `error=` / `error_description=`
auth-params on their Bearer challenge but no `resource_metadata=`, and
their bodies aren't always RFC 6750 either (Supabase returns
`{"message":"Unauthorized"}`). Add `error=` in the Bearer challenge
as another accept signal so wire-shape detection classifies them as
mcp+auth without needing the URL-token fallback.
…s coverage

The wire-shape probe (`probeMcpEndpointShape`) only tells us "this is an
MCP server" / "auth required". The UI flow in `AddMcpSource` then keys
off `probeEndpoint`'s `requiresOAuth` and `supportsDynamicRegistration`
to decide whether to show the OAuth popup. Capture those in the live
snapshot too so a regression that breaks OAuth detection (vs.
falling through to the credentials editor) shows up as a snapshot
diff. The 24 OAuth servers now lock in `requiresOAuth: true` /
`supportsDynamicRegistration: true` (GitHub Copilot is the lone DCR
holdout); the API-key MCPs (Cubic, ref.tools) lock in the
auth-required error message; the public MCPs (Hugging Face, DeepWiki,
Context7) lock in `connected: true, requiresOAuth: false` with a tool
count.
@RhysSullivan RhysSullivan merged commit d021499 into main May 9, 2026
10 checks passed
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