Context7
MCP serversUpstash's MCP server that fetches current, version-specific library docs and code examples into your agent.
Install
$ claude mcp add --scope user context7 -- npx -y @upstash/context7-mcp
Works with Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot and any other MCP client.
Update
$ claude mcp remove context7 && claude mcp add --scope user context7 -- npx -y @upstash/context7-mcp@latest
Adding it again while it is configured fails, so this removes it first. The remote variant at https://mcp.context7.com/mcp updates server-side.
When to use it
- You use a library that changed after the model's training data, and the agent keeps writing APIs that no longer exist.
- You need the docs for one version, such as Next.js 16, rather than whatever the model remembers.
- You want one docs lookup that works across languages and frameworks instead of a skill per library.
Commands & flags
- use context7
- Add to a prompt so the agent fetches docs for the libraries involved.
- resolve-library-id
- MCP tool: turn a library name into a Context7 library ID such as /vercel/next.js.
- query-docs
- MCP tool: fetch docs and code examples for a library ID and a question.
- use library /supabase/supabase for API and docs
- Name the library ID in the prompt to skip the matching step.
- How do I set up a Next.js 16 proxy? use context7
- Mention a version and Context7 matches the docs for it.
- npx ctx7 setup
- Upstash's guided setup: signs in with OAuth, creates a key, and installs a skill or the MCP server.
How to use it
This is an MCP server. Register it:
claude mcp add --scope user context7 -- npx -y @upstash/context7-mcp
It works without a key, within lower rate limits. For higher ones, get a free API key at context7.com/dashboard and add --api-key <your key> after the package name; Claude Code then keeps the key in its MCP config. To use Upstash's hosted server instead of the local package, Context7's docs give claude mcp add --scope user --header "Authorization: Bearer YOUR_API_KEY" --transport http context7 https://mcp.context7.com/mcp.
Ask with "use context7", or add a rule to CLAUDE.md such as "Always use Context7 when I need library/API documentation, code generation, setup or configuration steps". If you would rather not run an MCP server, npx ctx7 setup can install a skill that drives the ctx7 CLI instead.
Why it earns its place
Two tools, so it costs little context, and it answers from the library's current docs rather than the model's memory, which is where most invented APIs come from. It covers any stack Context7 has indexed.
The docs are community-contributed and Upstash does not guarantee their accuracy, so check anything surprising. Your queries go to Context7's service, and only the MCP server's code is open, not the backend: keep secrets out of prompts. When a framework ships its own official skill, such as FastAPI's, that is the more direct source for that framework.
Try it
> Create a Next.js proxy that checks for a valid JWT in cookies and redirects unauthenticated users to /login. use context7