MCP.so
Sign In

Context7 MCP Server

@upstash

Basic information

Category

Memory & Knowledge

License

MIT

Transports

stdio

Author

upstash

About Context7 MCP Server

Context7 Platform -- Up-to-date code documentation for LLMs and AI code editors

Context7 MCP Server config

Add this server to your MCP-compatible client using the configuration below.

{
  "mcpServers": {
    "context7-mcp": {
      "command": "npx",
      "args": [
        "ctx7",
        "setup"
      ]
    }
  }
}

Context7 MCP Server tools

Tool list not available yet

This listing does not currently have a tool list to display. This does not mean the server has no tools; check its documentation for supported capabilities.

Fetch the live tool list by running this server in a temporary sandbox using the button above.

Overview

What is Context7 MCP Server?

Context7 MCP Server is Upstash's official Context7 MCP server: it pulls up-to-date, version-specific library documentation and code examples into your AI coding assistant's context, so answers use current APIs instead of outdated training data.

Context7 is built by Upstash. The MCP server source lives in the upstash/context7 repository (MIT licensed) and is published on npm as @upstash/context7-mcp; the API backend, parsing and crawling engines that build the documentation index are private. You can use it as a hosted remote server or run it locally, and it also has a CLI + Skills mode that works without MCP.

How to use Context7 MCP Server?

The fastest route is the setup CLI, which needs Node.js 22.13 or newer:

npx ctx7 setup

It signs you in with OAuth, generates an API key, and lets you choose between CLI + Skills mode and MCP mode. Add --cursor, --claude or --opencode to target a specific agent. To undo it later, run npx ctx7 remove.

For a manual setup, use the remote server URL https://mcp.context7.com/mcp and send your key in an Authorization: Bearer YOUR_API_KEY header. A free API key from context7.com/dashboard is recommended for higher rate limits. To run it locally instead, use npx -y @upstash/context7-mcp --api-key YOUR_API_KEY.

Claude Code

Remote:

claude mcp add --scope user --header "Authorization: Bearer YOUR_API_KEY" \
  --transport http context7 https://mcp.context7.com/mcp

Local:

claude mcp add --scope user context7 -- npx -y @upstash/context7-mcp --api-key YOUR_API_KEY

Claude Desktop

For the remote server, open Settings > Connectors > Add Custom Connector, name it Context7 and enter https://mcp.context7.com/mcp. For a local server, add this to claude_desktop_config.json:

{
  "mcpServers": {
    "context7": {
      "command": "npx",
      "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]
    }
  }
}

Cursor

Add to ~/.cursor/mcp.json (the README also has a one-click install button):

{
  "mcpServers": {
    "context7": {
      "url": "https://mcp.context7.com/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_API_KEY"
      }
    }
  }
}

VS Code

Add to .vscode/mcp.json:

{
  "servers": {
    "context7": {
      "type": "http",
      "url": "https://mcp.context7.com/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_API_KEY"
      }
    }
  }
}

Codex

Add to ~/.codex/config.toml:

[mcp_servers.context7]
url = "https://mcp.context7.com/mcp"
http_headers = { "Authorization" = "Bearer YOUR_API_KEY" }

Instructions for 30+ other clients are in the Context7 client docs.

Key features of Context7 MCP Server

  • Fetches current documentation and code examples straight from library sources and places them in the prompt.
  • Version-aware: mention a version ("Next.js 16 proxy") and Context7 matches the right docs.
  • Direct library IDs such as /supabase/supabase or /vercel/next.js skip the search step.
  • Hosted remote endpoint plus a local npm package, so it fits any MCP client.
  • CLI + Skills mode (ctx7 library, ctx7 docs) for agents where you would rather not run MCP.
  • One-command setup with npx ctx7 setup for Cursor, Claude Code and OpenCode.
  • Library maintainers can submit their own projects to the index.

Context7 MCP Server tools

