AI/TLDR

Context7

Up-to-date, version-specific library docs piped straight into your coding agent's prompt

RAG Frameworks & PlatformsOpen source
Language
TypeScript
License
MIT
$npx ctx7 setup

Overview

Context7 is an open-source tool from Upstash that gives AI coding assistants access to current, version-specific documentation for the libraries you actually use. LLMs are trained on data that ages quickly, so they often suggest outdated APIs, hallucinate methods that do not exist, or answer for old package versions. Context7 fixes this by retrieving real documentation and code examples from the source and inserting them directly into your prompt.

It works in two modes. The CLI plus Skills mode installs a skill that teaches your agent to fetch docs through the `ctx7` command-line tool, with no MCP needed. The MCP mode registers a Context7 MCP server so your agent can call documentation tools natively. You add the phrase "use context7" to a prompt, or set up a rule so it triggers automatically for library and API questions.

What it does

  • Fetches up-to-date, version-specific documentation and working code examples for any indexed library
  • Two setup modes: a CLI + Skills flow using the ctx7 command, or a native MCP server
  • Single-command setup with npx ctx7 setup, with flags to target Cursor, Claude, or OpenCode
  • Library ID syntax (for example /vercel/next.js) to skip matching and load docs for an exact library
  • Version targeting by simply mentioning the version in your prompt
  • Rules and skills that trigger Context7 automatically for documentation and configuration questions

Getting started

The ctx7 CLI requires Node.js 18 or newer. A free API key from context7.com/dashboard is recommended for higher rate limits. One command sets up Context7 for your coding agent.

Run the setup command

Run the setup command, which authenticates via OAuth, generates an API key, and installs the appropriate skill. It lets you choose between CLI + Skills mode and MCP mode. Add a flag like --cursor, --claude, or --opencode to target a specific agent.

bashbash
npx ctx7 setup

Ask with Context7 in your prompt

Add the phrase "use context7" to any library-related prompt so the agent fetches current docs and code examples before answering.

txttxt
Create a Next.js middleware that checks for a valid JWT in cookies
and redirects unauthenticated users to `/login`. use context7

Use the CLI commands directly

Search the Context7 index by library name, then retrieve documentation for a specific Context7-compatible library ID.

bashbash
ctx7 library next.js "middleware auth"
ctx7 docs /vercel/next.js "middleware auth"

Configure MCP manually (optional)

For MCP clients, point them at the Context7 server URL and pass your API key via the CONTEXT7_API_KEY header. The server URL is https://mcp.context7.com/mcp; client-specific instructions are in the linked docs. To remove the generated setup later, run npx ctx7 remove.

Commands and code are distilled from the project's own documentation — always check the official repo for the latest.

When to use it

  • Stopping an AI coding assistant from suggesting outdated or hallucinated APIs by grounding it in real, current docs
  • Generating code for a specific library version by mentioning the version in the prompt
  • Loading exact documentation for a known library via its Context7 ID (for example /supabase/supabase) to skip the matching step
  • Setting up a rule or skill so the agent automatically pulls library and configuration docs without being asked each time

How Context7 compares

Context7 alongside other open-source rag frameworks & platforms tools AI/TLDR tracks, ranked by GitHub stars.

ToolStarsWhat it does
Dify★ 156kAn open-source platform with a visual workflow builder for creating LLM and RAG applications without writing much code.
graphify★ 119kTurns a folder of code, docs, PDFs and images into a local knowledge graph with tree-sitter AST parsing and Leiden communities — queryable by agents over MCP, no vector store.
RAGFlow★ 90.9kA RAG engine built around deep document understanding that turns complex files into a grounded, citation-backed question-answering layer.
Pathway★ 62.3kA Python framework with a Rust streaming engine that keeps ETL, real-time analytics and RAG pipelines continuously up to date as source data changes.
Context7★ 62.2kUp-to-date, version-specific library docs piped straight into your coding agent's prompt
LightRAG★ 39.7kA graph-based RAG system that builds an entity-and-relationship knowledge graph for fast retrieval and easy incremental updates.
Quivr★ 39.5kQuivr is an open-source RAG framework that ingests your documents and answers questions about them, working with any LLM and any file type.
Langchain-Chatchat★ 38.6kAn offline-deployable RAG and agent application built on LangChain that answers questions from a local knowledge base using open-source LLMs, embedding models and vector stores.