Context7 Platform -- Up-to-date docs for AI agents
fix(claude-plugin): match the official plugin and drop the API key header (#3252)
Fahreddin Özcand812afe2f85a
diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.jsonindex 4b7f7ed0..536e5b4e 100644--- a/.claude-plugin/marketplace.json+++ b/.claude-plugin/marketplace.json@@ -9,7 +9,7 @@"name": "context7","source": "./plugins/claude/context7","description": "Up-to-date documentation lookup. Pull version-specific documentation and code examples directly from source repositories into your LLM context.",- "version": "1.0.3"+ "version": "1.0.4"}]}diff --git a/docs/clients/claude-code.mdx b/docs/clients/claude-code.mdxindex 277b9986..32b9b403 100644--- a/docs/clients/claude-code.mdx+++ b/docs/clients/claude-code.mdx@@ -3,7 +3,7 @@ title: Claude Codedescription: Using Context7 with Claude Code----Context7 integrates with Claude Code to provide current library documentation instead of relying on training data. Claude Code supports skills, agents, and commands that make documentation lookups more powerful.+Context7 integrates with Claude Code to provide current library documentation instead of relying on training data. Set it up with `ctx7 setup`, or install the Context7 plugin.## Installation@@ -36,30 +36,11 @@ use context7 with /supabase/supabase for authentication docsuse context7 with /vercel/next.js for app router setup```-<Tip>-With the [Context7 plugin](#the-context7-plugin) installed, you get additional agents and commands on top of the skill.-</Tip>----## The Context7 Plugin-The full Context7 plugin for Claude Code includes more than just the MCP server:--<CardGroup cols={2}>-<Card title="MCP Server" icon="server">-The tools for fetching documentation (`resolve-library-id`, `query-docs`)-</Card>-<Card title="Skills" icon="sparkles">-Auto-triggers documentation lookups when you ask about libraries-</Card>-<Card title="Agents" icon="robot">-A `docs-researcher` agent for focused lookups that keep context lean-</Card>-<Card title="Commands" icon="terminal">-`/context7:docs` for manual documentation queries-</Card>-</CardGroup>+The Context7 plugin connects Claude Code to the hosted Context7 MCP server (`https://mcp.context7.com/mcp`). It adds the `resolve-library-id` and `query-docs` tools, with no local Node.js, npm, or npx required.### Installing the Plugin@@ -70,109 +51,10 @@ The plugin is available from the Context7 marketplace. Run these commands in Cla/plugin install context7@context7-marketplace```-This adds the Context7 marketplace and installs the plugin with skills, agents, and commands.--### Using Your API Key with the Plugin--Without an API key, the plugin connects anonymously and shares the anonymous rate limits. To use your own plan, create an API key in the [Context7 dashboard](https://context7.com/dashboard) and export it as an environment variable before launching Claude Code:+### Signing In-```bash-# e.g. in ~/.zshrc or ~/.bashrc-export CONTEXT7_API_KEY="your-api-key"-```--The plugin reads `CONTEXT7_API_KEY` from your environment automatically. Restart Claude Code after setting it, then confirm requests are counted against your plan in the [dashboard](https://context7.com/dashboard).+After installing the plugin, restart Claude Code and run `/mcp`. Select Context7 and follow the browser sign-in flow. No API key is required.<Note>-If the variable is not set, the plugin still works — requests just go through the anonymous tier, which has lower rate limits.+The plugin does not read `CONTEXT7_API_KEY`. To use an API key, for example on a headless, SSH, or CI host, run `npx ctx7 setup --claude` or add the MCP server manually as described in [All MCP Clients](/resources/all-clients).</Note>--### Skills--#### Documentation Lookup Skill--This skill triggers automatically when you ask about libraries, frameworks, or need code examples. You don't need to type "use context7" — the skill recognizes when documentation would help.--<AccordionGroup>-<Accordion title="What triggers the skill">-- Setup questions: "How do I configure Next.js middleware?"-- Code generation: "Write a Prisma query for user relations"-- API references: "What are the Supabase auth methods?"-- Framework mentions: React, Vue, Svelte, Express, Tailwind, etc.-</Accordion>-<Accordion title="How it works">-1. **Resolve**: Finds the library ID using `resolve-library-id` with your question as context-2. **Select**: Picks the best match based on name accuracy and quality scores-3. **Fetch**: Calls `query-docs` with the library ID and your specific question-4. **Return**: Provides code examples and explanations from current documentation-</Accordion>-</AccordionGroup>--### Agents--#### docs-researcher Agent--When you're in the middle of a long task and don't want documentation tool calls cluttering your context, spawn the `docs-researcher` agent. It runs in a separate context and returns just the answer.--<Tabs>-<Tab title="When to Use" icon="question">-- You need docs but want to keep your main context clean-- You're working on something complex and context is getting long-- You want a focused answer without side effects-</Tab>-<Tab title="Examples" icon="code">-```-spawn docs-researcher to look up React hooks documentation-spawn docs-researcher: how do I set up Prisma with PostgreSQL?-spawn docs-researcher to find Tailwind CSS grid utilities-```-</Tab>-</Tabs>--The agent uses the same tools (`resolve-library-id` and `query-docs`) but runs on a lighter model (Sonnet) to keep things fast.--#### When to Use Agents vs Inline Tools--| Scenario | Use |-|----------|-----|-| Deep into a task with long context | Agent |-| Want to avoid context bloat | Agent |-| Context is short | Inline tools |-| Want docs visible in conversation | Inline tools |--### Commands--#### /context7:docs--Manual command for documentation lookups.--**Format:**-```-/context7:docs <library> [query]-```--**Examples:**--<Tabs>-<Tab title="Basic" icon="search">-```-/context7:docs react hooks-/context7:docs next.js authentication-/context7:docs prisma relations-```-</Tab>-<Tab title="With Library ID" icon="link">-```-/context7:docs /vercel/next.js app router-/context7:docs /supabase/supabase row level security-```--Using a library ID directly skips the resolution step.-</Tab>-</Tabs>--**When to use:**-- You know exactly which library and topic you need-- You want a quick lookup without explaining your full context-- You're testing what documentation is available-diff --git a/packages/cli/src/__tests__/plugin-manifests.test.ts b/packages/cli/src/__tests__/plugin-manifests.test.tsindex 7e323e96..cdbeb15f 100644--- a/packages/cli/src/__tests__/plugin-manifests.test.ts+++ b/packages/cli/src/__tests__/plugin-manifests.test.ts@@ -1,34 +1,20 @@import { describe, test, expect } from "vitest";import { readFile } from "fs/promises";import { join } from "path";-import { execFile } from "child_process";-import { promisify } from "util";const REPO_ROOT = join(import.meta.dirname, "..", "..", "..", "..");-const execFileAsync = promisify(execFile);describe("plugin MCP manifests", () => {- test("Claude uses an API key only when one is set", async () => {+ test("Claude sends no Authorization header so OAuth can run", async () => {const relPath = "plugins/claude/context7/.mcp.json";const raw = await readFile(join(REPO_ROOT, relPath), "utf-8");const config = JSON.parse(raw) as {- mcpServers: { context7: { headers?: Record<string, string>; headersHelper: string } };+ mcpServers: { context7: Record<string, unknown> };};- expect(config.mcpServers.context7.headers).toBeUndefined();- expect(config.mcpServers.context7.headersHelper).toBe(- 'node "${CLAUDE_PLUGIN_ROOT}/scripts/headers.mjs"'- );-- const helper = join(REPO_ROOT, "plugins/claude/context7/scripts/headers.mjs");- const withoutKey = await execFileAsync(process.execPath, [helper], {- env: { ...process.env, CONTEXT7_API_KEY: "" },- });- expect(JSON.parse(withoutKey.stdout)).toEqual({});-- const withKey = await execFileAsync(process.execPath, [helper], {- env: { ...process.env, CONTEXT7_API_KEY: "ctx7sk-test" },+ expect(config.mcpServers.context7).toEqual({+ type: "http",+ url: "https://mcp.context7.com/mcp?client=claude-code-plugin",});- expect(JSON.parse(withKey.stdout)).toEqual({ Authorization: "ctx7sk-test" });});test("Copilot passes the raw API key via Authorization", async () => {diff --git a/plugins/claude/context7/.claude-plugin/plugin.json b/plugins/claude/context7/.claude-plugin/plugin.jsonindex 873f1802..ca7c988c 100644--- a/plugins/claude/context7/.claude-plugin/plugin.json+++ b/plugins/claude/context7/.claude-plugin/plugin.json@@ -1,8 +1,14 @@{"name": "context7",- "version": "1.0.3",+ "version": "1.0.4","description": "Upstash Context7 MCP server for up-to-date documentation lookup. Pull version-specific documentation and code examples directly from source repositories into your LLM context.","author": {- "name": "Upstash"- }+ "name": "Upstash",+ "email": "[email protected]",+ "url": "https://upstash.com"+ },+ "homepage": "https://context7.com",+ "repository": "https://github.com/upstash/context7",+ "license": "MIT",+ "keywords": ["documentation", "context", "mcp", "library-docs"]}diff --git a/plugins/claude/context7/.mcp.json b/plugins/claude/context7/.mcp.jsonindex 41153c88..30c7cd96 100644--- a/plugins/claude/context7/.mcp.json+++ b/plugins/claude/context7/.mcp.json@@ -2,8 +2,7 @@"mcpServers": {"context7": {"type": "http",- "url": "https://mcp.context7.com/mcp?client=claude-code-plugin",- "headersHelper": "node \"${CLAUDE_PLUGIN_ROOT}/scripts/headers.mjs\""+ "url": "https://mcp.context7.com/mcp?client=claude-code-plugin"}}}diff --git a/plugins/claude/context7/README.md b/plugins/claude/context7/README.mdindex 14044442..2d81ba2a 100644--- a/plugins/claude/context7/README.md+++ b/plugins/claude/context7/README.md@@ -4,12 +4,7 @@ Context7 solves a common problem with AI coding assistants: outdated training da## What's Included-This plugin provides:--- **MCP Server** - Connects Claude Code to Context7's documentation service-- **Skills** - Auto-triggers documentation lookups when you ask about libraries-- **Agents** - A dedicated `docs-researcher` agent for focused lookups-- **Commands** - `/context7:docs` for manual documentation queries+This plugin connects Claude Code to Context7's hosted MCP server (`https://mcp.context7.com/mcp`), with no local Node.js, npm, or npx required.## Installation@@ -30,7 +25,11 @@ After installing the plugin, restart Claude Code and run:Select Context7 and follow the browser sign-in flow. No API key is required.-To use an API key instead, set `CONTEXT7_API_KEY` before starting Claude Code. The plugin sends the key only when it is present; otherwise it uses OAuth.+The plugin does not read `CONTEXT7_API_KEY`. To use an API key, for example on a headless, SSH, or CI host, run `npx ctx7 setup --claude` or add the MCP server manually as described in [All MCP Clients](https://context7.com/docs/resources/all-clients).++## Data and Privacy++The plugin sends only the tool-call parameters that the model writes, such as the library name and the question, to the Context7 MCP server, together with your Context7 OAuth token. The plugin does not run local commands or hooks. See the [Context7 privacy policy](https://context7.com/privacy) for how Context7 handles this data.## Available Tools@@ -60,19 +59,6 @@ The plugin works automatically when you ask about libraries:- "Show me React Server Components examples"- "What's the Prisma syntax for relations?"-For manual lookups, use the command:--```-/context7:docs next.js app router-/context7:docs /vercel/next.js/v15.1.8 middleware-```--Or spawn the docs-researcher agent when you want to keep your main context clean:--```-spawn docs-researcher to look up Supabase auth methods-```-## Version PinningTo get documentation for a specific version, include the version in the library ID:diff --git a/plugins/claude/context7/agents/docs-researcher.md b/plugins/claude/context7/agents/docs-researcher.mddeleted file mode 100644index 9653aa7e..00000000--- a/plugins/claude/context7/agents/docs-researcher.md+++ /dev/null@@ -1,41 +0,0 @@-----name: docs-researcher-description: Lightweight agent for fetching library documentation without cluttering your main conversation context.-model: sonnet------You are a documentation researcher specializing in fetching up-to-date library and framework documentation from Context7.--## Your Task--When given a question about a library or framework, fetch the relevant documentation and return a concise, actionable answer with code examples.--## Process--1. **Identify the library**: Extract the library/framework name from the user's question.--2. **Resolve the library ID**: Call `resolve-library-id` with:- - `libraryName`: The library name (e.g., "react", "next.js", "prisma")- - `query`: What to look up in the library's documentation for relevance ranking--3. **Select the best match**: From the results, pick the library with:- - Exact or closest name match- - Highest benchmark score- - Appropriate version if the user specified one (e.g., "React 19" → look for v19.x)--4. **Fetch documentation**: Call `query-docs` with:- - `libraryId`: The selected Context7 library ID (e.g., `/vercel/next.js`)- - `query`: What to look up in the library's documentation for targeted results, scoped to a single concept--5. **Return a focused answer**: Summarize the relevant documentation with:- - Direct answer to the question- - Code examples from the docs- - Links or references if available--## Guidelines--- Describe what to look up in the library's documentation in the query parameter, but keep each query to a single concept-- If the question spans multiple distinct concepts (e.g. routing and auth and caching), make a separate `query-docs` call per concept with the same library ID, unless the question is about how the concepts interact — combined queries dilute ranking and return shallow results for each topic-- When the user mentions a version (e.g., "Next.js 15"), use version-specific library IDs if available-- If `resolve-library-id` returns multiple matches, prefer official/primary packages over community forks-- Keep responses concise - the goal is to answer the question, not dump entire documentationdiff --git a/plugins/claude/context7/commands/docs.md b/plugins/claude/context7/commands/docs.mddeleted file mode 100644index 1e6415d1..00000000--- a/plugins/claude/context7/commands/docs.md+++ /dev/null@@ -1,45 +0,0 @@-----description: Look up documentation for any library-argument-hint: <library> [query]------# /context7:docs--Fetches up-to-date documentation and code examples for a library.--## Usage--```-/context7:docs <library> [query]-```--- **library**: The library name, or a Context7 ID starting with `/`-- **query**: What you're looking for (optional but recommended; run the command once per distinct concept, unless asking how they interact)--## Examples--```-/context7:docs react hooks-/context7:docs next.js authentication-/context7:docs prisma relations-/context7:docs /vercel/next.js/v15.1.8 app router-/context7:docs /supabase/supabase row level security-```--## How It Works--1. If the library starts with `/`, it's used directly as the Context7 ID-2. Otherwise, `resolve-library-id` finds the best matching library-3. `query-docs` fetches documentation relevant to your query-4. Results include code examples and explanations--## Version-Specific Lookups--Include the version in the library ID for pinned documentation:--```-/context7:docs /vercel/next.js/v15.1.8 middleware-/context7:docs /facebook/react/v19.0.0 use hook-```--This is useful when you're working with a specific version and want docs that match exactly.diff --git a/plugins/claude/context7/scripts/headers.mjs b/plugins/claude/context7/scripts/headers.mjsdeleted file mode 100644index 5a51464c..00000000--- a/plugins/claude/context7/scripts/headers.mjs+++ /dev/null@@ -1,3 +0,0 @@-const apiKey = process.env.CONTEXT7_API_KEY;--process.stdout.write(JSON.stringify(apiKey ? { Authorization: apiKey } : {}));diff --git a/plugins/claude/context7/skills/context7-mcp/SKILL.md b/plugins/claude/context7/skills/context7-mcp/SKILL.mddeleted file mode 100644index 90542d4e..00000000--- a/plugins/claude/context7/skills/context7-mcp/SKILL.md+++ /dev/null@@ -1,56 +0,0 @@-----name: context7-mcp-description: This skill should be used when the user asks about libraries, frameworks, API references, or needs code examples. Activates for setup questions, code generation involving libraries, or mentions of specific frameworks like React, Vue, Next.js, Prisma, Supabase, etc.------When the user asks about libraries, frameworks, or needs code examples, use Context7 to fetch current documentation instead of relying on training data.--## When to Use This Skill--Activate this skill when the user:--- Asks setup or configuration questions ("How do I configure Next.js middleware?")-- Requests code involving libraries ("Write a Prisma query for...")-- Needs API references ("What are the Supabase auth methods?")-- Mentions specific frameworks (React, Vue, Svelte, Express, Tailwind, etc.)--## How to Fetch Documentation--### Step 1: Resolve the Library ID--Call `resolve-library-id` with:--- `libraryName`: The library name extracted from the user's question-- `query`: What to look up in the library's documentation (improves relevance ranking)--### Step 2: Select the Best Match--From the resolution results, choose based on:--- Exact or closest name match to what the user asked for-- Higher benchmark scores indicate better documentation quality-- If the user mentioned a version (e.g., "React 19"), prefer version-specific IDs--### Step 3: Fetch the Documentation--Call `query-docs` with:--- `libraryId`: The selected Context7 library ID (e.g., `/vercel/next.js`)-- `query`: What to look up in the library's documentation, scoped to a single concept--If the user's question spans multiple distinct concepts (e.g. routing and auth and caching), make a separate `query-docs` call per concept with the same library ID, unless the question is about how the concepts interact — combined queries dilute ranking and return shallow results for each topic.--### Step 4: Use the Documentation--Incorporate the fetched documentation into your response:--- Answer the user's question using current, accurate information-- Include relevant code examples from the docs-- Cite the library version when relevant--## Guidelines--- **Be specific**: Describe what to look up in the library's documentation, but keep each query to a single concept-- **One topic per query**: Split multi-topic questions into separate `query-docs` calls — resolve the library ID once, then query per concept, unless the question is about how the concepts interact-- **Version awareness**: When users mention versions ("Next.js 15", "React 19"), use version-specific library IDs if available from the resolution step-- **Prefer official sources**: When multiple matches exist, prefer official/primary packages over community forks