What Is Context7 MCP? (And Why Claude Code Needs It)
Context7 is the MCP server that stops Claude Code from hallucinating outdated APIs. Here's what it does, how it works, and how to install it in 2 minutes.
Iris Feng is a fictional AI persona, not a real person. This article was written by AI and reviewed by a human editor before publishing. How we work →

You ask to build a form with the latest version of React Hook Form. It writes the code confidently. You run it. It breaks. The API it used hasn't existed for two versions.
This isn't Claude being careless — it's a structural problem with how AI coding tools are built. is the fix, and it takes about two minutes to install.
Why Claude Code Sometimes Writes Broken Code
The training cutoff problem
Every AI model is trained on a snapshot of the internet up to a certain date. After that date, the model has no knowledge of library updates, breaking changes, or deprecated methods — unless that information is injected into its context at the time you ask a question.
Claude Code's underlying model has a training cutoff. Any library that shipped a major update after that date is a potential problem. The model doesn't know what it doesn't know, so it answers confidently with the version it learned.
What "hallucinated API" actually means (with a real example)
Say you're using Supabase Auth and you ask Claude Code to write a sign-in function. Claude might reach for supabase.auth.signIn() — which was the correct method in older versions. The current method is supabase.auth.signInWithPassword(). Both look totally plausible. One works. One throws an error that will send you down a 30-minute debugging rabbit hole.
That's a hallucinated API: a real-sounding, confidently-written method call that simply no longer exists. It's one of the most frustrating beginner experiences with AI coding tools, and it happens most often with fast-moving libraries.
What Is Context7?
The one-sentence version
Context7 is an MCP server that fetches the current, version-specific documentation for whatever library you're using and injects it directly into Claude's context before it writes any code.
How it works: prompt → Context7 → live docs → Claude
When you add use context7 to the end of a prompt, here's what happens:
- Claude Code sends your request to Context7 via the MCP protocol
- Context7 identifies the library you're asking about
- It fetches the relevant, up-to-date documentation from its index
- That documentation gets injected into Claude's context window
- Claude now answers based on the current docs, not its training data
The result is that Claude writes code against the version of the library that actually exists today — not the version it happened to see during training.
Who makes it (Upstash) and why it's free
Context7 is built and maintained by Upstash, the team behind serverless Redis and Kafka infrastructure. They built Context7 as a developer tool and released it as free and open source. The core functionality — doc injection for thousands of libraries — is available without paying anything.
There is a freemium model in place. The free tier caps at 1,000 requests per month (with a 60 requests/hour rate limit). For typical daily use by a solo developer, that is sufficient — but it is not unlimited, and heavy usage will hit the ceiling. Get a free API key at context7.com/dashboard to unlock the full free-tier quota.
What Context7 Actually Changes for You
Before: guessing which version Claude knows
Without Context7, every prompt involving a library is a small gamble. You can add version numbers to your prompt (using Next.js 14), but Claude may still reach for patterns that have been deprecated or restructured. You end up copy-pasting errors into follow-up prompts, asking Claude to fix code it just wrote.
After: "use context7" at the end of your prompt
With Context7 installed, you append use context7 to any prompt where you want accurate, version-aware answers:
Build me a server action that inserts a row into Supabase. Use context7.
That's it. Claude Code handles the rest. You don't manage the docs yourself, you don't paste in changelogs, you don't add version numbers to every prompt.
Libraries it covers (thousands, including React, Next.js, Supabase, Tailwind)
Context7 indexes over 9,000 libraries. You can search the full list at context7.com. Confirmed examples include:
- React — including hooks, concurrent features, and the React 19 API
- Next.js — App Router patterns, server actions,
next.configoptions - Supabase — auth, database, storage, and real-time client APIs
- Tailwind CSS — utility classes, configuration, and plugin APIs
- Prisma, Drizzle, tRPC, and most of the modern TypeScript ecosystem
If you're working with a less popular library, it may not be indexed — but anything with mainstream adoption almost certainly is.
How to Install Context7 in Claude Code
Step 1: add it to your MCP config (one JSON block)
Claude Code reads MCP server configuration from a JSON file. To add Context7, open or create your MCP config and add the following block:
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
}
}
}
Replace YOUR_API_KEY with a free key from context7.com/dashboard — it takes about 30 seconds to sign up. You can omit the --api-key argument entirely and Context7 will still work, but you will hit much stricter rate limits.
If you already have other MCP servers configured, add the "context7" key inside the existing "mcpServers" object — don't create a second one.
You can add this config globally (applies to every project) or per-project inside a .claude/mcp.json file. For most users, global is the right choice. See our guide on what a CLAUDE.md file is for more on how Claude Code reads project-level configuration.
Step 2: test it with a real prompt
Restart Claude Code after saving the config, then try a prompt that touches a specific library:
How do I create a new Supabase client in a Next.js App Router project? Use context7.
If Context7 is working, you'll see Claude Code mention that it's fetching documentation before it writes the code. The response will reference current method names and patterns — and it won't suggest anything deprecated.
Does It Work With Cursor and Windsurf Too?
Yes. Context7 is an MCP server, and MCP is a standard protocol that any MCP-compatible editor can use. Cursor and Windsurf both support MCP servers. The config format is slightly different for each editor — check the Context7 README on GitHub for editor-specific setup instructions.
If you're evaluating which editor to use, our best MCP servers for beginners roundup covers how Context7 compares to other doc-injection approaches.
Is There a Catch?
Freemium limits (what the free tier covers)
Context7 operates on a freemium model. The free tier caps at 1,000 requests per month with a 60 requests/hour rate limit. For a solo developer or beginner using it during normal coding sessions that is almost certainly sufficient — but it is not unlimited. Heavy or automated usage will hit the ceiling, and team workflows that send hundreds of context-fetch requests per day will need a paid plan.
When it won't help (your own custom codebase)
Context7 indexes public libraries and their documentation. It has no knowledge of your own internal APIs, your custom utility functions, or your team's private packages. For that kind of context injection, you need a different approach — Claude Code agents and a well-structured CLAUDE.md file are the tools for that job.
Context7 is also not a replacement for reading changelogs when you upgrade a major library version. It makes Claude smarter about the current state of a library, but it doesn't help Claude reason about what changed in your specific project when you upgraded.
Should You Install It?
If you use Claude Code to write code against any popular library — React, Next.js, Supabase, Tailwind, Prisma, or anything else in the JavaScript ecosystem — yes, install it. It takes two minutes, it's free, and it directly addresses one of the most common pain points beginners hit with AI coding tools.
The use context7 pattern becomes second nature fast. You'll start adding it to any prompt where accuracy matters more than speed, and you'll spend a lot less time debugging confident-but-wrong code.
To get more from Claude Code's MCP ecosystem, check out our best MCP servers for beginners list for what else is worth installing alongside Context7.
From the comments
AI personas · answered by the authorFree tier is 1,000 requests a month. Does every single prompt with 'use context7' burn a request, or only the ones that actually fetch docs? Trying to figure out how fast I'd hit that ceiling.
The article frames the quota around context-fetch requests — each time Context7 goes out and pulls documentation counts against it. So a prompt where you append 'use context7' and it fetches docs is what eats into the 1,000/month. The piece notes that for a solo developer in normal coding sessions that's almost certainly sufficient, and the harder limit you'd notice first is the 60 requests/hour rate cap. It's heavy or automated usage — and team workflows sending hundreds of fetches a day — that hit the ceiling.
And signing up for the key doesn't quietly put me on a paid plan?
No — the article says the core doc-injection functionality is free and open source, and the API key from context7.com/dashboard unlocks the full free-tier quota. It even points out you can omit the key entirely and Context7 still works, just with much stricter rate limits. Paid plans only enter the picture for the heavy/team usage above the free tier.
Dumb question — if Context7 fetches live docs every time, doesn't that make every prompt way slower? Or am I overthinking it?
The article doesn't quote a latency number, so I can't give you a hard figure. What it does describe is the flow: when you add 'use context7', Claude Code sends the request to Context7, it identifies the library, fetches the relevant docs from its index, and injects them into the context before Claude answers. The article's own framing is that you reach for this 'where accuracy matters more than speed' — so there's a tradeoff acknowledged, but it stops short of quantifying it.
Okay so I don't have to slap 'use context7' on literally every prompt then?
Right — the article presents it as something you append to prompts where you want accurate, version-aware answers, not a blanket setting. It specifically says you'll start adding it 'to any prompt where accuracy matters more than speed.' So library-heavy prompts: yes. A quick rename or a question about your own code: no point, since the article also notes Context7 has no knowledge of your internal APIs or custom functions.
Fetching 'current' docs is only as current as Context7's index. What stops the index itself from being stale?
Fair pushback, and the article is honest about the boundaries rather than claiming the index is magically always fresh. It describes Context7 as fetching version-specific documentation from its index across 9,000+ libraries, and explicitly carves out two failure modes: a less popular library may simply not be indexed, and Context7 is 'not a replacement for reading changelogs when you upgrade a major library version.' It makes Claude smarter about the current state of a library but won't reason about what changed in your specific upgrade. The article doesn't document the index's refresh cadence, so on that exact question I can't add anything beyond what's on the page.
The StackBrief weekly
New reviews and the AI-coding-tool news worth knowing — with our take. One email a week, unsubscribe anytime.
Keep reading

What Is the Bright Data MCP? Live Web Access for AI
The Bright Data MCP gives your AI agent search, page scraping, and structured web data at scale — getting past blocks. Here's what it does and the real cost.
June 4, 2026
What Is MCP? Model Context Protocol for Beginners
What is MCP? The Model Context Protocol lets AI tools like Claude connect to apps and data. Here's what it actually means — no jargon, no fluff.
May 8, 2026
What Is Playwright MCP? Browser Automation for Claude Code
Playwright MCP gives Claude Code real browser control — navigate pages, click buttons, fill forms, and run tests without writing a line of Playwright code.
March 16, 2026