Install
mcp-registry/context7
context7 logo

context7

Author: upstash

Description: Context7 MCP Server – serves fresh, version-specific code documentation to Model-Context-Protocol (MCP) clients such as Cursor, Claude Code or Opencode.

Stars: 46.0k

Forks: 2.2k

License: MIT License

Category: Enterprise

Overview

Installation

Prerequisites
- Node.js 18 or newer (recommended)
- npx
- An MCP-compatible client (Cursor, Claude Desktop, Claude Code, Opencode, etc.)
- API key from context7.com/dashboard (recommended for higher rate limits, not required)
Step 1: Configure your MCP client
Cursor (Remote Server Connection):
Go to Settings > Cursor Settings > MCP > Add new global MCP server, or edit ~/.cursor/mcp.json:
{ "mcpServers": { "context7": { "url": "https://mcp.context7.com/mcp", "headers": { "CONTEXT7_API_KEY": "YOUR_API_KEY" } } } }
Cursor (Local Server Connection):
{ "mcpServers": { "context7": { "command": "npx", "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"] } } }
Claude Code (Local):
claude mcp add --scope user context7 -- npx -y @upstash/context7-mcp --api-key YOUR_API_KEY
Claude Code (Remote):
claude mcp add --scope user --header "CONTEXT7_API_KEY: YOUR_API_KEY" --transport http context7 https://mcp.context7.com/mcp
Remove --scope user to install for the current project only.
Opencode (Remote):
"mcp": { "context7": { "type": "remote", "url": "https://mcp.context7.com/mcp", "headers": { "CONTEXT7_API_KEY": "YOUR_API_KEY" }, "enabled": true } }
Opencode (Local):
{ "mcp": { "context7": { "type": "local", "command": ["npx", "-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"], "enabled": true } } }
Other MCP Clients:
See https://context7.com/docs/resources/all-clients for installation instructions for 30+ additional clients.
Step 2: (Optional) Set up automatic invocation
To avoid typing "use context7" in every prompt, add a rule to your client:
- Cursor: Cursor Settings > Rules
- Claude Code: add to CLAUDE.md file
Example rule:
Always use Context7 MCP when I need library/API documentation, code generation, setup or configuration steps without me having to explicitly ask.
Step 3: Verify
Test by asking your AI assistant a library-specific question with "use context7" appended, such as:
Create a Next.js middleware that checks for a valid JWT in cookies. use context7
The assistant should invoke the resolve-library-id and query-docs tools to fetch current documentation.

01

resolve-library-id

Resolves a general library name into a Context7-compatible library ID.

02

query-docs

Retrieves documentation for a library using a Context7-compatible library ID.

FAQs

How do I install Context7 MCP Server in Claude Desktop?

Run the command claude mcp add --scope user context7 -- npx -y @upstash/context7-mcp --api-key YOUR_API_KEY in your terminal to install Context7 for all Claude Desktop projects. You can get a free API key at context7.com/dashboard for higher rate limits, or use the server without one for basic functionality. Remove --scope user to install for the current project only, rather than globally.

Does Context7 work with Cursor?

Yes, Context7 works with Cursor through both remote and local server connections. For one-click installation in Cursor 1.0+, use the install button on the Context7 page, or manually add the configuration to ~/.cursor/mcp.json under Settings > Cursor Settings > MCP > Add new global MCP server. You can connect either via the remote URL https://mcp.context7.com/mcp or locally using npx -y @upstash/context7-mcp.

What are the requirements for Context7 MCP Server?

Context7 requires an MCP-compatible client like Cursor, Claude Desktop, or Opencode. For the local server installation, you need Node.js (version 18 or higher recommended) and npx to run the @upstash/context7-mcp package. An API key from context7.com/dashboard is recommended for higher rate limits, but not strictly required for basic usage.

Is Context7 free to use?

Yes, Context7 is free to use under the MIT license, and the MCP server is open source. You can use it without an API key with basic rate limits, or get a free API key at context7.com/dashboard for higher rate limits. The core MCP server code is available on GitHub, though the supporting API backend, parsing engine, and crawling engine are proprietary.

What tools does Context7 MCP Server provide?

Context7 provides two main tools: resolve-library-id, which resolves a general library name into a Context7-compatible library ID, and query-docs, which retrieves version-specific documentation for a library using its Context7 ID. These tools enable LLMs to fetch up-to-date, version-specific code documentation and examples directly from the source instead of relying on outdated training data.

How do I avoid typing 'use context7' in every prompt?

Add a rule to your MCP client configuration to automatically invoke Context7 for code-related questions. In Cursor, go to Cursor Settings > Rules, in Claude Code, create a CLAUDE.md file, or use your client's equivalent rules feature. An example rule is: "Always use Context7 MCP when I need library/API documentation, code generation, setup or configuration steps without me having to explicitly ask."

Can Context7 provide documentation for specific library versions?

Yes, Context7 can retrieve documentation for specific library versions by mentioning the version in your prompt, such as "How do I set up Next.js 14 middleware? use context7". The server will automatically match and retrieve documentation for the appropriate version. You can also use the library ID syntax like /supabase/supabase to skip the library-matching step and directly retrieve docs.

Does Context7 work with VS Code and other editors?

Context7 works with any MCP-compatible client, including VS Code extensions such as Cline and RooCode. You can install it in Opencode, Claude Desktop, Cursor, and 30+ other MCP clients listed in the Context7 documentation. The installation process varies by client but typically involves adding the server configuration via remote URL or local npx command.

License: MIT License
Updated 2/17/2026