
How to add Context7 MCP Server to Cursor
Up-to-date, version-specific library documentation injected into your coding agent. Paste the config into ~/.cursor/mcp.json and restart Cursor.
Last updated June 15, 2026 · 28k★ · stdio · apikey · official
Cursor config for Context7 MCP Server
npx -y @upstash/context7-mcp{
"mcpServers": {
"context7-mcp-server": {
"command": "npx",
"args": [
"-y",
"@upstash/context7-mcp"
],
"env": {
"CONTEXT7_API_KEY": "<optional-your-context7-api-key>"
}
}
}
}Setup steps
- 1Open Cursor → Settings → MCP → Add new MCP server (or edit ~/.cursor/mcp.json directly).
- 2Paste the Context7 MCP Server config below into the "mcpServers" object.
- 3Fill in placeholder secrets, then save.
- 4Cursor reloads MCP servers automatically — check Settings → MCP for a green status dot.
- 5Ask Cursor to use one of Context7 MCP Server's tools to confirm it's connected.
Before you start
- Node.js 18 or newer (for the local stdio server via npx)
- An MCP-capable client (Cursor, Claude Code, Claude Desktop, VS Code, Windsurf, OpenCode, and 30+ others)
- A free Context7 API key from https://context7.com/dashboard for higher rate limits (optional but recommended; passed via the CONTEXT7_API_KEY header or --api-key)
What Context7 MCP Server can do in Cursor
resolve-library-idResolves a plain library name into a Context7-compatible ID (e.g. next.js -> /vercel/next.js), ranking matches by trust score and doc coverage.
query-docsFetches up-to-date, version-specific documentation and code examples for a given Context7 library ID and topic/query (current upstream tool name; some clients/mirrors expose it as get-library-docs).
Security
Basic use needs no credentials; an optional CONTEXT7_API_KEY only raises rate limits and should be kept secret. The server fetches third-party documentation, so treat returned content as untrusted input.
Context7 MCP Server + Cursor FAQ
Where is the Cursor config file?
Cursor reads MCP servers from ~/.cursor/mcp.json. Paste the Context7 MCP Server config there under the "mcpServers" key and restart the client.
Is Context7 MCP Server safe to use with Cursor?
Basic use needs no credentials; an optional CONTEXT7_API_KEY only raises rate limits and should be kept secret. The server fetches third-party documentation, so treat returned content as untrusted input.
Do I need an API key?
You can use Context7 without one, but a free key from context7.com/dashboard raises rate limits and is recommended; pass it via the CONTEXT7_API_KEY header or --api-key flag.
Can I run it remotely instead of installing it?
Yes. Point your client at the hosted endpoint https://mcp.context7.com/mcp and supply your API key in the header, no local Node required.
What's the resolve-library-id step for?
It maps a human library name to a precise Context7 ID. You must call it before fetching docs unless you already pass an ID in /org/project or /org/project/version form.