Skip to content

Support authenticated remote MCP servers with custom request headers - #1821

Merged
RhysSullivan merged 2 commits into
mainfrom
issue-1764
Aug 28, 2026
Merged

Support authenticated remote MCP servers with custom request headers#1821
RhysSullivan merged 2 commits into
mainfrom
issue-1764

Conversation

@RhysSullivan

@RhysSullivan RhysSullivan commented Aug 28, 2026

Copy link
Copy Markdown
Collaborator

Fixes #1764

Adding a remote MCP server behind an edge authenticator failed with "Couldn't reach this URL", and there was no way to supply the credentials it wanted.

Two changes:

  • The add-MCP form now has an optional request headers editor. The name/value pairs go through the headers field that the payload, config, live transport, and probe already carried, so they are sent on the connection check and on every later request. A "Test connection" action re-probes with the headers as typed.
  • A 403 is now classified exactly as a 401 is. Cloudflare Access and similar gates answer an unauthenticated request with 403 and an HTML sign-in page, so the MCP server is never reached and there is no Bearer challenge to read. That is "needs credentials", not "unreachable", and the flow now continues to the auth step.

Not covered here: header values are stored as static, non-credential config, the same as the query params beside them. Secret-backed header references are a larger change and are left out.

Tests:

  • probe-shape unit tests for the Cloudflare Access 403 shape, a 403 + Bearer + JSON-RPC body, a 403 + Bearer + GraphQL body, and a probe that clears the gate once headers are configured.
  • request-headers unit tests for the row to wire-map conversion.
  • New selfhost e2e scenario mcp-request-headers-add. It fails on main with the exact dead-end symptom, and passes here.

The add-MCP form had no way to supply request headers, so an endpoint
behind an edge authenticator could not be added at all. It now carries a
name/value headers editor whose values ride along on the connection check
and on every later request, through the existing config field.

A 403 from such a gate also no longer reads as an unreachable server. It
classifies exactly as a 401 does, so the flow continues to the auth step
instead of stopping on "Couldn't reach this URL".
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 28, 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 ed2ec34 Commit Preview URL

Branch Preview URL
Aug 28 2026, 09:51 AM

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 28, 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 ed2ec34 Aug 28 2026, 09:52 AM

The request headers editor imports lucide icons, but the package never
declared the dependency. It only resolved locally because a node_modules
directory above the checkout carried it; CI has no such ancestor and the
typecheck failed to resolve the module.

Declare it the way the openapi plugin already does.
@github-actions

github-actions Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Cloudflare preview

Torn down — the PR is closed.

@pkg-pr-new

pkg-pr-new Bot commented Aug 28, 2026

Copy link
Copy Markdown

Open in StackBlitz

@executor-js/cli

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

@executor-js/config

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

@executor-js/execution

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

@executor-js/sdk

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

@executor-js/codemode-core

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

@executor-js/runtime-quickjs

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

@executor-js/plugin-file-secrets

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

@executor-js/plugin-graphql

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

@executor-js/plugin-keychain

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

@executor-js/plugin-mcp

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

@executor-js/plugin-onepassword

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

@executor-js/plugin-openapi

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

executor

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

commit: ed2ec34

@RhysSullivan
RhysSullivan marked this pull request as ready for review August 28, 2026 18:28
@RhysSullivan
RhysSullivan merged commit 435c0f2 into main Aug 28, 2026
79 of 80 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.

Support authenticated remote MCP servers with custom request headers

1 participant