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 thectx7 CLI:
Run setup command
- 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:
Manual Setup
If you prefer to configure manually, follow the instructions for your AI coding assistant.Cursor Setup
Cursor Setup
Add an Auto-Invoke Rule
To avoid typinguse 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
Using Library IDs
If you already know the exact library you want, specify its Context7 ID to skip the library-matching step:Specifying Versions
To get documentation for a specific library version, mention it in your prompt:Verify Installation
Restart your AI coding assistant
Close and reopen Cursor, Claude Code, or OpenCode to load the new MCP configuration.
Troubleshooting
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