MCP Spotlight: Context7 — The Up-to-Date Library Docs Server That Cut Hallucinated API Calls to Near-Zero
Server: @upstash/context7 by Upstash
Stars: 57K+ · License: MIT · Status: Most-installed MCP server of 2026
Transports: Remote (HTTP) + Local (NPX / Docker)
Coverage: Any npm/PyPI/Maven/Go/Crates/RubyGems library with public docs
Clients: 30+ — Claude Desktop, Cursor, Windsurf, Cline, Continue, Codex, Augment, Roo Code, Zed, and more
MCP Tracker: glama.ai/mcp/servers/upstash/context7
Docs: github.com/upstash/context7
The single biggest reason coding agents ship broken code: stale training data. The model learned Next.js 13, but you need 15. It learned Stripe 2023, but the SDK now has 40 new methods. Every agent invocation involves some guesswork about which version of the library is current, what the API surface looks like today, and which patterns are still recommended.
Context7 solves this with the simplest possible architecture: inject version-specific, current library documentation directly into the agent's context, automatically, on every relevant query. 57K+ GitHub stars. The most-installed MCP server of 2026. Works with 30+ AI clients. MIT-licensed. Either a remote endpoint or a local npx install.
Two tools. No configuration. The model gets current docs the moment it needs them.
The Problem: Stale Training Data
Every LLM has a knowledge cutoff. The training data freezes at some date. New library versions, new methods, new patterns, new best practices — the model doesn't see them. The result is a measurable pattern:
- The model suggests an API that was deprecated 6 months ago
- The model uses an import path that no longer exists
- The model confuses two different versions of a library
- The model invents parameter names that "feel right" but don't exist
For users, the failure mode is constant copy-paste of error messages back to the agent: "no, the import is from @upstash/ratelimit, not @upstash/redis." Hours of friction per day per developer. Months per year per team.
Context7 closes the gap. The moment the model says "I need to use the Stripe SDK to create a payment intent," Context7 injects the current Stripe SDK docs directly into the context. The model writes code that works on the first try.
The Two Tools
| Tool | What It Does |
|---|---|
resolve-library-id | Resolves a package name (e.g., "next.js") to a Context7-compatible library ID (e.g., /vercel/next.js/v15.1.0) |
get-library-docs | Returns the current documentation for that library, optionally scoped to a topic |
The two-step pattern is deliberate. The agent first resolves the library to the canonical, version-pinned ID. Then it fetches the docs. This is the same "introspect, then act" pattern the best MCP servers use.
If the user provides the library ID directly in /org/project/version format, the agent can skip the resolve step and go straight to get-library-docs.
How the Injection Actually Works
Context7 is integrated as a system-level MCP server, but the magic is in automatic triggering. The agent's runtime is configured with a rule:
"When the user asks a question about a library, framework, or API, call
resolve-library-idandget-library-docsbefore answering."
This rule is shipped as a system prompt, a Cursor rule, a Claude Desktop preference, or a Cline workspace file. Once configured, the agent fetches current docs on every relevant question without the user prompting.
The flow looks like:
User: "Build me a Next.js 15 server action that creates a Stripe checkout session"
Agent:
1. resolve-library-id("next.js") → /vercel/next.js/v15.1.0
2. get-library-docs(/vercel/next.js/v15.1.0, "server actions")
3. resolve-library-id("stripe") → /stripe/stripe-node/v17.5.0
4. get-library-docs(/stripe/stripe-node/v17.5.0, "checkout sessions")
5. Now write the code with current APIs
The model sees the current Next.js 15 server action syntax and the current Stripe Node SDK checkout session API. The output code works on the first try.
The Remote + Local Model
Context7 ships both as a managed remote endpoint and a local NPM package:
☁️ Remote (HTTP)
{
"mcpServers": {
"context7": {
"url": "https://mcp.context7.com/mcp",
"headers": {
"Authorization": "Bearer ${credentials.CONTEXT7_API_KEY}"
}
}
}
}
- Hosted by Upstash — no install, no Node.js needed
- OAuth or API key authentication
- Auto-updated as new library versions release
- Free tier available (rate-limited); Pro tier for heavy use
🏠 Local (NPX / Docker)
npx -y @upstash/context7-mcp --api-key YOUR_KEY
- Runs as a local child process
- Same tool surface, same docs, same behavior
- No external dependency at runtime (other than docs fetches)
- Works in Claude Desktop (which requires stdio, not HTTP)
Both paths give the same two-tool surface and the same docs source. The choice is operational — do you want Upstash to host the server, or do you want it on your hardware?
The 30+ Client Integrations
Context7 ships native configuration snippets for 30+ AI clients:
| Client | Integration |
|---|---|
| Claude Desktop | System prompt + stdio MCP |
| Claude Code | .mcp.json config |
| Cursor | .cursor/mcp.json + rule file |
| Windsurf | .windsurfrules + MCP config |
| Cline / Roo Code | .clinerules + MCP config |
| Continue | config.json + MCP |
| Codex | MCP support built-in |
| Augment | Rules engine + MCP |
| Zed | settings.json + agent context |
| GitHub Copilot | mcp.json config |
| JetBrains AI Assistant | Plugin + MCP config |
| VS Code + Copilot | Workspace MCP config |
The client-agnostic design is the key: the same MCP server works in every AI tool that supports the protocol. The user picks their editor; Context7 plugs in.
Facio Integration
{
"mcpServers": {
"context7": {
"url": "https://mcp.context7.com/mcp",
"headers": {
"Authorization": "Bearer ${credentials.CONTEXT7_API_KEY}"
}
}
}
}
Facio's audit trail captures every Context7 call: which library was resolved, which version was fetched, what topic filter was used, how many tokens of docs were returned. For a regulated environment (medical, financial, defense) where you need to prove the agent had current information, this is the "show me what the model saw" record.
For HITL workflows, Context7 is read-only and informational. The tool returns documentation; it doesn't execute code, doesn't write files, doesn't modify state. The HITL gating happens downstream — when the agent wants to run the code it wrote based on the docs, that's where Facio's tool-annotation gating kicks in. Context7 is the upstream "make sure the model knows the current API" layer.
Quickstart
# 1. Remote (recommended for most users)
{
"mcpServers": {
"context7": {
"url": "https://mcp.context7.com/mcp",
"headers": {
"Authorization": "Bearer YOUR_CONTEXT7_API_KEY"
}
}
}
}
# 2. Local (Claude Desktop, JetBrains, etc.)
npx -y @upstash/context7-mcp
# 3. Add the system prompt to your AI client:
# "Use Context7 to look up current library documentation
# before answering questions that involve a specific library
# or framework. Call resolve-library-id first, then
# get-library-docs. Always cite the version you retrieved."
# 4. First prompts
# "Build me a Hono API with Bun that uses the latest Zod 4 schema validation"
# "Write a Cloudflare Worker that uses the new R2 multipart upload API"
# "Set up Stripe subscriptions in Next.js 15 with the App Router"
# "What's the current way to do server actions in SvelteKit 2?"
# "Show me the current Stripe API for creating a customer with a payment method attached"
Use Cases
Always-current code generation: Any time the agent writes code involving a specific library, Context7 fetches the current docs. The output works on the first try instead of the third.
Version-aware answers: "Does Next.js 15 still use getServerSideProps?" Agent resolves to Next.js 15, fetches the migration guide, and gives an authoritative answer.
Library migration help: "I have a project on React 17, show me what changes for React 19." Agent resolves both versions, fetches the migration docs, and walks through the breaking changes.
API discovery: "What does the new Stripe Connect SDK offer for platforms?" Agent fetches the current Connect docs and surfaces the relevant methods.
Best-practice enforcement: "What's the current recommended pattern for authentication in Next.js 15?" Agent fetches the current auth docs, ignores the older patterns from training data.
Multi-language library research: "Compare how the Python and Node Stripe SDKs differ for webhook verification." Agent resolves both, fetches both, and produces a structured comparison.
Production debugging: "I'm getting a 401 from the Stripe API. What could cause this in the current SDK?" Agent fetches the current error code reference and surfaces the likely causes.
Onboarding new libraries: "Teach me the new next-safe-action library — what's the current API surface?" Agent resolves the library, fetches the current docs, and produces a tutorial.
The 30+ Client Configurations
The Context7 README includes ready-to-paste configuration blocks for 30+ AI clients. A few examples:
Claude Desktop (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp"]
}
}
}
Cursor (.cursor/mcp.json):
{
"mcpServers": {
"context7": {
"url": "https://mcp.context7.com/mcp",
"headers": { "Authorization": "Bearer YOUR_KEY" }
}
}
}
Claude Code (.mcp.json):
{
"mcpServers": {
"context7": {
"type": "http",
"url": "https://mcp.context7.com/mcp",
"headers": { "Authorization": "Bearer YOUR_KEY" }
}
}
}
The configuration is the same content in three different on-disk formats. Context7's reach across the AI tooling landscape is what makes it the most-installed MCP server of 2026.
Bottom Line
Context7 is the single most important MCP server for any agent that writes code. 57K+ stars, MIT-licensed, 30+ client integrations, two tools, automatic doc injection, the de facto standard for "agent has current library knowledge."
The problem it solves is universal: every LLM has a knowledge cutoff, every modern library evolves faster than that cutoff, and every coding agent benefits from injecting current docs at the moment of the question. Context7 is the simplest, most reliable, most widely-integrated solution.
The two-tool surface (resolve-library-id + get-library-docs) is the minimum viable MCP design — no complexity, no configuration beyond a single API key, no learning curve. The remote + local dual deployment is the operational model every "documentation infrastructure" server should copy.
For any team running AI-assisted coding, Context7 should be the first MCP server installed. The productivity gain is immediate, measurable, and compounds with every new library version.
npx -y @upstash/context7-mcp or sign in to https://mcp.context7.com/mcp. Your agent has current knowledge.
MCP Spotlight is a series covering servers that give AI agents real capabilities. Every server is evaluated for ecosystem impact, simplicity, and integration fit with Facio's HITL-first agent runtime.