Context7

io.github.upstash由 GitHub 账号 upstash 发布v4.5.1更新于 Nov 7, 2026

Up-to-date docs for AI agents

已验证Streamable HTTP可网页运行知识与记忆开发者工具

概览

AI 生成的概览

把库、框架和 API 的最新、对应版本文档与代码示例取回并放入助手上下文。

可以做什么
  • 按用户问题排序,把库或包名解析为 Context7 库 ID
  • 按库 ID 获取最新文档与代码示例,可指定编程语言以优先排序示例
  • 覆盖 API 语法、配置、版本迁移、安装步骤以及云服务的 CLI 用法
适用场景
当助手要回答库、框架、SDK、API 或 CLI 工具相关问题、而训练数据可能过时,或在库与版本之间迁移代码时使用。服务器自身说明:不用于与库或平台 API 无关的重构、调试或代码审查,也不用于通用编程概念。
运行要求
使用 mcp.context7.com 远程端点,或通过 npm 包 @upstash/context7-mcp(stdio)或 mcpb 包在本地运行。建议提供 API 密钥以获得更高速率限制,通过 CONTEXT7_API_KEY 环境变量或 Authorization 请求头传入(Bearer 密钥或原始密钥)。ctx7 CLI 安装方式需要 Node.js 22.13 或更高版本。
安装前请注意
API 密钥属于机密并会发送给 Context7;安装命令会通过 OAuth 认证并生成密钥。文档由社区贡献,无法保证准确性、完整性或安全性,所列项目由其所有者维护而非 Context7。后端、解析与抓取组件为私有。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Context7,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Web executable,通过 Streamable HTTP。 远程服务在工作区中配置后即可从网页运行时运行。

交给智能体安装

把这段提示词粘贴到 Claude Code、Codex、Cursor 等智能体,或 SourceWeft 对话中。智能体会读取该服务器的安装指南,先向你展示发布者、端点和登录方式,经你同意后再把它添加到你的客户端。密钥不会写进任何命令。

阅读 https://sourceweft.com/mcp/io.github.upstash%2Fcontext7/install.md,并按其中说明把这个 MCP 服务器接入我的客户端。修改任何配置之前,先告诉我它的发布者、端点和登录方式,等我确认。不要把 API 密钥写进命令或我会提交的文件;问我密钥应从哪里获取。

查看智能体所依据的安装指南

其他 MCP 客户端

把它添加到你客户端的 mcpServers 配置中。

{
  "mcpServers": {
    "context7": {
      "type": "http",
      "url": "https://mcp.context7.com/mcp"
    }
  }
}

README

[Cover]

[Add to Claude] [Add to ChatGPT] [Add to Cursor] [Add to VS Code]

Context7 - Up-to-date Docs for AI Agents

[Website] [NPM Version] [MIT licensed]

[繁體中文] [简体中文] [日本語] [한국어 문서] [Documentación en Español] [Documentation en Français] [Documentação em Português (Brasil)] [Documentazione in italiano] [Dokumentasi Bahasa Indonesia] [Dokumentation auf Deutsch] [Документация на русском языке] [Українська документація] [Türkçe Doküman] [Arabic Documentation] [Tiếng Việt]

❌ Without Context7

LLMs rely on outdated or generic information about the libraries you use. You get:

  • ❌ Code examples are outdated and based on year-old training data
  • ❌ Hallucinated APIs that don't even exist
  • ❌ Generic answers for old package versions

✅ With Context7

Context7 pulls up-to-date, version-specific documentation and code examples straight from the source — and gives them to your coding agent.

txt
Create a Next.js proxy that checks for a valid JWT in cookiesand redirects unauthenticated users to `/login`. use context7
txt
Configure a Cloudflare Worker script to cacheJSON API responses for five minutes. use context7
txt
Show me the Supabase auth API for email/password sign-up.

Context7 fetches up-to-date code examples and documentation right into your coding agent's context. No tab-switching, no hallucinated APIs that don't exist, no outdated code generation.

Works in two modes:

  • CLI + Skills — installs a skill that guides your agent to fetch docs using ctx7 CLI commands (no MCP required)
  • MCP — registers a Context7 MCP server so your agent can call documentation tools natively

Installation

[!NOTE] API Key Recommended: Get a free API key at context7.com/dashboard for higher rate limits.

Set up Context7 for your coding agents with a single command. The ctx7 CLI requires Node.js 22.13 or newer.

bash
npx ctx7 setup

Authenticates via OAuth, generates an API key, and installs the appropriate skill. You can choose between CLI + Skills or MCP mode. Use --cursor, --claude, or --opencode to target a specific agent.

To remove the generated setup later, run npx ctx7 remove. If you globally installed the CLI with npm install -g ctx7, remove that package separately with npm uninstall -g ctx7.

To configure manually, use the Context7 server URL https://mcp.context7.com/mcp with your MCP client and pass your API key via the Authorization: Bearer YOUR_API_KEY header. See the link below for client-specific setup instructions.

Manual Installation / Other Clients →

Important Tips

Use Library Id

If you already know exactly which library you want to use, add its Context7 ID to your prompt. That way, Context7 can skip the library-matching step and directly retrieve docs.

