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.
Installation#
Run the setup command to configure Context7 for Claude Code:
This flow authenticates via OAuth, generates an API key, and installs the appropriate skill. You can choose between CLI or MCP mode. Login uses the OAuth device flow — it shows a verification link and short code you open on any device, so it works the same locally or on a remote, headless, or SSH host.
Create or manage API keys in the Context7 dashboard. For manual MCP installation or other configuration options, see All MCP Clients.
Using Context7#
With ctx7 setup, a skill is installed that triggers automatically when you ask about libraries — no need to say "use context7". You can also invoke it explicitly:
If you know the library ID, use it directly to skip resolution:
With the Context7 plugin installed, you get additional agents and commands on top of the skill.
The Context7 Plugin#
The full Context7 plugin for Claude Code includes more than just the MCP server:
The tools for fetching documentation (resolve-library-id, query-docs)
Auto-triggers documentation lookups when you ask about libraries
A docs-researcher agent for focused lookups that keep context lean
/context7:docs for manual documentation queries
Installing the Plugin#
The plugin is available from the Context7 marketplace. Run these commands in Claude Code:
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 and export it as an environment variable before launching Claude Code:
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.
If the variable is not set, the plugin still works — requests just go through the anonymous tier, which has lower rate limits.
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.
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.
How it works
- Resolve: Finds the library ID using
resolve-library-idwith your question as context - Select: Picks the best match based on name accuracy and quality scores
- Fetch: Calls
query-docswith the library ID and your specific question - Return: Provides code examples and explanations from current documentation
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.
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:
Examples:
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