Send a stored MCP token with the scheme it names - #332
Open
nicklaunches wants to merge 1 commit into
Open
Conversation
Every token stored against a custom MCP server went out as Bearer. A vendor that forwards the Authorization header to an API which only speaks Basic still answers the handshake and the tool listing, so the connector looked connected and its tools were offered, and every real call came back 401. DataForSEO's hosted server behaves exactly that way. A token that already begins with Basic or Bearer is now sent as written; a bare token is still Bearer, so nothing already working changes. The scheme travels with the credential rather than as another setting on the server row, so rotating a token can change how it is presented and nothing else has to know. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WaHWJ1niprhBc5NzJ9pxme
nicklaunches
requested review from
MikeRyanDev,
davidmckayv,
guidovizoso and
tylerslaton
as code owners
September 2, 2026 14:53
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem
Every token stored against a custom MCP server is sent as
Authorization: Bearer <token>, with noway to say otherwise. Some vendors forward that header straight through to an API that only speaks
Basic auth. Those servers still answer
initializeandtools/listto anything, so the Pluginspage reports the connector connected, the tools are listed and offered to Bots, and then every real
tool call comes back 401. DataForSEO's hosted MCP server behaves exactly this way, and the failure
is invisible until somebody reads a tool result.
There was no workaround from the UI: whatever the operator pasted, the header said Bearer.
What changed
authorizationHeader()inserver/src/plugins/mcp.tsdecides the header a stored token becomes.A token that already names its scheme, meaning it starts with
BasicorBearerfollowed by acredential, is sent as written. A bare token is still sent as
Bearer <token>, so every connectorthat works today keeps working and nothing needs re-entering.
The scheme travels with the credential instead of becoming another column on the server row. That
keeps rotation to one field: pasting a new token can change how it is presented and no other part
of the connector has to know.
A scheme word with nothing after it is treated as a bare token, since that is far more likely to be
a credential that happens to read like the word than a header with a missing value.
How it was verified
server/tests/plugin-mcp-authorization.test.tscovers the five cases: a bare token, a tokenalready carrying
Basic, one already carryingBearer, surrounding whitespace, and a schemeword with no credential after it. 5 pass, 0 fail.
bun run typecheckclean across app, server and worker.bunx biome checkclean on the changed files.🤖 Generated with Claude Code