Context7 Platform -- Up-to-date docs for AI agents
CTX7-3143: Copilot plugin sends the API key outside Authorization so OAuth can run (#3397)
Enes Gules7d91a883c375
diff --git a/.github/plugin/marketplace.json b/.github/plugin/marketplace.jsonindex 44b8463a..9760fd47 100644--- a/.github/plugin/marketplace.json+++ b/.github/plugin/marketplace.json@@ -12,7 +12,7 @@"name": "context7","source": "./plugins/copilot/context7","description": "Up-to-date documentation lookup. Pull version-specific documentation and code examples directly from source repositories into your coding agent's context.",- "version": "1.0.3"+ "version": "1.0.4"}]}diff --git a/packages/cli/src/__tests__/plugin-manifests.test.ts b/packages/cli/src/__tests__/plugin-manifests.test.tsindex 45986cae..3a1c5a9d 100644--- a/packages/cli/src/__tests__/plugin-manifests.test.ts+++ b/packages/cli/src/__tests__/plugin-manifests.test.ts@@ -84,13 +84,16 @@ describe("plugin MCP manifests", () => {});});- test("Copilot passes the raw API key via Authorization", async () => {+ test("Copilot sends the API key outside Authorization so OAuth can run", async () => {+ // Copilot CLI expands an unset variable to "" and merges static headers+ // over the OAuth bearer token, so a static Authorization header leaves+ // every request after sign-in with an empty credential.const raw = await readFile(join(REPO_ROOT, "plugins/copilot/context7/.mcp.json"), "utf-8");const config = JSON.parse(raw) as {mcpServers: { context7: { headers: Record<string, string> } };};expect(config.mcpServers.context7.headers).toEqual({- Authorization: "${CONTEXT7_API_KEY:-}",+ "Context7-API-Key": "${CONTEXT7_API_KEY:-}",});});diff --git a/plugins/copilot/context7/.mcp.json b/plugins/copilot/context7/.mcp.jsonindex 7fda704c..ef3ac5ab 100644--- a/plugins/copilot/context7/.mcp.json+++ b/plugins/copilot/context7/.mcp.json@@ -4,7 +4,7 @@"type": "http","url": "https://mcp.context7.com/mcp","headers": {- "Authorization": "${CONTEXT7_API_KEY:-}"+ "Context7-API-Key": "${CONTEXT7_API_KEY:-}"}}}diff --git a/plugins/copilot/context7/README.md b/plugins/copilot/context7/README.mdindex 5f8e25fc..ad21362e 100644--- a/plugins/copilot/context7/README.md+++ b/plugins/copilot/context7/README.md@@ -20,16 +20,26 @@ copilot plugin marketplace add upstash/context7copilot plugin install context7@context7-marketplace```-## API Key (Recommended)+## Authentication-Use an API key so the hosted Context7 server can identify you and apply your plan's limits. Create a free API key in the [Context7 dashboard](https://context7.com/dashboard) and export it as an environment variable before launching Copilot CLI:+Authenticate so the hosted Context7 server can identify you and apply your plan's limits. Use one of these methods:++### OAuth++Start an interactive Copilot CLI session. When Context7 asks you to sign in, Copilot CLI opens your browser. Sign in there and return to the terminal.++Non-interactive runs (`copilot -p`) do not open the browser. Sign in from an interactive session first, or use an API key.++### API Key++Create a free API key in the [Context7 dashboard](https://context7.com/dashboard) and export it as an environment variable before launching Copilot CLI:```bash# e.g. in ~/.zshrc or ~/.bashrcexport CONTEXT7_API_KEY="your-api-key"```-The plugin's MCP server configuration picks up `CONTEXT7_API_KEY` automatically. Restart Copilot CLI after setting it, then verify the key is being used by checking your usage in the [dashboard](https://context7.com/dashboard).+Restart Copilot CLI after setting it, then verify the key is being used by checking your usage in the [dashboard](https://context7.com/dashboard).## Available Toolsdiff --git a/plugins/copilot/context7/plugin.json b/plugins/copilot/context7/plugin.jsonindex 1ccadf45..2a78ede6 100644--- a/plugins/copilot/context7/plugin.json+++ b/plugins/copilot/context7/plugin.json@@ -1,7 +1,7 @@{"name": "context7","description": "Upstash Context7 MCP server for up-to-date documentation lookup. Pull version-specific documentation and code examples directly from source repositories into your coding agent's context.",- "version": "1.0.3",+ "version": "1.0.4","author": {"name": "Upstash"},