Skip to main content
Context7 brings up-to-date library documentation directly into Cursor. Instead of getting outdated code examples from training data, you get current documentation from source repositories.

Installation

Project-Level Configuration

You can also configure Context7 for a specific project by creating .cursor/mcp.json in your project folder. This is useful when:
  • Different projects need different API keys
  • You want to share the config with your team via version control
  • A project requires specific Context7 settings
The project config uses the same format as the global config.

Setting Up Rules

To make Context7 trigger automatically (without typing “use context7” every time), add a rule in Cursor.
1

Open Settings

Go to CursorSettings...Cursor SettingsRules and Commands. You can also press Cmd+Shift+P (or Ctrl+Shift+P on Windows/Linux) and type “Cursor Settings”.
Cursor Rules and Commands
2

Add the Rule

Always use Context7 MCP when I ask about library documentation,
API references, or need code examples from external packages.

Using Context7

Add “use context7” to your prompts to fetch current documentation:
use context7 to show me how to set up middleware in Next.js 15
use context7 for Prisma query examples with relations
use context7 for the Supabase syntax for row-level security
If you know the library ID, use it directly to skip resolution:
use context7 with /supabase/supabase for authentication docs
use context7 with /vercel/next.js for app router setup

Tips

Use global config (~/.cursor/mcp.json) when:
  • You want Context7 available in all projects
  • You’re using a personal API key
Use project config (.cursor/mcp.json) when:
  • The project has specific Context7 requirements
  • You want to share the setup with teammates
  • Different projects need different API keys
Context7 works well with Cursor’s Composer feature. When you’re building something that involves external libraries:
  1. Start with a prompt that mentions the libraries you need
  2. Context7 fetches the relevant docs
  3. Composer uses those docs to generate accurate code
This is especially useful for newer library versions that might not be in Cursor’s training data.
  • Be specific about what you’re trying to do, not just which library
  • Mention versions when they matter
  • If the first result isn’t right, ask for a different part of the docs
# Good
How do I handle file uploads with the Supabase Storage API?

# Less specific
How does Supabase storage work?