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 分