Context7
Pulls updated, version-specific documentation and code examples straight from the source into your prompt, so agents stop citing outdated APIs or hallucinating ones that don't exist.
Overview
Context7 solves a specific, common failure mode of coding agents: they rely on training data that's a year (or more) stale, so they hallucinate APIs or generate code for old package versions. Context7 fetches current, version-specific docs and examples and drops them straight into the model's context before it answers.
How it works
Context7 works in two modes. In CLI + Skills mode, it installs a skill that
guides the agent to fetch docs with the ctx7 CLI (ctx7 library <name> <query>,
ctx7 docs <libraryId> <query>); no MCP required, and it's more token-efficient
since it skips loading large tool schemas. In MCP mode, it registers a server
with two tools: resolve-library-id (turns a library name into a Context7 ID) and
query-docs (fetches docs for that ID).
Add a rule like "Always use Context7 when I need library/API documentation, code
generation, setup or configuration steps" to your agent's system prompt/CLAUDE.md
so it reaches for it proactively instead of only when you say "use context7".
Examples
Create a Next.js middleware that checks for a valid JWT in cookies and redirects
unauthenticated users to /login. use context7
Implement basic authentication with Supabase. use library /supabase/supabase for
API and docs.
If you already know the exact library, adding its Context7 ID (/org/repo syntax)
skips the matching step and goes straight to fetching docs, which helps when several
libraries share a similar name.
Installation
You need Node.js 18+.
- Run the one-command setup:
This handles OAuth login, generates an API key, and installs the right integration for the client it detects (Claude Code, Cursor, VS Code...).npx ctx7 setup - Or configure any MCP client manually by pointing it at
https://mcp.context7.com/mcpwith anAuthorization: Bearer YOUR_API_KEYheader (see the sidebar). - Restart your client and add a rule to its system prompt or
CLAUDE.mdtelling it to use Context7 for library and API documentation, so it reaches for it proactively. - Ask it a docs question about a library you use to confirm it's fetching current results.
Related assets
Dify
Open-source LLM app development platform that combines a visual AI workflow canvas, RAG pipelines, agent tooling and model management in one workspace, for teams shipping production-ready AI apps.
Graphify
Turns a codebase, plus its docs, PDFs, images, and video, into a queryable knowledge graph that a coding agent can traverse instead of grepping raw files, and never guesses silently: every edge is tagged EXTRACTED, INFERRED, or AMBIGUOUS so you know what was found versus inferred.
Awesome MCP Servers
The largest community catalog of MCP servers: thousands of entries across dozens of categories (databases, browser automation, cloud, communication and more), tagged by language and scope.