SuperAPI AI Directory

context7-mcp

Context7 MCP - Up-to-date Docs For Any Cursor Prompt

Open website

About this tool

Context7 is a platform that provides up-to-date code documentation for LLMs and AI code editors, designed to let AI use accurate, version-specific documentation and code examples when generating code, rather than relying on outdated or generalized training data.

Purpose

Without Context7, LLMs rely on outdated or generic information about the libraries they use, producing outdated code examples, hallucinations of nonexistent APIs, and generalized answers for old package versions. Context7 can pull the latest, version-specific documentation and code examples directly from the source and put them into the prompt, thereby avoiding switching tabs, hallucinations of nonexistent APIs, and outdated code generation.

Main capabilities

Context7 supports two working modes:

  • CLI + Skills: Install a skill that guides the agent to use ctx7 CLI commands to fetch documentation (no MCP required).
  • MCP: Register the Context7 MCP server so that the agent can natively call documentation tools.

The official recommendation is to obtain an API key (get a free key at context7.com/dashboard) to get a higher rate limit.

Usage

The ctx7 CLI requires Node.js 22.13 or higher. You can set up Context7 for a coding agent with a single command; the setup process authenticates via OAuth, generates an API key, and installs the corresponding skill, allowing you to choose CLI + Skills or MCP mode, and use --cursor, --claude, or --opencode to specify the target agent.

To later remove the generated setup, run npx ctx7 remove. If the CLI was installed globally via npm install -g ctx7 , you need to use npm uninstall -g ctx7 to remove the package separately.

For manual configuration, use the Context7 server URL https://mcp.context7.com/mcp with an MCP client, and pass the API key via the Authorization: Bearer YOUR_API_KEY request header.

If you already know which library you want to use, you can include its Context7 ID directly in the prompt, so Context7 can skip the library matching step and retrieve the documentation directly. You can also specify a version in the prompt, and Context7 will automatically match the corresponding version.

After installing via ctx7 setup , a skill is automatically configured to trigger Context7 when library-related questions arise. You can also set up rules manually, for example in Cursor via Cursor Settings > Rules, in Claude Code via CLAUDE.md, or by adding rules in the equivalent location for your coding agent.

Available tools

  • ctx7 library <name> <query>: Search the Context7 index by library name, returning matching libraries and their IDs.
  • ctx7 docs <libraryId> <query>: Retrieve library documentation using a Context7-compatible library ID (for example /mongodb/docs、/vercel/next.js)。
  • resolve-library-id: Resolve a generic library name into a Context7-compatible library ID. Parameters: query (required, the user's question or task, used to sort results by relevance), libraryName (required, the library name to search for).
  • query-docs: Retrieve library documentation using a Context7-compatible library ID. Parameters: libraryId (required, the exact Context7-compatible library ID, for example /mongodb/docs、/vercel/next.js), query (required, the question or task for which you want to retrieve relevant documentation), language (optional, the programming language you are writing in, used to prioritize code examples in the corresponding language).

Use cases

Suitable for scenarios where LLMs and AI code editors need to obtain the latest, version-specific documentation and code examples when writing, completing, or generating code involving third-party libraries, as well as scenarios where you want coding agents to natively call documentation tools via CLI skills or an MCP server.

Limitations

  1. The Context7 project is contributed by the community. Although efforts are made to maintain high quality, the accuracy, completeness, or security of all library documentation cannot be guaranteed. The libraries listed in the project are developed and maintained by their respective owners, not by Context7. If you encounter suspicious, inappropriate, or potentially harmful content, you can use the "Report" button on the project page to notify. By using Context7, you acknowledge that you do so at your own risk.
  2. This repository hosts the source code of the MCP server. Supporting components (API backend, parsing engine, and crawling engine) are private and are not included in this repository.