Up-to-date, version-specific library docs injected straight into your coding agent.

Install

$ npx -y @upstash/context7-mcp

What is Context7?

Context7, built by Upstash, attacks one specific failure mode of coding agents: the model's training data is months or years old, so it confidently writes against APIs that have since changed or never existed. Context7 maintains a continuously indexed corpus of library documentation and serves the relevant, current slices to your agent at prompt time.

The MCP server is deliberately small — essentially two tools: one resolves a human library name ("next.js", "prisma") to a Context7 library ID, the other fetches focused documentation for that ID against your query. You can run it locally via npx or point your client at the hosted endpoint (mcp.context7.com); an API key is free and optional, mainly buying you higher rate limits.

It fits as a background utility rather than a workflow tool. Once attached to Claude Code, Cursor, or any MCP client, the agent calls it whenever it needs API details it is unsure about — the practical effect is fewer hallucinated method signatures and less time spent pasting docs into the chat yourself.

Key capabilities

  • Version-aware documentation retrieval — answers reflect the library version you actually use, not the training cutoff
  • Minimal tool surface (resolve library ID + fetch docs), so it barely costs context window
  • Hosted remote endpoint or local npx run — works with 30+ MCP clients including Claude Code and Cursor
  • Free API key raises rate limits; usable without one for light usage
  • Community-maintained index covering thousands of popular libraries and frameworks

When to use it

Add Context7 when your work leans on fast-moving frameworks — Next.js, LangChain, anything that ships breaking changes quarterly — and you keep catching the agent using stale APIs. Skip it if you mostly work in slow-moving stdlib-style code, if your agent already has web search that reliably lands on official docs, or if your dependencies are internal libraries Context7 has never indexed — it only knows public documentation, and the index quality varies by library.

Alternatives

Frequently asked questions

How do I add Context7 to Claude Code?

Run `claude mcp add context7 -- npx -y @upstash/context7-mcp` for a local server, or add the hosted endpoint https://mcp.context7.com/mcp as a remote MCP server. Grab a free API key from context7.com/dashboard if you hit rate limits. Once attached, Claude Code discovers the tools automatically — no per-prompt setup needed.

Is Context7 free to use?

Yes for typical usage. The MCP server is open source, and the hosted documentation service works without an account at low volume. A free API key from the Context7 dashboard raises your rate limits. Upstash monetizes elsewhere; there is currently no paywall on the core docs-retrieval flow.

How is Context7 different from just letting the agent search the web?

Web search returns whole pages of mixed quality — blog posts, outdated Stack Overflow answers — that the agent must sift. Context7 returns pre-indexed, version-tagged snippets from official documentation, so the answer is denser, cheaper in tokens, and less likely to be stale. The trade-off: it only covers libraries in its index.

Star count updated 2026-07-02 · refreshed weekly from the GitHub API · browse all tools →