txt
Implement basic authentication with Supabase. use library /supabase/supabase for API and docs.

The slash syntax tells Context7 exactly which library to load docs for.

Specify a Version

To get documentation for a specific library version, just mention the version in your prompt:

txt
How do I set up a Next.js 16 proxy? use context7

Context7 will automatically match the appropriate version.

Add a Rule

If you installed via ctx7 setup, a skill is configured automatically that triggers Context7 for library-related questions. To set up a rule manually instead, add one to your coding agent:

  • Cursor: Cursor Settings > Rules
  • Claude Code: CLAUDE.md
  • Or the equivalent in your coding agent

Example rule:

txt
Always use Context7 when I need library/API documentation, code generation, setup or configuration steps without me having to explicitly ask.

Available Tools

CLI Commands

  • ctx7 library <name> <query>: Searches the Context7 index by library name and returns matching libraries with their IDs.
  • ctx7 docs <libraryId> <query>: Retrieves documentation for a library using a Context7-compatible library ID (e.g., /mongodb/docs, /vercel/next.js).

MCP Tools

  • resolve-library-id: Resolves a general library name into a Context7-compatible library ID.
    • query (required): The user's question or task (used to rank results by relevance)
    • libraryName (required): The name of the library to search for
  • query-docs: Retrieves documentation for a library using a Context7-compatible library ID.
    • libraryId (required): Exact Context7-compatible library ID (e.g., /mongodb/docs, /vercel/next.js)
    • query (required): The question or task to get relevant documentation for
    • language (optional): The programming language you write in, used to rank code examples in that language first

More Documentation

Packages

Disclaimer

1- Context7 projects are community-contributed and while we strive to maintain high quality, we cannot guarantee the accuracy, completeness, or security of all library documentation. Projects listed in Context7 are developed and maintained by their respective owners, not by Context7. If you encounter any suspicious, inappropriate, or potentially harmful content, please use the "Report" button on the project page to notify us immediately. We take all reports seriously and will review flagged content promptly to maintain the integrity and safety of our platform. By using Context7, you acknowledge that you do so at your own discretion and risk.

2- This repository hosts the MCP server’s source code. The supporting components — API backend, parsing engine, and crawling engine — are private and not part of this repository.

🤝 Connect with Us

Stay updated and join our community:

📺 Context7 In Media

📄 License

MIT

来源:README.md,提交 078c0c7

工具

2

resolve-library-id

Resolve Context7 Library ID

Resolves a package/product name to a Context7-compatible library ID and returns matching libraries. You MUST call this function before 'Query Documentation' tool to obtain a valid Context7-compatible library ID UNLESS the user explicitly provides a library ID in the format '/org/project' or '/org/project/version' in their query. Each result includes: - Library ID: Context7-compatible identifier (format: /org/project) - Name: Library or package name - Description: Short summary - Code Snippets: Number of available code examples - Source Reputation: Authority indicator (High, Medium, Low, or Unknown) - Benchmark Score: Quality indicator (100 is the highest score) - Versions: List of versions if available. Use one of those versions if the user provides a version in their query. The format of the version is /org/project/version. For best results, select libraries based on name match, source reputation, snippet coverage, benchmark score, and relevance to your use case. Selection Process: 1. Analyze the query to understand what library/package the user is looking for 2. Return the most relevant match based on: - Name similarity to the query (exact matches prioritized) - Description relevance to the query's intent - Documentation coverage (prioritize libraries with higher Code Snippet counts) - Source reputation (consider libraries with High or Medium reputation more authoritative) - Benchmark Score: Quality indicator (100 is the highest score) Response Format: - Return the selected library ID in a clearly marked section - Provide a brief explanation for why this library was chosen - If multiple good matches exist, acknowledge this but proceed with the most relevant one - If no good matches exist, clearly state this and suggest query refinements For ambiguous queries, request clarification before proceeding with a best-guess match. IMPORTANT: Do not call this tool more than 3 times per question. If you cannot find what you need after 3 calls, use the best result you

输入参数query必填libraryName必填

query-docs

Query Documentation

Retrieves and queries up-to-date documentation and code examples from Context7 for any programming library or framework. You must call 'Resolve Context7 Library ID' tool first to obtain the exact Context7-compatible library ID required to use this tool, UNLESS the user explicitly provides a library ID in the format '/org/project' or '/org/project/version' in their query. Do not call this tool more than 3 times per question. If you know the programming language the user is working in, pass it as `language` so the results match their setup.

输入参数query必填languagelibraryId必填

版本历史

10
  1. v4.5.1最新Nov 7, 2026
  2. v4.5.0Nov 3, 2026
  3. v4.4.4Oct 19, 2026
  4. v4.4.3Oct 19, 2026
  5. v4.4.2Oct 15, 2026
  6. v4.4.1Oct 13, 2026
  7. v4.3.0Oct 9, 2026
  8. v4.2.0Oct 7, 2026
  9. v4.1.2Oct 7, 2026
  10. v4.1.1Sep 16, 2026

评分

已满足适用检查项的 100%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通必需25 分
  • 已声明认证方式必需10 分
  • 已列出工具必需15 分
  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分