Context7 MCP server
The Context7 MCP server gives AI coding agents current, version-specific documentation and code examples for thousands of libraries, fetched into the prompt so the agent stops guessing at outdated APIs.
Connect Context7
Guided setup for your agents (OAuth, picks MCP or CLI plus skill)
npx ctx7 setupClaude Code, remote server
claude mcp add --scope user --header "Authorization: Bearer YOUR_API_KEY" --transport http context7 https://mcp.context7.com/mcpCodex
codex mcp add context7 -- npx -y @upstash/context7-mcp --api-key YOUR_API_KEYAny client with a JSON config, remote server
{"mcpServers": {"context7": {"url": "https://mcp.context7.com/mcp", "headers": {"Authorization": "Bearer YOUR_API_KEY"}}}}Get a free API key at context7.com/dashboard, or use the OAuth endpoint https://mcp.context7.com/mcp/oauth in clients that support it. Context7's client page has setup steps for more than 40 clients, including ChatGPT through developer mode.
What the Context7 MCP server does
The Context7 MCP server connects an AI coding agent to Context7, an index of library and framework documentation run by Upstash. When the agent is about to write code against a library, it first resolves the library name to a Context7 ID such as /vercel/next.js, then asks for the docs and code examples that match the task. Context7 returns the relevant snippets for the version you name, which cuts down on invented APIs and code written for an old release.
Context7 keeps its MCP surface to two tools, which costs little context. You can trigger it by adding "use context7" to a prompt, name a library ID directly to skip the lookup, or add a rule to your agent's instructions so it reaches for Context7 on any library question. Library owners can submit their own docs, and Pro teams can index private repositories.
Upstash hosts the server at mcp.context7.com and also publishes it on npm to run locally. Its ctx7 CLI can instead install Context7 as a skill that calls the CLI, with no MCP at all. The GitHub repo had 62,576 stars on 2026-10-01; the backend, parser and crawler are private, and only the MCP server code is open.
Tools it gives your agent
resolve-library-idquery-docs
When to use Context7
- Your agent keeps writing code for an older version of a framework.
- You are working with a library that changed recently or that the model barely knows.
- You want short, relevant doc snippets in context instead of pasting whole pages.
- Your team wants its own private libraries searchable by the agent.
When to pick something else
- Guaranteed accuracy: Context7 says library entries are community-contributed and it cannot vouch for every one, so check critical code against the official docs.
- Heavy free use: the Free plan has a monthly call limit.
What Context7 needs
- A free Context7 API key or OAuth sign-in for higher rate limits
- Node.js 18 or newer for the ctx7 setup command or a local server
What the Context7 MCP server costs
The server code is MIT; Context7's Free plan covers public libraries with a monthly call limit, and paid seats add private repositories and more calls.
Current prices: context7.com . We do not list prices: vendors change them often, so check the publisher's own page.
Questions people ask
Is the Context7 MCP server free?
Yes for most solo use: the Free plan covers public libraries with a monthly call limit. Paid seats add private repos and more calls (plans page, 2026-10-01).
Does Context7 work with ChatGPT and Codex?
Yes. Context7 documents setup for ChatGPT web and desktop through developer mode apps, a Codex plugin and a codex mcp add command, as well as Cursor, Gemini CLI, Copilot and many others.
How do I make the agent use Context7 automatically?
Add a rule to your agent's instructions, for example in CLAUDE.md or Cursor rules, telling it to use Context7 for library docs. The npx ctx7 setup command installs a skill that does this for you.
Other MCP servers for docs and code context
- DeepWiki: The DeepWiki MCP server gives AI agents DeepWiki's generated documentation for public GitHub repositories, plus an ask tool that answers questions about a repo's code, free and without sign-in.
- Microsoft Learn: The Microsoft Learn MCP server gives AI agents search and full-page reading over Microsoft's official documentation, plus official code samples for Azure, .NET and other Microsoft products, free and keyless.