AI tool reviews › MCP servers
What is Context7? An MCP server for up-to-date library docs
Context7 is Upstash's MCP server that puts version-specific library docs into a coding agent's context. How it works, its limits, and a small test I ran.
If you’ve looked for MCP servers to add to a coding agent, or browsed the plugin list in Claude Code, you’ve probably come across the name Context7. Still, the name alone doesn’t tell you much about what actually happens when you add “use context7” to a prompt, as its README suggests.
Context7 is an MCP server, together with the service behind it, that finds the documentation for the library and version you’re using and puts the relevant parts and code examples into your coding agent’s context. MCP is the open standard AI apps use to connect to outside tools, and here it lets the agent call Context7’s lookups as tools. Upstash, a company that runs serverless databases, first released it on March 31, 2025 (announcement).
You probably hear the name often because a model knows a library only as it was when its training data was collected, while libraries keep shipping new versions after that. On October 28, 2026, the GitHub repository had 63,803 stars, and Claude Code’s official plugin list counted 441,485 unique installs as of October 16.
Two tools in front of a private index
The server gives the agent two tools (source). resolve-library-id takes a library name and the question, and returns a list of candidates, each with an ID such as /vercel/next.js, a source reputation, a benchmark score, and its versions. query-docs takes one of those IDs and a query, and returns the doc snippets that best match. You can also add a version to the end of the ID to pick that version.
Both tools simply pass their arguments to Context7’s API, and the README says the backend and the parsing and crawling engines are private. So whether you use the hosted server or start the npm package @upstash/context7-mcp on your own machine, the lookups go to the same place, which means the local package doesn’t work offline either. I started version 4.4.4 myself without a key, and it answered a search.
The part that sits in the context all the time is fairly small. Claude Code turns on tool search by default, so a session starts with only the tool names and the server’s instructions, and loads full definitions when they’re needed (Claude Code MCP docs). By my tiktoken estimate, the instructions are 127 tokens and the two definitions about 674 and 524, and the bigger piece is the doc snippets that come in when a tool is called.
What works without a key, and the free limits
Without a key, both the plain hosted address and the local package answer anonymously. The anonymous limit isn’t published, though, and the API guide only says it’s low. With a free account and an API key, you get 1,000 calls a month, counting searches and docs requests together, and once they’re used up, only 20 a day remain until the next month (plans). One question in my test took three calls.
The Claude Code plugin is where I hit a wall. It adds ?client=claude-code-plugin to the same address, and that address requires a sign-in.
curl -s "https://mcp.context7.com/mcp?client=claude-code-plugin" \
-H "Content-Type: application/json" -H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' -w '\nHTTP %{http_code}\n'
{"jsonrpc":"2.0","error":{"code":-32001,"message":"Authentication required. Please authenticate to use this MCP server."},"id":null}
HTTP 401
That’s why Context7’s Claude Code guide says to run /mcp after installing the plugin and sign in through the browser, and a headless claude -p run, which has no such screen, can’t do that sign-in. Without the ?client= part, the same request gets a 200, so I ran the test below against the plain address with no key.
Where the docs come from and how they’re refreshed
Context7 answers from an index it builds ahead of time. According to Adding Libraries, anyone can add a public library by its GitHub URL, and Context7 pulls explanations and code examples out of its documentation files. If there’s little documentation, it generates examples from the source code, and it skips pages written mainly in languages other than English. The same library can also show up as several entries, and my search for the MCP Python SDK returned the official docs site, the repository, and a DeepWiki page separately.
Refreshes follow use. When a requested library’s docs are older than a threshold set by popularity, Context7 refreshes them in the background. The threshold is one day for the top 100 and 45 days for libraries outside the top 5,000 (Keeping Libraries Fresh). The request itself still gets the old docs, though, so the first person to ask right after a release may see the previous version.
In the end, answers are only as good as that index, and the README says it can’t guarantee the accuracy of the libraries the community has gathered. ContextCrush, which Noma Labs published in March 2026, was a flaw where rules that library owners attached for AI agents were passed verbatim to every agent that queried the library. Upstash deployed a fix that sanitizes the rules on February 23, and Noma said it saw no sign of exploitation. The issue is fixed, but it’s worth remembering that text written by someone else goes straight into your agent’s context.
Testing it on a library that changed after training
For the test I chose the official MCP Python SDK. Its version 2.0.0, released on July 28, 2026, renamed FastMCP to MCPServer. According to the migration guide, importing mcp.server.fastmcp now raises ModuleNotFoundError, so running an answer’s code on 2.3.0 tells you right away whether it’s correct. The prompt was the same in both cases.
Using the official MCP Python SDK at version 2.3.0 (pip install mcp==2.3.0), write server.py: the shortest MCP server that exposes one tool, add(a: int, b: int) -> int, over stdio. Check the current documentation first if you have a tool for it. Reply with only the code in one python block.
context7.json holds only the hosted server’s plain address, and dropping --mcp-config and its --allowedTools from the command below gives the run without Context7.
claude -p "$(cat prompt.txt)" --model haiku --tools "" \
--mcp-config context7.json \
--allowedTools "mcp__context7__resolve-library-id,mcp__context7__query-docs" \
--output-format stream-json --verbose < /dev/null > run.jsonl
--tools "" turns off all built-in tools, so the MCP server is the only difference between the runs, and when I ran it I also added --setting-sources local --strict-mcp-config to keep my own settings out. Replaying the first Context7 run’s log with a short script gives the following, where the token counts on the got: lines are tiktoken estimates.
model: claude-haiku-5-5 | mcp: ['context7 connected']
call: resolve-library-id {"libraryName": "MCP Python SDK", "query": "FastMCP create server with a tool and run over stdio"}
got: 2,042 characters, ~483 tokens
call: query-docs {"libraryId": "/modelcontextprotocol/python-sdk/v2.3.0", "query": "Minimal FastMCP server with a tool add(a: int, b: int) -> int running over stdio with mcp.run", "language": "Python"}
got: 3,580 characters, ~863 tokens
call: query-docs {"libraryId": "/modelcontextprotocol/python-sdk/v2.3.0", "query": "MCPServer import and @mcp.tool decorator example with typed int parameters", "language": "Python"}
got: 4,086 characters, ~1,050 tokens
turns: 4, input tokens: 33,863, output tokens: 821, cost: $0.0030, time: 11.3s
requests: first 6,511, last 10,886 input tokens | all model calls: 35,131
Even though its queries said FastMCP, the model picked the version-specific ID, got snippets with the v2 import, and wrote its answer with MCPServer. I ran each setup twice, added one run with only WebFetch, and then ran every answer on mcp 2.3.0.
run calls input output cost time on mcp 2.3.0
none 0 4,160 629 $0.0012 5.3s ModuleNotFoundError: mcp.server.fastmcp
none 2 0 4,162 475 $0.0011 3.4s ModuleNotFoundError: mcp.server.fastmcp
context7 3 33,863 821 $0.0030 11.3s add(2, 3) = 5
context7 2 3 34,021 707 $0.0024 9.6s add(2, 3) = 5
webfetch 3 24,461 1,193 $0.0090 26.4s add(2, 3) = 5
Without tools, Haiku even added a comment saying it hadn’t checked against 2.3.0, but both times it wrote v1 code that stopped at the import. With Context7, both answers ran, and in exchange the turns went up to four and the cost and time roughly doubled or tripled. Input reached nearly 34,000 tokens because each of the four requests sent the whole conversation again, and most of it was read from the cache. Also, turning off the built-in tools turned off tool search as well, so both definitions loaded from the start and the first request was 2,351 tokens larger.
Upstash’s own measurement from January 2026 puts the average context at about 3.3k tokens after a redesign (Context7 Without Context Bloat), and the tool output in my runs was about 2,400 tokens. Of course, this was one model running one question five times, so it’s a small experiment and not a benchmark.
How it differs from reading the official docs
The simplest alternative is to let the agent read the official docs itself. In the run with only WebFetch, Haiku read the README twice, found the migration page, and gave a correct answer. The conversation was smaller because WebFetch reads each page in a separate model call and passes on only the answer (WebFetch tool behavior). Counting those calls, though, input came to 77,679 tokens, the cost was about three times that of Context7, and the time two to three times as long. On top of that, the model has to guess where the docs are.
Among servers aimed at the same gap is DeepWiki MCP, described in Devin’s documentation. It’s a free remote server you use without signing in, and it serves DeepWiki’s pages for public repositories along with a tool that answers questions, though I only read its docs.
When it fits, and what you take on
Context7 often fits fast-moving public libraries, especially when you use versions newer than your model’s training data. It fits less well for internal libraries, which need a paid plan, or for docs that aren’t in English, and for stable APIs the model already knows well, the extra turns may buy you nothing.
Each question costs a few more calls, a few thousand tokens, and a few seconds, and those requests leave your machine. According to the Data Privacy page, Context7 receives the query the model wrote, the library name, your API key, and client information, and with the hosted server, your IP address goes along in encrypted form. It says your full prompt and code aren’t sent, but the model writes the query, and leaving secrets out is only a request in the tool descriptions. Queries are stored anonymously for benchmarking, and API logs are kept for 30 days. On the other hand, the plugin holds only this server entry, so it runs no local commands or hooks, the server code is MIT-licensed, and it’s actively maintained, with 4.4.4 released on October 19, 2026.
Installing it and a first thing to try
In Claude Code, the official plugin is the shortest path, and a manual setup with an API key also works in headless runs. These commands come from the Context7 and Claude Code docs, and since they write to user settings, I didn’t run them myself.
# Official plugin: install, then run /mcp in a session and sign in
claude plugin install context7@claude-plugins-official
claude plugin uninstall context7@claude-plugins-official
# Manual setup with an API key, which also works with claude -p
claude mcp add --scope user --header "Authorization: Bearer YOUR_API_KEY" \
--transport http context7 https://mcp.context7.com/mcp
claude mcp remove context7
You can also run npx ctx7 setup --claude to sign in, get a key, and install a skill (an instruction file the agent reads when it needs it) in one go, and undo it with npx ctx7 remove. For a first try, I’d suggest taking a library that shipped a major version recently, asking the same question without Context7 and then with it, and running the code you get back. I ran these tests on October 28, 2026 with Claude Code 2.1.304, where --model haiku mapped to claude-haiku-5-5, against the hosted server at 4.4.3 and the local package at 4.4.4.
AI tools helped with the research for this post.