The server keeps its tool surface small, with two tools that are usually called in sequence:

  • resolve-library-id turns a plain library name ("supabase", "next.js") into a Context7-compatible ID. It takes libraryName and your query, which is used to rank matches.
  • query-docs returns documentation and examples for a given libraryId and query. An optional language parameter ranks code examples in your language first.

If you already know the library ID, put it in your prompt and the agent can go straight to query-docs.

Use cases of Context7 MCP Server

  • Writing code against fast-moving frameworks: "Create a Next.js proxy that checks for a valid JWT in cookies and redirects unauthenticated users to /login. use context7"
  • Platform configuration: "Configure a Cloudflare Worker script to cache JSON API responses for five minutes. use context7"
  • Looking up an exact API: "Show me the Supabase auth API for email/password sign-up."
  • Pinning a specific version during an upgrade, for example asking for Next.js 16 behavior while migrating from an older release.
  • Making Context7 automatic with a rule such as "Always use Context7 when I need library/API documentation, code generation, setup or configuration steps" in Cursor Rules or CLAUDE.md.

Context7 MCP Server vs alternatives

  • DeepWiki MCP Server: answers questions about GitHub repositories from generated wiki pages. Context7 focuses on curated, version-specific library docs and code snippets for coding prompts.
  • Built-in web search in your agent: general and unstructured. Context7 returns documentation already parsed for a specific library and version, which tends to cost fewer tokens and fewer wrong turns.
  • Remote vs local Context7: the remote URL needs no Node.js on your machine; the local @upstash/context7-mcp package still calls the Context7 API, so it needs network access either way.

Troubleshooting Context7 MCP Server

  • Rate limited: create an API key at context7.com/dashboard and send it as Authorization: Bearer (remote) or --api-key (local).
  • 401 Unauthorized: check that the key is correct and starts with ctx7sk, and that you are using the right header or flag for your transport.
  • 404 for a library: the ID must look like /owner/repo or /owner/repo/version. Run resolve-library-id first and confirm the library exists on context7.com.
  • Local server will not start: confirm a recent Node.js with node --version, try @upstash/context7-mcp@latest, or use bunx instead of npx for ERR_MODULE_NOT_FOUND. Switching to the remote URL avoids Node.js issues entirely.
  • Claude Code does not see it: run claude mcp list to verify the server, check claude mcp logs context7, or remove and add it again. Connectivity can be tested with curl https://mcp.context7.com/ping.

Frequently asked questions

1

Is Context7 MCP Server official?

Yes. Context7 and its MCP server are built by Upstash; the source is at github.com/upstash/context7 and the npm package is `@upstash/context7-mcp`.

2

Is Context7 free?

There is a free plan. At the time of writing, [context7.com/plans](https://context7.com/plans) lists Free at $0 with 1,000 API calls per month and Pro at $10 per seat per month, plus Enterprise.

3

Do I need an API key for Context7 MCP?

A key is recommended rather than strictly required; it gives you higher rate limits. Get one free at context7.com/dashboard, or let `npx ctx7 setup` generate it for you.

4

What is the Context7 MCP server URL?

`https://mcp.context7.com/mcp`, used with Streamable HTTP and an `Authorization: Bearer YOUR_API_KEY` header.

5

Does Context7 work with Claude Code, Cursor and VS Code?

Yes. All three are documented, along with Claude Desktop, Codex and more than 30 other clients.

6

How do I make my agent use Context7 automatically?

`ctx7 setup` installs a skill that triggers it for library questions. Otherwise add a rule in Cursor Rules or `CLAUDE.md`, or end prompts with "use context7".

7

Can I add my own library to Context7?

Yes. Library owners can submit projects; see the Adding Libraries guide in the Context7 docs.

8

Is the documentation always accurate?

Context7 says its projects are community-contributed and it cannot guarantee the accuracy, completeness or security of all documentation. Use the "Report" button on a project page if something looks wrong.

Comments

More Memory & Knowledge MCP servers