Context7Context7

Documentation MCP ยท explainer

Documentation MCP Server: Context7 MCP for current library docs

A documentation MCP server is an MCP server that fetches current, version-specific library documentation and puts it in the model's context before it answers. That is what stops an AI assistant writing against an API that no longer exists. Context7 MCP is one; install it with claude mcp add --scope user --transport http context7 https://mcp.context7.com/mcp

This page is the why. If you already know you want it and just need the command or the JSON, go to /install or the client page for your editor.

claude mcp add --scope user --transport http context7 https://mcp.context7.com/mcp
Get API key

Why your AI assistant writes deprecated code

A model's weights are frozen on a date. Everything it knows about a library is a snapshot taken before that date, blended across every version that existed at the time. Ask it about something stable and that is fine. Ask it about a library that shipped a new major two months ago and the answer arrives with the same confidence and the wrong API.

This is not the model being careless. It has no way to know which version you have installed, and no way to fetch the current docs on its own. So it averages what it saw. That average is often a version you stopped using a year ago.

The symptom people notice first is that Claude keeps using outdated library versions, or that Cursor suggests old API methods that are not on the object they have. The cause is the same in both cases: nothing in the loop has read the current documentation.

What this looks like in practice

If several of these are familiar, the training cutoff is what you are fighting, not prompt wording.

What a documentation MCP server is

MCP is the Model Context Protocol: a standard way for an AI coding tool to call an external tool and get text back. A documentation MCP server is an MCP server for library documentation, and nothing more exotic than that.

The editor connects to it once. From then on, when a prompt needs to know how a library actually works, the client can call the server, get the current docs for that library, and hand them to the model before it writes anything. The docs travel in the prompt, so the model is reading rather than recalling.

That is the whole category. An up-to-date docs MCP is not a plugin that rewrites the model's answer after the fact, and it is not a bigger model. It is a retrieval step in front of one.

How it works, concretely

Context7 MCP exposes two tools. A client with the server connected can call them on its own, or you can force the issue by adding use context7 to a prompt.

  1. resolve-library-id maps a name you typed, like Next.js, to the library Context7 has indexed.
  2. get-library-docs fetches the current documentation for that library, with an optional topic filter and a token limit so you are not pasting a whole manual into the context window.
  3. The fetched text is injected into the model's context, and only then does the model answer.

Install it

Claude Code is one command, in the box at the top of this page. It is a remote HTTP server, so there is no package to install and no local process to keep alive. Restart Claude Code afterwards and run claude mcp list to confirm context7 is there.

Other editors take JSON with the same endpoint, https://mcp.context7.com/mcp, and each one wants that JSON in a different file with slightly different keys. The per-client pages have the exact snippet: /cursor, /vscode, /claude, /windsurf. The short version of the install is on /install.

Web search and a documentation MCP overlap, and for a quick factual lookup search is fine. They diverge on precision.

Search returns pages about a library: blog posts, Stack Overflow answers, tutorials written against whichever version was current when the author wrote them. That is the same version-blending problem as the training data, only fresher. A documentation MCP returns the library's own documentation, scoped to a library you named, which is a much narrower thing to be wrong about.

Search also costs a round trip through a search engine and whatever the crawler happens to surface that day. The tradeoff runs the other way for anything that is not library documentation: release gossip, comparisons, and pricing are search questions, not docs questions.

Versus building your own RAG over docs

You can scrape the docs you care about, chunk them, embed them, and query that index yourself. People do, and it works. It is also a pipeline you now own: re-crawling when a library ships, noticing when a scrape silently breaks, tuning chunking, and paying for the embeddings.

A hosted documentation MCP is that pipeline as somebody else's problem, in exchange for giving up control of it. Build your own when the corpus is yours and private, or when you need retrieval behaviour you cannot get otherwise. Use a hosted one for public library docs, which are the same for everyone and not worth maintaining separately.

Alternatives, and where each one fits

Context7 is not the only documentation MCP, and the honest answer is that the right one depends on which docs you need.

When you do not need this

Worth saying plainly, because installing it for the wrong reason leads to disappointment.

It does not make the model better at programming. Logic bugs, architecture, and naming are unaffected. It does not know your codebase, so it will not answer questions about your own modules. And for a library that has been stable for years, the training data is probably fine and the extra fetch buys nothing.

The case for it is narrow and common: a library that moves faster than the model's cutoff, and a version you can name.

Questions

What is Context7 MCP Server?

Context7 MCP is a documentation server for AI coding tools. It pulls current library docs into Claude Code, Cursor, VS Code, Claude Desktop, and Windsurf so the model is not stuck on training-cutoff APIs. To add it in Claude Code, run claude mcp add --scope user --transport http context7 https://mcp.context7.com/mcp

Is Context7 MCP Server free to use?

You can try it without paying. An API key from context7.com/dashboard is optional and helps with rate limits.

How many libraries does Context7 support?

Context7 indexes documentation for a large catalog of libraries and frameworks. It is meant for public library docs, not your private repo.

How often is the documentation updated?

Context7 fetches from its current index rather than from the model's training cutoff. When a library ships a new version, that version is what the tools return once it is in the index.

Can Context7 access my private code?

No. Context7 fetches publicly available library documentation. It does not need access to your repository. An API key is for rate limits and private library docs you have been granted, not for reading your source tree.

Context7 MCP remote vs local npx install?

This page is the remote HTTP add against https://mcp.context7.com/mcp. npx ctx7 setup and npx -y @upstash/context7-mcp are the local/stdio path. Use the remote command if you do not want another Node process. spawn context7-mcp ENOENT means the local binary was missing.