Repository navigation
Conversation
enesgules
force-pushed
the
CTX7-3143/copilot-plugin-api-key-header
branch
from
October 16, 2026 13:05
9adcbf1 to
af213a9
Compare
This branch has not been deployed
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.
Summary
Replaces #3233 with a smaller fix that keeps both sign-in paths.
Context7-API-Key: ${CONTEXT7_API_KEY:-}instead ofAuthorization: ${CONTEXT7_API_KEY:-}.CONTEXT7_API_KEYkeep working with no change on their side.plugin.jsonand the marketplace manifest). README has one "Authentication" section with both methods.Why not #3233 as it was
#3233 removed the header, so API-key users would have to configure Context7 as a manual MCP server. Its premise was also only half right. Tested with Copilot CLI 1.0.61 against a local mock that answers with the same 401 challenge as our server:
CONTEXT7_API_KEYAuthorizationAuthorization: ${CONTEXT7_API_KEY:-}(master)""""→ "Failed to connect"Bearer <token>→ connectedContext7-API-Key: ${CONTEXT7_API_KEY:-}(this PR)Bearer <token>→ connectedContext7-API-KeySo Copilot CLI does start OAuth after the 401, but it merges static headers over the OAuth token, and the empty
Authorizationwins. Moving the key to its own header removes the collision. Copilot CLI has no conditional-header syntax (only$VAR,${VAR},${VAR:-default}).The hosted server already reads
Context7-API-Keyand ignores an empty value (packages/mcp/src/index.ts,extractApiKey). Checked on production: an empty header is treated as no key, and a dummy key in that header returns "Invalid API key".This matters before
/mcpmoves fromobservetorequired: on master, a Copilot plugin user without a key cannot connect at all once auth is required.Notes for reviewers
CONTEXT7_API_KEYfor the last two rows; the header was then renamed to the hyphen form the server lists in its allowed headers. Both names are read by the sameextractApiKeyand both were checked on production.requiredmode, installation from the marketplace (the test used--plugin-dir), other Copilot CLI versions.plugin-manifests.test.tsasserts the new header. 342 CLI tests pass.Closes CTX7-3143