Context7 fetches up-to-date, version-specific library documentation and code examples directly into an LLM's prompt to reduce hallucinated APIs and outdated code. It supports integration into coding agents through an MCP server or a CLI tool.
Project overview
By placing current, source-fetched documentation into the LLM context, it targets the specific problem of LLMs relying on outdated training data for library and API usage.
Project type
MCP · AI Coding
Use cases
Knowledge Q&A · Coding & Development
Deployment
Refer to project documentation
License
MIT
Best for
Developers using AI coding agents who need to fetch up-to-date, version-specific library documentation directly into the prompt context.
Key capabilities
Registers a Context7 MCP server so an agent can natively call documentation tools (resolve-library-id, query-docs).
Installs a skill that guides an agent to fetch documentation using ctx7 CLI commands.
Matches appropriate library versions automatically based on prompt mentions.
Authenticates via OAuth, generates API key, and installs appropriate skill for specific coding agents.
Limitations and risks
The supporting API backend, parsing engine, and crawling engine are private and not part of the open repository.
Because Context7 projects are community-contributed, the accuracy, completeness, or security of all library documentation cannot be guaranteed.
The system may interact with the Context7 API for higher rate limits via a remote MCP URL or API key.
Getting started
Setup is rated easy, requiring Node.js 18 or newer. Users can run `npx ctx7 setup`, authenticate via OAuth, and then use Context7 in their prompt.
Alternatives and comparisons
Indexes local code into a knowledge graph using AST parsing without LLM calls, providing structural context rather than external library documentation.
Indexes codebases into a precomputed knowledge graph exposed via MCP tools to provide architectural context for AI agents.
A code intelligence MCP server that indexes codebases into a persistent knowledge graph to reduce token usage and provide structural queries.
README: LLMs rely on outdated or generic information about the libraries you use.
README: Context7 pulls up-to-date, version-specific documentation and code examples straight from the source — and places them directly into your prompt.
README: resolve-library-id: Resolves a general library name into a Context7-compatible library ID.
README: CLI + Skills — installs a skill that guides your agent to fetch docs using `ctx7` CLI commands (no MCP required)