Context7 — Real-Time Docs for AI
The Problem
LLMs frequently hallucinate API methods or reference outdated library versions. This leads to broken code and debugging time wasted on non-existent functions.
The Solution
Context7 fetches current documentation from the actual library source and injects it into your AI's context window, ensuring every code suggestion uses real, up-to-date APIs.
Two Operation Modes
- CLI + Skills — Use
ctx7commands directly - MCP Server — Native integration into your coding agent
MCP Tools
| Tool | Description |
|---|---|
resolve-library-id |
Match library names to Context7 identifiers |
query-docs |
Fetch relevant documentation using a library ID |
CLI Commands
# Find a library
ctx7 library nextjs "app router"
# Get specific docs
ctx7 docs nextjs-14 "server components"Key Benefits
- Version-specific: Request docs for Next.js 14, React 19, etc.
- Real-time: Always fetches current documentation
- Token-efficient: Only retrieves relevant sections, not entire docs
- 30+ integrations: Works with practically any AI coding tool
FAQ
Q: What is Context7? A: Context7 is an MCP server that injects up-to-date, version-specific library documentation into AI coding tools, preventing hallucinated API suggestions.
Q: Is Context7 free? A: Yes, Context7 is open source under the MIT license.
Q: How do I add Context7 to Claude Code?
A: Run npx ctx7 setup or add {"url": "https://mcp.context7.com/mcp"} to your .mcp.json under mcpServers.