Context7 MCP server in Cursor version-accurate docs in Composer.
One mcp.json entry gives Cursor's agent live access to up-to-date library documentation from Context7 — no more code written against last year's API surface.
Cursor's agent is only as accurate as what's in its context, and library documentation is where it slips most — models confidently generate against APIs that were renamed or removed releases ago. Context7, Upstash's open-source MCP server with 57.1k GitHub stars, closes that gap by pulling current, version-specific docs into the conversation on demand.
Setup in Cursor is a single JSON entry plus a toggle. Below: the config, where it goes, and the two or three things that actually go wrong.
Why pair Context7 with Cursor
When the agent needs to know how a library works right now, it can call Context7 instead of guessing. The server resolves the library you're asking about and returns documentation for the specific version, which Cursor folds into the generation. A prompt like "set up tRPC v11 routing — use context7" makes the lookup explicit; in agent mode Cursor will often reach for the tool on its own.
The server runs locally over stdio from npm. It's free, open source, and needs no account to start.
The mcp.json entry
Cursor reads MCP servers from ~/.cursor/mcp.json globally, or .cursor/mcp.json inside a repo when you want the server scoped to one project. You can also go through Cursor Settings > MCP and add it from the UI — both paths write the same file. The real package name is @upstash/context7-mcp:
{
"mcpServers": {
"context7": {
"command": "npx",
"args": ["-y", "@upstash/context7-mcp"]
}
}
}Enable the toggle and confirm tools loaded
After saving, open Cursor Settings > MCP and flip the server's toggle on. A healthy server shows a green status dot and a tool count next to its name; that count is your confirmation the handshake worked. You can cross-check the expected tools against Context7's live listing on the Loomal marketplace: https://loomal.ai/marketplace/context7.
Then test it in Composer — ask for code against a fast-moving library and watch for the tool call in the agent trace.
Troubleshooting in Cursor
Red dot or zero tools usually means the process never started: run npx -y @upstash/context7-mcp in a terminal and see if it launches. If it works there but not in Cursor, the editor likely inherited a PATH without Node — on macOS, launching Cursor from the dock instead of a shell is the classic cause.
If you edited .cursor/mcp.json in a project and nothing changed, check you're not also defining the same server name globally — and note Cursor only re-reads the file on a toggle cycle or restart, so flip the server off and on after edits. Trailing commas in the JSON fail silently in some builds; validate the file if the server simply never appears.
FAQ
How do I add Context7 to Cursor?
Create or edit ~/.cursor/mcp.json, add a context7 entry under mcpServers with command npx and args ["-y", "@upstash/context7-mcp"], then enable it in Cursor Settings > MCP. A green dot with a tool count means it's live.
Global or project config — which should I use?
~/.cursor/mcp.json applies to every workspace; .cursor/mcp.json inside a repo applies only there. Context7 is general-purpose enough that most people put it in the global file and forget about it.
Cursor shows the server but zero tools. Why?
The process started but the MCP handshake failed — usually a Node/PATH issue or a crash on boot. Run the npx command manually to see the error, then toggle the server off and on in settings so Cursor reconnects.
Does Context7 cost anything to use in Cursor?
The server software is open source and free to run. An optional Context7 API key raises rate limits for heavy use; see their docs for what the current tiers look like.
More MCP servers for Cursor.
Every listing on the index shows its live, probed tool list.