Skip to main content

Cursor Setup

Install Context7 MCP Server in Cursor to get up-to-date documentation and code examples directly in your AI prompts.

Prerequisites

While Context7 works without an API key, we recommend getting a free API key for higher rate limits.

Installation Methods

Cursor supports both remote and local MCP server connections. Choose the method that best fits your workflow:

Automated Setup

Use the Context7 CLI for automated setup:
npx ctx7 setup --cursor
This command:
  • Authenticates via OAuth
  • Generates an API key
  • Configures the MCP server
  • Sets up recommended rules

Verify Installation

To verify Context7 MCP is working:
1

Open Cursor

Start or restart Cursor IDE.
2

Check MCP Status

Look for “Context7” in the MCP status indicator in Cursor’s status bar.
3

Test with a Prompt

Try a prompt like:
Create a Next.js middleware that checks for a valid JWT. use context7
You should see Context7 tools being invoked and documentation being retrieved.
To avoid typing use context7 in every prompt, add an automatic invocation rule:
1

Open Rules Settings

Go to: Cursor SettingsRules
2

Add Rule

Add the following rule:
Always use Context7 MCP when I need library/API documentation, code generation, 
setup or configuration steps without me having to explicitly ask.
Now Context7 will automatically activate for code-related questions.

Troubleshooting

  1. Verify the JSON syntax in your mcp.json file
  2. Check that the file is in the correct location (~/.cursor/mcp.json)
  3. Restart Cursor completely
  4. Check Cursor’s output panel for error messages
  1. Verify your API key is correct (should start with ctx7sk)
  2. Ensure the API key is not expired
  3. Try regenerating your API key at context7.com/dashboard
  1. Ensure Node.js is installed (node --version)
  2. Clear npx cache: npx clear-npx-cache
  3. Try running manually: npx -y @upstash/context7-mcp
  4. Check for firewall or antivirus blocking npx
  1. Get a free API key at context7.com/dashboard
  2. Check your usage and quota
  3. Consider upgrading to a paid plan at context7.com/plans
For more help, see the Troubleshooting Guide or join our Discord Community.

Next Steps

Configuration

Learn about advanced configuration options

Tools Reference

Explore available MCP tools

Build docs developers (and LLMs) love