Context7 MCP server
Last verified: 2026-09
Up-to-date library docs pulled into the prompt.
Community Developer tools Needs a secret Claude Desktop, Cursor, Windsurf, Claude Code, VS Code
What it does
Upstash Context7: resolve a library name to an id, then pull current docs. Use it when the model is about to invent an old API. Optional CONTEXT7_API_KEY raises rate limits.
It sits in Developer tools: Split this category in two.
Good for
- resolve-library-id for 'next.js', then query-docs for the version you are on.
- Stop the model from inventing a React API that died two majors ago.
- Pin a version in the query so v3 and v4 docs do not mix.
- Prefer this before installing five framework-specific generators.
Tools
- resolve-library-id — Map 'next.js' → a Context7 library id.
- query-docs — Fetch docs for that id (pin a version when you can).
Config (Claude Desktop / Cursor / Windsurf)
Paste the JSON below. Same mcpServers shape. Replace placeholder paths and secrets.
Windows paths look like C:\\Users\\you\\project, not /path/to.
Host-side steps →
Claude Desktop
| OS | Config file |
|---|---|
| macOS | ~/Library/Application Support/Claude/claude_desktop_config.json |
| Windows | %APPDATA%\Claude\claude_desktop_config.json
(usually C:\Users\<you>\AppData\Roaming\Claude\) |
| Linux | ~/.config/Claude/claude_desktop_config.json |
Cursor
| Scope | macOS / Linux | Windows |
|---|---|---|
| This project | .cursor/mcp.json in the repo root | |
| This user | ~/.cursor/mcp.json |
%USERPROFILE%\.cursor\mcp.json |
Windsurf
| OS | Config file |
|---|---|
| macOS / Linux | ~/.codeium/windsurf/mcp_config.json |
| Windows | %USERPROFILE%\.codeium\windsurf\mcp_config.json |
{
"mcpServers": {
"context7": {
"command": "npx",
"args": [
"-y",
"@upstash/context7-mcp"
],
"env": {
"CONTEXT7_API_KEY": "optional"
}
}
}
}
Windsurf remote MCP: use serverUrl instead of url if the block below is HTTP.
One-liner: npx -y @upstash/context7-mcp
Secrets it wants: optional CONTEXT7_API_KEY
How to get started
- npx -y @upstash/context7-mcp. Key is optional.
- In the host, tell it to use Context7 and pass a library id when you know it.
- Pin versions in the query so it does not mix v3 and v4 docs.
Access risk
Low. It reads public docs. The key is a quota token, not your cloud account.
When to skip it
Skip it for your own repo (Filesystem) or for a single README URL (Fetch).
Vs alternatives
| Server | Official? | Needs a secret? | Best for |
|---|---|---|---|
| Context7 | No | Yes | Up-to-date library docs pulled into the prompt. |
| Fetch | Yes | Yes | Fetch a URL and turn the page into readable text. |
| GitHub | Yes | Yes | Repos, issues, PRs, and file contents on GitHub. |
| shadcn/ui | No | No | Add shadcn components from the registry. |
More in Developer tools
FAQ
Do I need a key?
Optional CONTEXT7_API_KEY raises rate limits. Public docs work without it.
Context7 or Fetch on the docs URL?
Context7 if you do not have the URL. Fetch if you already know the page.
Does it read my repo?
No. Public library docs only.
Official Upstash?
Yes — @upstash/context7-mcp. Community relative to Anthropic's reference list.