LLMs have stale training data. When working with Next.js 15, React 19, or any library that evolved after the model’s cutoff date, you get hallucinated APIs and deprecated patterns.
Context7 solves this by pulling version-specific documentation directly into your prompt.
Setup with Claude Code#
claude mcp add context7 npx -y @upstash/context7-mcp@latest
For higher rate limits, get a free API key at context7.com/dashboard and add it:
claude mcp add context7 npx \
-y @upstash/context7-mcp@latest \
-e CONTEXT7_API_KEY=your-api-keyUsage#
Add “use context7” to your prompt:
Use context7. How do I set up middleware in Next.js 15?
Context7 will fetch current documentation before the model responds.
How it works#
Two tools power it:
| Tool | Purpose |
|---|---|
resolve-library-id | Matches library names to Context7 IDs (e.g., “next.js” → “/vercel/next.js/v15.0.0”) |
get-library-docs | Fetches documentation chunks and code examples (default 5000 tokens) |
The documentation comes directly from official sources, ranked by trust score and coverage.