Context7 for Claude Code: Setup & Config
Context7 retrieves current library documentation and code examples for Claude Code.
What you can do with Context7 in Claude Code
Ground coding assistance in targeted library documentation, including version-specific examples.
- Retrieve library-specific API documentation while generating code.
- Configure an agent to fetch documentation automatically for library questions.
Before you start: Context7 in Claude Code
- Node.js 18 or later for the setup CLI
- A compatible coding agent or MCP client
This is a setup command, not a persistent server launch. Choose MCP mode during setup. Manual HTTP configuration passes a key in the CONTEXT7_API_KEY header, not an environment variable. A free API key is recommended for higher limits.
Context7 Claude Code configuration
Choose Claude Code configuration scope
For Context7, open Project scope: .mcp.json at the repository root. Project JSON: merge into mcpServers; user scope: use the CLI.
Add Context7 to Claude Code
Use the context7-mcp entry below in mcpServers. Keep Context7's documented http connection fields and your other Claude Code entries.
Check Context7 in Claude Code
Context7: Inspect claude mcp list and /mcp status.
Config file · Project scope: .mcp.json at the repository root
{
"mcpServers": {
"context7-mcp": {
"type": "http",
"url": "https://mcp.context7.com/mcp"
}
}
}claude mcp add-json --scope project 'context7-mcp' '{"type":"http","url":"https://mcp.context7.com/mcp"}'Context7 tools available to Claude Code
Context7's stored tool list documents 2 tools; compare it with Claude Code's connected tool list, because the stored list is not a live check.
- resolve-library-id
For Context7's resolve-library-id, review the permission request and arguments in Claude Code before approval.
Match a library name and task to a Context7 library identifier.
- query-docs
For Context7's query-docs, review the permission request and arguments in Claude Code before approval.
Troubleshooting Context7 in Claude Code
- Inspect claude mcp list, then Context7's connection to mcp.context7.com in /mcp. Complete Claude Code authentication only for a trusted service.
- Context7: check http connectivity to mcp.context7.com from Claude Code; a stdio command is not a replacement for this endpoint.
- Transport mismatch: Context7's catalog lists stdio; the displayed Claude Code configuration uses http.
- Known limitation: Community-contributed documentation is not guaranteed accurate, complete, or secure.
- Known limitation: The backend, parsing engine, and crawler are not included in the repository.
- Known limitation: Higher rate limits are tied to using an API key.
- General Claude Code troubleshooting lives in the /clients/claude-code guide.
Context7 — details. Claude Code guide