AI coding assistants hallucinate APIs. They suggest methods that were renamed six months ago, import packages that no longer exist, and write configuration for deprecated versions. The context7 mcp server fixes this by pulling live, version-specific documentation straight from the source and injecting it into your agent's context before it generates a single line of code.
Built by Upstash, Context7 is one of the most starred MCP servers in the ecosystem with over 60,000 GitHub stars and a Grade A on MCPVault. It resolves library names to precise documentation IDs, fetches current API references and code examples, and supports more than 30 MCP clients out of the box. For developers who work with fast-moving libraries like Next.js, Tailwind, Supabase, or Drizzle, Context7 is the difference between code that compiles and code that is correct.
Installation and Setup
The fastest way to install Context7 is through the automated CLI setup:
npx ctx7 setup
This command authenticates via OAuth, generates an API key, and installs the appropriate skill for your agent. You can target a specific client with flags like --cursor, --claude, or --opencode. To remove the generated setup later, run npx ctx7 remove. If you globally installed the CLI with npm install -g ctx7, remove that package separately with npm uninstall -g ctx7.
The CLI requires Node.js 18 or newer. For manual installation, use the hosted MCP server URL with your API key. Add this to your Claude Desktop config:
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
}
}
}
You can also connect remotely via HTTP:
{
"mcpServers": {
"context7": {
"url": "https://mcp.context7.com/mcp",
"headers": {
"Authorization": "Bearer YOUR_API_KEY"
}
}
}
}
A free API key is available at context7.com/dashboard. It is optional for low-volume use but recommended for higher rate limits and stability.
Compatible MCP Clients
| Client | Compatible | Best Connection Method |
|---|---|---|
| Claude Code | Yes | claude mcp add with local or remote |
| Cursor | Yes | One-click install or ~/.cursor/mcp.json |
| VS Code | Yes | Official extension or manual .vscode/mcp.json |
| Cline | Yes | Manual JSON config |
| Windsurf | Yes | Manual config |
| Zed | Yes | Manual config |
| Codex | Yes | Plugin marketplace or manual config |
| ChatGPT | Yes | Developer Mode remote connector |
Tools the Server Exposes
Context7 exposes two MCP tools and a full CLI alongside them.
resolve-library-id takes a library name and resolves it to a Context7-compatible ID. For example, "next.js" becomes /vercel/next.js. This step can be skipped entirely if you already know the library ID and pass it directly in your prompt using slash syntax like use library /supabase/supabase for API and docs.
query-docs retrieves documentation for a specific library ID. Pass a library ID like /supabase/supabase and a query like "how to set up email auth", and Context7 returns current documentation snippets and code examples ranked by relevance.
CLI commands offer the same functionality outside MCP. ctx7 library <name> <query> searches the index by name. ctx7 docs <libraryId> <query> fetches documentation for a known ID. The CLI is useful for scripting, debugging, or agents that do not support MCP natively.
Quality Assessment
Context7 holds a Grade A on MCPVault with a status of stale. The grade reflects massive adoption (60,000+ stars), active maintenance (last updated August 2026), clear MIT licensing, and broad client support. Upstash also provides a VS Code extension that auto-registers the server, which lowers the barrier for VS Code users compared to most MCP servers.
See Context7 on MCPVault for grades, tools and install details.
CLI Plus Skills vs MCP Mode: Which Should You Use?
Most guides only cover the MCP mode, but Context7 actually ships two architectures. Understanding both lets you pick the right one for your workflow.
MCP mode registers Context7 as a native MCP server. Your agent calls resolve-library-id and query-docs as tools. This is the best choice for Claude Code, Cursor, and other modern agents that support MCP well. The agent decides when to fetch docs based on the conversation context. Tool calls stay inside the protocol boundary, which avoids shell escape issues and keeps execution predictable.
CLI plus Skills mode installs a skill file that teaches your agent to run ctx7 CLI commands directly. No MCP server is registered. Instead, the agent invokes shell commands like ctx7 docs /vercel/next.js "middleware setup" and reads the output. This mode works in agents that do not support MCP, or in environments where spawning an MCP process is problematic. It is also the right choice if you want documentation lookup in a CI pipeline or a non-interactive script.
The npx ctx7 setup command lets you choose between the two modes during installation. You can also install both and disable one later. MCP mode is generally preferred for modern clients because it keeps tool calls inside the protocol boundary and avoids shell escape issues. CLI mode is the fallback for older or constrained environments.
Library ID Syntax: Skip the Resolution Step
One performance trick most posts miss: you can skip the resolve-library-id call entirely by using Context7's slash syntax directly in your prompt. Instead of asking "How do I use Supabase auth?" and waiting for the agent to resolve the library, write:
Implement basic authentication with Supabase. use library /supabase/supabase for API and docs.
The slash syntax tells Context7 exactly which library to load docs for, eliminating one round trip. You can also pin versions by mentioning them in the prompt: "How do I set up Next.js 14 middleware? use context7" returns docs for Next.js 14, not the latest version. This is especially useful for legacy projects where the current docs might describe a newer API than the one you have installed.
Frequently Asked Questions
Does Context7 work without an API key?
Yes, for low-volume personal use. Context7 resolves documentation from public sources without requiring authentication. However, an API key is recommended for higher rate limits and more reliable service. Get a free key at context7.com/dashboard.
Can Context7 fetch docs for a specific library version?
Yes. Mention the version in your prompt and Context7 automatically matches the appropriate documentation. For example, "How do I set up Next.js 14 middleware? use context7" returns docs for Next.js 14, not the latest version. You can also specify a library ID with version pinning if available.
How is Context7 different from built-in web search in my agent?
Web search returns raw HTML pages that the agent must parse. Context7 returns pre-processed, structured documentation and code examples from a curated index. The result is cleaner context, fewer tokens wasted on navigation menus and ads, and answers based on official documentation rather than forum threads or outdated blog posts.
What clients support Context7?
Context7 supports more than 30 MCP clients, including Claude Code, Cursor, VS Code, Cline, Windsurf, Zed, Codex, OpenCode, Kiro, Roo Code, Devin Desktop, and ChatGPT via Developer Mode. See the full client list on Context7's docs for configuration examples for every supported platform. You can also read about how MCPVault assigns quality grades in the grading documentation.
Your server in the vault.
If you built an MCP server, claim the listing and get it in front of developers who are actively looking. Free to claim. Verification is free during early access and earns a do-follow link to your project.
Claim your listing or submit a server if it is not indexed yet.
