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 (~62k GitHub stars as of September 2026) 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 is Upstash's documentation MCP server, with the clearest job description in the ecosystem: 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 "Authorization: Bearer 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 MCP server, the ctx7 CLI, and the SDKs in the repo are open source (MIT); Upstash's README says the API backend, parsing engine, and crawling engine behind them are private. The hosted service is freemium — anonymous use gets low rate limits, a free API key (from the dashboard) raises them to the Free plan's 1,000 API calls a month, and the free tier covers public libraries only (as of September 2026). 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 MCP server is MIT-licensed; the docs backend it queries is proprietary. Anonymous use gets low rate limits. A free API key puts you on the Free plan: 1,000 API calls a month for public repos, after which you're blocked except for 20 bonus calls a day until the month resets (as of September 2026). 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 'Authorization: Bearer YOUR_API_KEY' --transport http context7 https://mcp.context7.com/mcp. A local stdio variant: claude mcp add --scope user context7 -- npx -y @upstash/context7-mcp --api-key YOUR_API_KEY.
Filed under
mcp · documentation · context · rag · upstash
Related
- 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.
- The Best MCP Servers in 2026The MCP servers actually worth connecting in 2026 — Context7, GitHub, Chrome DevTools, Playwright, Serena, Exa, Firecrawl, and official vendor servers.
- 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.
- 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.
- Ref ContextRef's documentation-search MCP server: search-then-read tools over public docs, your private GitHub repos, and PDFs. Hosted, and an API key is required.
- DeepWiki MCPCognition's free, no-auth remote MCP server for DeepWiki: generated wikis and grounded Q&A for any public GitHub repository, from inside your agent.