Quick Wins
- Auto-invoke Context7 so you never forget to pull fresh docs
- Target the exact library ID to skip search steps
- Tune networking and proxies for locked-down environments
- Bring in private repositories for internal docs
Auto-Invoke Context7
Stop addinguse context7 to every prompt by setting up an automatic rule.
Add a Rule to Your MCP Client
Cursor
Cursor
- Open
Cursor Settings→Rules - Add this rule:
Windsurf
Windsurf
Create or edit
.windsurfrules in your project root:Claude Code
Claude Code
Create or edit
CLAUDE.md in your project root:Use Specific Library IDs
Skip the search step and get documentation instantly by specifying exact library IDs.How to Find Library IDs
- Visit context7.com
- Search for your library
- The ID is shown in the format
/owner/repository
Use in Your Prompts
You can even specify versions:
/owner/repo/v1.0.0Benefits
- Faster: No library resolution needed
- Precise: Get docs for the exact library and version
- Reliable: No ambiguity about which library to use
Configure HTTPS Proxy
If you’re behind a corporate proxy, configure Context7 to route through it.Set Environment Variables
Linux/macOS
Linux/macOS
Windows (Command Prompt)
Windows (Command Prompt)
Windows (PowerShell)
Windows (PowerShell)
Or Configure in MCP Settings
Add proxy directly to your MCP configuration:Work with Private Repositories
Add your private GitHub, GitLab, or Bitbucket repositories to make internal documentation available through Context7. Requires a Pro or Enterprise plan. For complete instructions on adding, refreshing, and managing private repositories, see the Private Repositories guide. Cost: $15 per 1M tokens when parsing. See Plans & Pricing for details.Set Up Team Collaboration
Share Context7 access with your team. Create a team, invite members with different roles (Owner, Admin, Developer), and manage permissions from your dashboard. For complete instructions on creating teams, inviting members, and managing roles, see the Team Management guide. Cost: $7 per team member per month on Pro plan. See Plans & Pricing for details.Refresh Library Documentation
Keep your documentation up to date.Web Interface
- Go to context7.com/refresh-library
- Enter library ID (e.g.,
/vercel/next.js) - Submit
API
When to Refresh
- After major version releases
- When documentation is updated
- When you notice outdated information
For private repos, you only pay for new/changed content during refresh.
Monitor Usage
Track your API usage, parse tokens, and costs from the dashboard. View metrics for search requests, query tokens, parse tokens, and total monthly costs with detailed breakdowns. For complete details on usage statistics and cost calculations, see the Usage Statistics guide.Best Practices
Security
- Never commit API keys to version control. Use
.envfiles and add them to.gitignore. - Use environment variables for keys, like:
export CONTEXT7_API_KEY=your_key_here. - Rotate keys regularly — every 90 days or immediately if compromised.
- Grant only the permissions a team member needs. Use the “Developer” role for non-admins.
Performance
- Use specific library IDs such as
/vercel/next.jsinstead of general phrases like “next.js docs” when possible. - Focus results using topic filtering. Try adding specific topics like “authentication” or “routing”.
- Use pagination when you need more context — the API supports up to 10 pages per topic. Check the
hasNextfield in responses to know when more pages are available. - Cache frequently used documentation locally for 6-24 hours to reduce API calls.
Library Management
- Keep the
context7.jsonfile in your repositories up to date. Update it when adding new docs or changing structure. - Exclude unnecessary folders, such as tests and build artifacts:
excludeFolders: ["test", "dist", "node_modules"]. - Add helpful rules for AI agents, such as “Always validate user input” or “Use TypeScript strict mode”.
- Maintain version tags for important releases. For example, keep v1.x docs available even after releasing v2.x.
Need Help?
- Troubleshooting: Common issues and solutions
- API Reference: Complete API documentation
- MCP Details: Technical MCP server info
- Community: Join our Discord