Context7 MCP Server
Context7 MCP server provides up-to-date, version-specific code documentation directly in LLM context, preventing hallucinated APIs and outdated code generation.
Overview
Context7 solves one of the biggest problems with AI code generation: LLMs generate code using outdated APIs or libraries that don't exist. Context7 pulls up-to-date, version-specific documentation and code examples from over 9,000 libraries and places them directly into the LLM's context window.
Upstash Project:
Developed and maintained by Upstash
Key Features
Version-Specific Docs
Get documentation for exact library versions — not year-old training data
Hallucination Prevention
Eliminate hallucinated APIs by grounding code generation in real documentation
9,000+ Libraries
Covers React, Next.js, Supabase, Tailwind, Prisma, Python, Go, Rust, and thousands more
Dual Mode
Use as CLI + Skills for lightweight setup or as native MCP server for tool integration
One-Command Setup
Single npx ctx7 setup installs everything — skill, API key, configuration
30+ Client Support
Works with Cursor, Claude Code, VS Code, Windsurf, Cline, Roo Code, and more
Available Tools
Quick Reference
| Tool | Purpose | Category |
|---|---|---|
resolve-library-id | Find the Context7 ID for a library by name | Discovery |
query-docs | Retrieve version-specific docs for a library | Documentation |
Detailed Usage
resolve-library-id▶
Resolve a library name to its Context7 ID for use with query-docs.
{
"libraryName": "supabase",
"query": "authentication setup"
}
query-docs▶
Retrieve relevant documentation and code examples for a specific library.
{
"libraryId": "/supabase/supabase",
"query": "How to implement Row Level Security policies"
}
How It Works
Instead of LLMs guessing API signatures from outdated training data, Context7 injects real, version-specific documentation into the prompt context. Your agent sees actual code examples, parameter signatures, and configuration patterns — not hallucinations.
Without Context7:
- LLM generates
createClient()with wrong parameters - Uses deprecated middleware API from Next.js 12
- Invents Supabase methods that don't exist
With Context7:
- LLM sees the current
createClient()signature from latest docs - Uses
middleware.tspattern from Next.js 14 docs - Calls real Supabase auth methods verified against source
Installation
npx ctx7 setup
Authenticates via OAuth, generates an API key, and installs the appropriate skill. Use --cursor, --claude, or --opencode to target a specific agent.
API Key:
Get a free API key at context7.com/dashboard for higher rate limits.
Usage Tips
- Use library IDs directly: Mention
/supabase/supabasein your prompt to skip library matching - Specify versions: Say "Next.js 14" to get version-specific docs
- Add a rule: Set a Cursor rule or CLAUDE.md entry: "Always use Context7 when I need library documentation"
Sources
Related Articles
Chroma MCP Server
Chroma MCP servers enable AI models to interact with the Chroma embedding database for vector search, collection management, and document operations.
Instagram MCP Server
Instagram MCP server provides comprehensive Instagram Graph API integration with 57 tools for publishing, comments, story management, insights, and direct messaging.
Ollama Deep Researcher: AI Model for Web Search & LLM Synthesis
Ollama Deep Researcher MCP servers enable AI models to perform advanced topic research using web search and LLM synthesis, powered by a local MCP server.