Documentation Index Fetch the complete documentation index at: https://mintlify.com/upstash/context7/llms.txt
Use this file to discover all available pages before exploring further.
This quickstart guide will get you up and running with Context7 MCP server in your preferred AI coding assistant.
API Key Recommended : Get a free API key at context7.com/dashboard for higher rate limits. Context7 works without an API key, but you’ll have lower rate limits.
Automated Setup (Recommended)
The fastest way to set up Context7 is using the ctx7 CLI:
Run setup command
This command will:
Authenticate via OAuth
Generate an API key automatically
Configure the MCP server for your detected agents
Add a rule to auto-invoke Context7
Select your AI coding assistant
The CLI will detect installed agents (Cursor, Claude Code, OpenCode) and let you choose which to configure. You can also target a specific agent: npx ctx7 setup --cursor
npx ctx7 setup --claude
npx ctx7 setup --opencode
Start using Context7
Restart your AI coding assistant and add use context7 to your prompts: Create a Next.js middleware that checks for a valid JWT in cookies. use context7
Or set up a rule to auto-invoke Context7 for all code-related questions.
Manual Setup
If you prefer to configure manually, follow the instructions for your AI coding assistant.
For project-specific configuration instead of global, use the --project flag:
Go to: Settings → Cursor Settings → MCP → Add new global MCP server Add this configuration to your ~/.cursor/mcp.json file: Remote Server (Recommended) {
"mcpServers" : {
"context7" : {
"url" : "https://mcp.context7.com/mcp" ,
"headers" : {
"CONTEXT7_API_KEY" : "YOUR_API_KEY"
}
}
}
}
Local Server {
"mcpServers" : {
"context7" : {
"command" : "npx" ,
"args" : [ "-y" , "@upstash/context7-mcp" , "--api-key" , "YOUR_API_KEY" ]
}
}
}
Since Cursor 1.0, you can also use the one-click install button in the README.
Remote Server (Recommended) claude mcp add --scope user --header "CONTEXT7_API_KEY: YOUR_API_KEY" --transport http context7 https://mcp.context7.com/mcp
Local Server claude mcp add --scope user context7 -- npx -y @upstash/context7-mcp --api-key YOUR_API_KEY
Remove --scope user to install for the current project only.
Add this to your OpenCode configuration file: Remote Server (Recommended) "mcp" : {
"context7" : {
"type" : "remote" ,
"url" : "https://mcp.context7.com/mcp" ,
"headers" : {
"CONTEXT7_API_KEY" : "YOUR_API_KEY"
},
"enabled" : true
}
}
Local Server {
"mcp" : {
"context7" : {
"type" : "local" ,
"command" : [ "npx" , "-y" , "@upstash/context7-mcp" , "--api-key" , "YOUR_API_KEY" ],
"enabled" : true
}
}
}
Add an Auto-Invoke Rule
To avoid typing use context7 in every prompt, add a rule to your AI coding assistant:
Cursor : Cursor Settings → Rules
Claude Code : Create or edit CLAUDE.md in your project
OpenCode : Configuration rules section
Example Rule
Always use Context7 MCP when I need library/API documentation, code generation,
setup or configuration steps without me having to explicitly ask.
Using Library IDs
If you already know the exact library you want, specify its Context7 ID to skip the library-matching step:
Implement basic authentication with Supabase. use library /supabase/supabase for API and docs.
The slash syntax tells the MCP tool exactly which library to load docs for.
Specifying Versions
To get documentation for a specific library version, mention it in your prompt:
How do I set up Next.js 14 middleware? use context7
Context7 will automatically match the appropriate version.
Verify Installation
Restart your AI coding assistant
Close and reopen Cursor, Claude Code, or OpenCode to load the new MCP configuration.
Test with a simple prompt
Show me how to create a basic Express.js server. use context7
You should see Context7 being invoked to fetch Express.js documentation.
Check MCP server logs
Most AI coding assistants show MCP server status in their settings or debug panel. Look for Context7 in the list of active servers.
Troubleshooting
Common Issues :
Make sure your API key starts with ctx7sk
For local servers, ensure Node.js 18+ is installed
Check that your AI coding assistant supports MCP (most recent versions do)
Verify the configuration file path is correct for your OS
If Context7 isn’t working:
Check API Key : Get a fresh key from context7.com/dashboard
Check Configuration : Ensure JSON syntax is valid (no trailing commas)
Check Logs : Look for error messages in your AI assistant’s MCP logs
Try Remote Server : Remote servers are more reliable than local ones
Next Steps
Installation Guide Learn about SDK, CLI, and AI SDK tools installation
API Reference Explore the REST API for custom integrations