Context7
Upstash's MCP server that pulls up-to-date, version-specific library documentation into your agent's context — the cure for hallucinated APIs.
Context7 is the most-adopted MCP server in the ecosystem (~57k GitHub stars): it resolves a library name to its indexed docs and injects current, version-specific documentation and code examples into the model's context at query time. Two tools — resolve-library-id and query-docs — kill the 'trained on last year's API' failure mode. Hosted at mcp.context7.com or local via npx.
Context7, open-sourced by Upstash, is the most-adopted MCP server in the ecosystem — and the one with the clearest job description: stop the model from hallucinating APIs. Models are trained on snapshots; libraries move. Context7 closes the gap by fetching current, version-specific documentation and code examples for thousands of libraries and injecting exactly the relevant slice into your agent's context at query time.
Highlights
- Two tools, one job —
resolve-library-idmaps "next.js" to its indexed ID,query-docspulls the documentation relevant to your query for that exact library and version. - Version-specific — the docs fetched match the version you're working against, which is the whole point: v14 answers for a v14 codebase.
- Hosted or local — a remote Streamable HTTP endpoint at
mcp.context7.com/mcp, or a local stdio server vianpx -y @upstash/context7-mcp. - Beyond MCP — the
ctx7CLI and an agent-skills mode cover the same ground for setups where you'd rather not run an MCP server at all. - Private repos on paid plans — Pro indexes your internal libraries so agents stop hallucinating your APIs too.
In an AI-assisted workflow
The one-command setup wires Claude Code up end to end:
npx ctx7 setup --claude
# or, manually (remote server + API key header):
claude mcp add --scope user --header "CONTEXT7_API_KEY: YOUR_API_KEY" \
--transport http context7 https://mcp.context7.com/mcpFrom then on, "use the current Drizzle syntax for this migration — check Context7" grounds the agent in today's docs instead of training-data memory.
TIP
Context7 pairs naturally with a rule in CLAUDE.md: "when using an unfamiliar or fast-moving library, query Context7 before writing code." It turns the server from a tool the model might use into a habit it always has.
Good to know
The server is MIT-licensed; the hosted service is freemium — anonymous use is rate-limited, a free API key (from the dashboard) lifts the limits, and the free tier covers public libraries only. It's also a good first server for learning how MCP setup works in Claude Code: no OAuth dance, instant value, obvious failure modes.
Frequently asked questions
- What does Context7 actually do?
- When your agent needs to use a library, Context7 fetches that library's current, version-specific documentation and code examples and injects them into context. Instead of the model guessing an API from training data, it reads the real docs for the version you're on — which is why it became the default first MCP server for coding agents.
- Is Context7 free?
- The server is MIT-licensed and the hosted service has a free tier (rate-limited, public-library docs; a free API key raises the limits). Paid Pro and Enterprise plans add private-repo indexing and higher quotas.
- How do I add Context7 to Claude Code?
- Fastest: npx ctx7 setup --claude, which handles login, key, and install. Manual remote: claude mcp add --scope user --header "CONTEXT7_API_KEY: YOUR_API_KEY" --transport http context7 https://mcp.context7.com/mcp. A local stdio variant runs via npx -y @upstash/context7-mcp.
Related
- The Best MCP Servers in 2026The MCP servers actually worth connecting in 2026 — Context7, GitHub, Chrome DevTools, Playwright, Serena, Exa, Firecrawl, and the best official vendor servers, by use case.
- Adding MCP Servers to Claude Code: Local, Remote, and Project-ScopedThe complete claude mcp add reference — stdio vs HTTP transports, local/project/user scopes, .mcp.json with env expansion, OAuth via /mcp, and the gotchas.
- Add MCP ServerAdd an MCP server to the current project the safe way — pick the transport and scope, wire secrets through env vars, vet provenance, and verify the connection before trusting it.
- SmitheryA registry and hosting platform for Model Context Protocol servers — discover, deploy, and connect MCP servers from one place.
- Documentation EngineerUse this agent to write and maintain technical docs that stay true to the code — READMEs, how-to guides, API references, and runbooks. Examples — updating a stale README after a refactor, documenting a new public API from its signatures, writing an on-call runbook for a service.
- Connecting and Governing MCP Servers: Registries, Gateways, and Tool SprawlAs MCP servers multiply, discovery, trust, and tool sprawl become the problem. How registries, gateways, and curation keep a growing fleet secure and usable.