Guide · Open source
How to use Context7: set up up-to-date docs for AI coding agents
Updated · written with AI from the project's own documentation and checked against our catalogue data
Context7 is a service that gives AI coding assistants current documentation and code examples for specific libraries, so the agent doesn't have to rely only on its older training data. This guide shows you how to install it with the guided setup, how to ask for docs in your prompts, and how to remove it later. It is written for developers who already use an AI coding agent such as Claude, Cursor or VS Code.
Quick start
- 1Check Node.js. Confirm you have Node.js 22.13 or newer, since the ctx7 CLI requires it.
- 2Run the guided setup. Run npx ctx7 setup, sign in via OAuth and choose CLI + Skills or MCP mode.
- 3Pick your agent. Use the --cursor, --claude or --opencode flag to target a specific coding agent.
- 4Add "use context7" to a prompt. End a library-related question with the phrase so the agent fetches current docs.
- 5Pin a library or version. Use the slash ID such as /supabase/supabase or mention a version like Next.js 16 in your prompt.
- 6Remove when finished. Run npx ctx7 remove to delete the generated setup, and uninstall the global ctx7 package separately if you installed it that way.
Check the requirements before you install
Context7 is installed through a package manager. The ctx7 CLI requires Node.js 22.13 or newer, so check your Node.js version before running anything else.
You also need an AI coding agent. The main value of Context7 is feeding docs into that agent, so it is not useful on its own. Context7 sends prompts and library names to its servers, so only use it if that is acceptable for your project.
- Node.js 22.13 or newer
- An AI coding agent such as Claude, Cursor or VS Code
- An internet connection, since requests go to Context7's servers
Install Context7 with the guided setup
Run the guided setup with npx. It authenticates via OAuth, generates an API key and installs the appropriate skill. You can choose between CLI + Skills mode or MCP mode.
To target a specific agent, add one of the flags --cursor, --claude or --opencode. The source also notes that a free API key is available from the Context7 dashboard for higher rate limits.
- CLI + Skills: installs a skill that guides your agent to fetch docs with ctx7 CLI commands, with no MCP required.
- MCP: registers a Context7 MCP server so your agent can call documentation tools directly.
npx ctx7 setupUse Context7 in your prompts
Add the phrase "use context7" to the end of a prompt that asks about a library. Context7 then fetches up-to-date, version-specific docs and examples into your agent's context while it writes code.
If you already know which library you need, add its Context7 ID with the slash syntax. Context7 can then skip the library-matching step and load docs for that library directly. To target a version, simply mention it in your prompt.
- Example: a Next.js proxy request ending with "use context7"
- Library ID example: "use library /supabase/supabase for API and docs"
- Version example: "How do I set up a Next.js 16 proxy? use context7"
Create a Next.js proxy that checks for a valid JWT in cookies
and redirects unauthenticated users to `/login`. use context7Add a rule so Context7 is used automatically
If you installed with ctx7 setup, a skill is configured automatically to trigger Context7 for library-related questions. If you prefer to set this up yourself, add a rule to your coding agent. In Cursor, the rule lives under Cursor Settings > Rules. In Claude Code, it goes in CLAUDE.md. Other agents have equivalent settings.
- Cursor: Cursor Settings > Rules
- Claude Code: CLAUDE.md
Always use Context7 when I need library/API documentation, code generation, setup or configuration steps without me having to explicitly ask.Use the CLI commands directly
The ctx7 CLI has two main commands. Use library to search the Context7 index by library name, which returns matching libraries and their IDs. Use docs with a library ID and a query to retrieve documentation for that library.
Library IDs use a slash format, such as /mongodb/docs.
- ctx7 library <name> <query>: searches by library name and returns matching IDs
- ctx7 docs <libraryId> <query>: retrieves documentation for a given library ID
Remove Context7 or configure it manually
To remove the generated setup later, run the remove command. If you installed the CLI globally with npm install -g ctx7, remove that package separately.
To configure manually instead, use the server URL https://mcp.context7.com/mcp in your MCP client and pass your API key in an Authorization: Bearer header. The project documentation has client-specific instructions for other clients.
npx ctx7 removeWhat people use it for
- Asking an agent to write a Next.js proxy that checks a JWT in cookies, using current framework APIs.
- Configuring a Cloudflare Worker to cache JSON API responses, with docs for the current version.
- Looking up Supabase authentication API calls without leaving the editor.
- Making sure an agent picks the correct version of a framework when you mention the version in the prompt.
Frequently asked questions
Is Context7 free?
The README says you can get a free API key at context7.com/dashboard for higher rate limits. The source does not list pricing beyond that, so check the Context7 website for current plan details. The project itself is released under the MIT licence.
What does Context7 require to run?
The ctx7 CLI requires Node.js 22.13 or newer. You also need an AI coding agent, because Context7 works by supplying docs to that agent.
How do I install Context7?
Run npx ctx7 setup. The guided setup authenticates via OAuth, generates an API key and installs a skill for your agent. You can add --cursor, --claude or --opencode to target a specific agent.
What is the difference between CLI + Skills and MCP mode?
CLI + Skills installs a skill that has your agent fetch docs with ctx7 CLI commands, and it does not need MCP. MCP registers a Context7 MCP server so the agent can call documentation tools directly.
How do I uninstall Context7?
Run npx ctx7 remove to remove the generated setup. If you installed the CLI globally with npm install -g ctx7, also run npm uninstall -g ctx7.
Does Context7 send my prompts anywhere?
Yes. The source states that requests go to Context7's servers, which means prompts and library names are sent externally. If that is not acceptable for your project, do not use it.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
Context7 is a good fit if you use an AI coding agent with libraries that change often, or if you have seen agents invent APIs or suggest outdated code. Skip it if you do not use an AI agent, work only with stable libraries the model already knows well, or cannot send prompts and library names to an external service.
Install options & downloads