SuperAPI AI Directory

context7

MCP server for up-to-date code documentation for LLMs.

Open website

About this tool

Context7 is a platform that provides up-to-date code documentation for LLMs and AI code editors. It aims to solve the problem of LLMs relying on outdated or generic information, such as outdated code examples, hallucinating non-existent APIs, and giving generic answers for old package versions. Context7 pulls the latest, version-specific documentation and code examples directly from the source and puts them into the prompt, with no need to switch tabs, avoiding hallucinated APIs and outdated code generation.

Main capabilities:

  • Provides the latest, version-specific library documentation and code examples.
  • Supports two working modes: CLI + Skills mode, installing a skill that guides the agent to use ctx7 CLI commands to fetch documentation (no MCP required); MCP mode, registering the Context7 MCP server so the agent can natively call documentation tools.
  • Supports specifying a library's Context7 ID in the prompt (such as /mongodb/docs, /vercel/next.js) to skip the library matching step and retrieve documentation directly.
  • Supports specifying a version; mentioning the version in the prompt automatically matches it.
  • Provides the ctx7 CLI tool, which requires Node.js 22.13 or higher.
  • Provides MCP tools: resolve-library-id (resolves a generic library name to a Context7-compatible library ID) and query-docs (retrieves documentation using a library ID, with an optional language parameter to prioritize code examples in that language).
  • Provides a REST API, TypeScript SDK, Vercel AI SDK tools, and more.

How to use:

  • Set up Context7 for a coding agent with a single command. The ctx7 CLI requires Node.js 22.13 or higher.
  • The setup process authenticates via OAuth, generates an API key, and installs the corresponding skill. You can choose CLI + Skills or MCP mode. Use --cursor, --claude, or --opencode to specify a particular agent.
  • To remove the generated setup, run npx ctx7 remove. If the CLI was installed globally (npm install -g ctx7), it must be removed separately with npm uninstall -g ctx7.
  • 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 header.
  • It is recommended to get a free API key (context7.com/dashboard) to increase rate limits.
  • If installed via ctx7 setup, a skill is automatically configured to trigger Context7 on library-related questions. You can also manually add rules: in Cursor Settings > Rules for Cursor, in CLAUDE.md for Claude Code, or in the equivalent location for other coding agents.
  • Available tools: ctx7 library <name> <query> searches the Context7 index by library name and returns matching libraries and their IDs; ctx7 docs <libraryId> <query> retrieves documentation using a Context7-compatible library ID.

Use cases:

  • When the latest library documentation and code examples are needed in AI code editors (such as Cursor, Claude Code, OpenCode, etc.).
  • When it is necessary to avoid LLMs generating outdated code or hallucinating APIs.
  • When documentation is needed for a specific library version.

Limitations and notes:

  • Context7 projects are community-contributed, and the accuracy, completeness, or security of all library documentation cannot be guaranteed. Projects are developed and maintained by their respective owners, not by Context7. If you encounter suspicious, inappropriate, or potentially harmful content, you can report it using the "Report" button on the project page. Use Context7 at your own risk.
  • This repository only hosts the source code of the MCP server. Supporting components—the API backend, parsing engine, and crawling engine—are private and are not included in this repository.
  • The ctx7 CLI requires Node.js 22.13 or higher.
  • Using an API key is recommended to increase rate limits.
  • More documentation: CLI reference, MCP clients (manual installation for 30+ clients), adding libraries, troubleshooting, API reference, developer guide.
  • Related packages: @upstash/context7-mcp (MCP server), @upstash/context7-sdk (TypeScript SDK), @upstash/context7-tools-ai-sdk (Vercel AI SDK tool), @upstash/context7-pi (pi.dev extension).