Context7 Platform -- Up-to-date docs for AI agents
docs: updated the Chinese README and Qwen Code installation guide (#1553)
mamaruo7d7e04279565
diff --git a/docs/resources/all-clients.mdx b/docs/resources/all-clients.mdxindex 2b95c858..fa906f4d 100644--- a/docs/resources/all-clients.mdx+++ b/docs/resources/all-clients.mdx@@ -720,13 +720,32 @@ See [JetBrains AI Assistant Documentation](https://www.jetbrains.com/help/ai-ass</Accordion>-<Accordion title="Qwen Coder">+<Accordion title="Qwen Code">-See [Qwen Coder MCP Configuration](https://qwenlm.github.io/qwen-code-docs/en/tools/mcp-server/#how-to-set-up-your-mcp-server) for details.+See [Qwen Code MCP Configuration](https://qwenlm.github.io/qwen-code-docs/en/users/features/mcp/) for details.-1. Open the Qwen Coder settings file at `~/.qwen/settings.json`+### Using CLI Command++By default, configurations are saved to the project scope (`.qwen/settings.json`). Use the `--scope user` flag to save to the user scope (`~/.qwen/settings.json`) instead.++#### Remote Server Connection+```sh+qwen mcp add --transport http context7 https://mcp.context7.com/mcp \+ --header "CONTEXT7_API_KEY: YOUR_API_KEY" \+ --header "Accept: application/json, text/event-stream"+```++#### Local Server Connection+```sh+qwen mcp add context7 npx -y @upstash/context7-mcp --api-key YOUR_API_KEY+```++### Manual Configuration++1. Open the Qwen Code settings file at `~/.qwen/settings.json` (user scope) or `.qwen/settings.json` (project scope)2. Add the following to the `mcpServers` object:+#### Remote Server Connection```json{"mcpServers": {@@ -741,8 +760,7 @@ See [Qwen Coder MCP Configuration](https://qwenlm.github.io/qwen-code-docs/en/to}```-Or, for a local server:-+#### Local Server Connection```json{"mcpServers": {diff --git a/i18n/README.zh-CN.md b/i18n/README.zh-CN.mdindex 45924979..18589e52 100644--- a/i18n/README.zh-CN.md+++ b/i18n/README.zh-CN.md@@ -1,72 +1,57 @@-# Context7 MCP - 为所有 Prompt 获取最新文档+[](https://cursor.com/en/install-mcp?name=context7&config=eyJ1cmwiOiJodHRwczovL21jcC5jb250ZXh0Ny5jb20vbWNwIn0%3D)++# Context7 MCP - 最新文档赋能每个提示词++[](https://context7.com) [](https://smithery.ai/server/@upstash/context7-mcp) [](https://www.npmjs.com/package/@upstash/context7-mcp) [](./LICENSE)-[](https://context7.com) [](https://smithery.ai/server/@upstash/context7-mcp)-[](https://cursor.com/en/install-mcp?name=context7&config=eyJ1cmwiOiJodHRwczovL21jcC5jb250ZXh0Ny5jb20vbWNwIn0%3D) [<img alt="Install in VS Code (npx)" src="https://img.shields.io/badge/Install%20in%20VS%20Code-0098FF?style=for-the-badge&logo=visualstudiocode&logoColor=white">](https://insiders.vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%7B%22name%22%3A%22context7%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40upstash%2Fcontext7-mcp%40latest%22%5D%7D)[](../README.md) [](./README.zh-TW.md) [](./README.ja.md) [](./README.ko.md) [](./README.es.md) [](./README.fr.md) [-purple>)](./README.pt-BR.md) [](./README.it.md) [](./README.id-ID.md) [](./README.de.md) [](./README.ru.md) [](./README.uk.md) [](./README.tr.md) [](./README.ar.md) [](./README.vi.md)## ❌ 不使用Context7-大语言模型(LLM)可能依赖过时或通用的库信息。你可能会遇到:+大语言模型(LLM)依赖过时或通用的库信息。你会遇到:-- ❌ 代码示例已过时,或基于一年前的训练数据+- ❌ 代码示例已过时,基于一年前的训练数据- ❌ 幻觉产生的API根本不存在- ❌ 针对旧版本包的通用回答## ✅ 使用Context7-Context7 MCP直接从源头获取最新的、特定版本的文档和代码示例 — 并将它们直接放入你的提示中。-在Cursor中添加`使用 context7`到你的提示:+Context7 MCP直接从源头获取最新的、特定版本的文档和代码示例——并将它们直接放入你的提示词中。++在你的提示词中附上`用context7`(或[设置规则](#添加规则)自动调用):```txt-创建一个使用app router的基本Next.js项目。使用 context7+创建一个Next.js中间件,检查cookies中的有效JWT,+并将未认证用户重定向到 `/login`。用context7``````txt-创建一个脚本,删除PostgreSQL数据库中city字段为""的行。使用 context7+配置Cloudflare Worker脚本,将JSON API响应+缓存五分钟。用context7```-Context7将最新的代码示例和文档直接获取到你的LLM上下文中。+Context7将最新的代码示例和文档直接获取到你的LLM上下文中。无需切换标签页,不会因幻觉产生不存在的API,不会生成过时的代码。-- 1️⃣ 按照往常,自然地编写你的提示-- 2️⃣ 告诉LLM`使用 context7`-- 3️⃣ 获取可用的代码回复- 无需在标签间切换,不存在幻觉API,不会生成过时的代码生成。+## 安装-## 📚 添加项目+> [!NOTE]+> **推荐使用API密钥**:在[context7.com/dashboard](https://context7.com/dashboard)s获取免费API密钥,使用秘钥后速率限制更高。-查看我们的[项目添加指南](./adding-projects.md)来学习如何将你最喜欢的库添加(或更新)到 Context7。--## 🛠️ 开始使用--### 要求--- Node.js >= v18.0.0-- Cursor, Claude Code, VSCode, Windsurf 或其他MCP客户端-- Context7 API密钥(可选,用于更高的请求速率限制)(通过在[context7.com/dashboard](https://context7.com/dashboard)创建账户获取)<details>-<summary><b>通过 Smithery 安装</b></summary>--通过 [Smithery](https://smithery.ai/server/@upstash/context7-mcp) 为任何客户端自动安装 Context7 MCP 服务器:+<summary><b>在Cursor中安装</b></summary>-```bash-npx -y @smithery/cli@latest install @upstash/context7-mcp --client <CLIENT_NAME> --key <YOUR_SMITHERY_KEY>-```--你可以在 [Smithery.ai 网页](https://smithery.ai/server/@upstash/context7-mcp)中找到你的 Smithery 密钥。+前往:`Settings` -> `Cursor Settings` -> `MCP` -> `Add new global MCP server`-</details>+推荐将以下配置粘贴到你的Cursor `~/.cursor/mcp.json` 文件中。你也可以通过在项目文件夹中创建 `.cursor/mcp.json` 在特定项目中安装。更多信息请参阅 [Cursor MCP 文档](https://docs.cursor.com/context/model-context-protocol)。-<details>-<summary><b>在 Cursor 中安装</b></summary>+> 自Cursor 1.0起,你可以点击下面的安装按钮一键安装。-前往:`Settings` -> `Cursor Settings` -> `MCP` -> `Add new global MCP server`-推荐将以下配置粘贴到你的 Cursor `~/.cursor/mcp.json` 文件中。你也可以通过在项目文件夹中创建 `.cursor/mcp.json` 在特定项目中安装。更多信息请参阅 [Cursor MCP 文档](https://docs.cursor.com/context/model-context-protocol)。-> 自 Cursor 1.0 起,你可以点击下面的安装按钮进行即时一键安装。+#### Cursor远程服务器连接-#### Cursor 远程服务器连接[](https://cursor.com/en/install-mcp?name=context7&config=eyJ1cmwiOiJodHRwczovL21jcC5jb250ZXh0Ny5jb20vbWNwIn0%3D)+```json{"mcpServers": {@@ -80,8 +65,10 @@ npx -y @smithery/cli@latest install @upstash/context7-mcp --client <CLIENT_NAME>}```-#### Cursor 本地服务器连接-[](https://cursor.com/en/install-mcp?name=context7&config=eyJjb21tYW5kIjoibnB4IC15IEB1cHN0YXNoL2NvbnRleHQ3LW1jcCJ9)+#### Cursor本地服务器连接++[](https://cursor.com/en/install-mcp?name=context7&config=eyJjb21tYW5kIjoibnB4IC15IEB1cHN0YXNoL2NvbnRleHQ3LW1jcCJ9)+```json{"mcpServers": {@@ -92,989 +79,167 @@ npx -y @smithery/cli@latest install @upstash/context7-mcp --client <CLIENT_NAME>}}```+</details><details>-<summary><b>在 Claude Code 中安装</b></summary>+<summary><b>在Claude Code中安装</b></summary>-运行以下命令。更多信息请参见 [Claude Code MCP 文档](https://docs.anthropic.com/zh-CN/docs/claude-code/mcp)。+运行以下命令。更多信息请参见[Claude Code MCP文档](https://code.claude.com/docs/zh-CN/mcp)。-#### Claude Code 本地服务器连接+#### Claude Code本地服务器连接```shclaude mcp add context7 -- npx -y @upstash/context7-mcp --api-key YOUR_API_KEY```-#### Claude Code 远程服务器连接+#### Claude Code远程服务器连接```shclaude mcp add --header "CONTEXT7_API_KEY: YOUR_API_KEY" --transport http context7 https://mcp.context7.com/mcp```-</details>--<details>-<summary><b>在 Windsurf 中安装</b></summary>--将此内容添加到你的 Windsurf MCP 配置文件中。更多信息请参阅 [Windsurf MCP 文档](https://docs.windsurf.com/windsurf/cascade/mcp)。--#### Windsurf 远程服务器连接--```json-{- "mcpServers": {- "context7": {- "serverUrl": "https://mcp.context7.com/mcp",- "headers": {- "CONTEXT7_API_KEY": "YOUR_API_KEY"- }- }- }-}-```--#### Windsurf 本地服务器连接-```json-{- "mcpServers": {- "context7": {- "command": "npx",- "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]- }- }-}-```</details><details>-<summary><b>在 VS Code 中安装</b></summary>+<summary><b>在Opencode中安装</b></summary>-[<img alt="在 VS Code 中安装 (npx)" src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Install%20Context7%20MCP&color=0098FF">](https://insiders.vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%7B%22name%22%3A%22context7%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40upstash%2Fcontext7-mcp%40latest%22%5D%7D)-[<img alt="在 VS Code Insiders 中安装 (npx)" src="https://img.shields.io/badge/VS_Code_Insiders-VS_Code_Insiders?style=flat-square&label=Install%20Context7%20MCP&color=24bfa5">](https://insiders.vscode.dev/redirect?url=vscode-insiders%3Amcp%2Finstall%3F%7B%22name%22%3A%22context7%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40upstash%2Fcontext7-mcp%40latest%22%5D%7D)-将此内容添加到你的 VS Code MCP 配置文件中。更多信息请参阅 [VS Code MCP 文档](https://code.visualstudio.com/docs/copilot/chat/mcp-servers)。+将此内容添加到你的Opencode配置文件中。更多信息请参见[Opencode MCP 文档](https://opencode.ai/docs/mcp-servers)。-#### VS Code 远程服务器连接+#### Opencode远程服务器连接```json"mcp": {- "servers": {- "context7": {- "type": "http",- "url": "https://mcp.context7.com/mcp",- "headers": {- "CONTEXT7_API_KEY": "YOUR_API_KEY"- }- }+ "context7": {+ "type": "remote",+ "url": "https://mcp.context7.com/mcp",+ "headers": {+ "CONTEXT7_API_KEY": "YOUR_API_KEY"+ },+ "enabled": true}}```-#### VS Code 本地服务器连接--```json-"mcp": {- "servers": {- "context7": {- "type": "stdio",- "command": "npx",- "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]- }- }-}-```-</details>+#### Opencode本地服务器连接-<details>-<summary>-<b>在 Cline 中安装</b>-</summary>--您可以通过以下步骤轻松地通过 [Cline MCP Server 市场](https://cline.bot/mcp-marketplace) 安装 Context7:-1. 打开 **Cline**。-2. 点击菜单图标 (☰),进入 **MCP 服务器** 部分。-3. 在 **市场** 标签页中的搜索栏搜索 _Context7_。-4. 点击 **安装** 按钮。-您也可以直接修改MCP servers设置文件:-1. 打开**Cline**。-2. 点击菜单图标 (☰),进入 **MCP 服务器** 部分。-3. 选择 **远程服务器** 标签。-4. 点击 **编辑配置** 按钮。-5. 将 context7 相关设置添加到 `mcpServers`:```json{- "mcpServers": {+ "mcp": {"context7": {- "url": "https://mcp.context7.com/mcp",- "type": "streamableHttp",- "headers": {- "Authorization": "Bearer YOUR_API_KEY"- }+ "type": "local",+ "command": ["npx", "-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"],+ "enabled": true}}}```-</details>-<details>-<summary><b>在 Zed 中安装</b></summary>--它可以通过 [Zed Extensions](https://zed.dev/extensions?query=Context7) 安装,或者您也可以将以下内容添加到您的 Zed `settings.json` 中。更多信息请参见 [Zed Context Server 文档](https://zed.dev/docs/assistant/context-servers)。-```json-{- "context_servers": {- "Context7": {- "source": "custom",- "command": "npx",- "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]- }- }-}-```</details>-<details>-<summary><b>在 Augment Code 中安装</b></summary>--要在 Augment Code 中配置 Context7 MCP,您可以使用图形界面或手动配置两种方式。--### **A. 在 Augment Code Code UI 中使用**-1. 点击 hamburger 菜单。-2. 选择 **Settings**。-3. 进入 **Tools** 部分。-4. 点击 **+ Add MCP** 按钮。-5. 输入以下命令:- ```- npx -y @upstash/context7-mcp@latest- ```-6. 给 MCP 命名为:**Context7**。-7. 点击 **Add** 按钮。-添加 MCP 服务器后,您即可在 Augment Code 内直接使用 Context7 提供的最新代码文档功能。------### **B. 手动配置**-1. 按下 Cmd/Ctrl + Shift + P,或在 Augment 面板点击 hamburger 菜单。-2. 选择编辑设置 (Edit Settings)。-3. 在高级设置中,点击在 settings.json 中编辑 (Edit in settings.json)。-4. 将服务器配置添加到 `augment.advanced` 对象中的 `mcpServers` 数组中。-```json-"augment.advanced": {- "mcpServers": [- {- "name": "context7",- "command": "npx",- "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]- }- ]-}-```-添加 MCP 服务器后,重启编辑器。如果收到任何错误,请检查语法,确保没有缺少关闭括号或逗号。-</details>+**[其他IDE和客户端 →](https://context7.com/docs/resources/all-clients)**<details>-<summary><b>在 Roo Code 中安装</b></summary>--将此内容添加到您的 Roo Code MCP 配置文件中。更多信息请参见 [Roo Code MCP 文档](https://docs.roocode.com/features/mcp/using-mcp-in-roo)。--#### Roo Code 远程服务器连接+<summary><b>OAuth认证</b></summary>-```json-{- "mcpServers": {- "context7": {- "type": "streamable-http",- "url": "https://mcp.context7.com/mcp"- }- }-}-```+Context7 MCP服务器支持OAuth 2.0认证,适用于实现了[MCP OAuth规范](https://modelcontextprotocol.io/specification/2025-03-26/basic/authorization)的MCP客户端。-#### Roo Code 本地服务器连接+要使用OAuth,请在客户端配置中将端点从`/mcp`更改为`/mcp/oauth`:-```json-{- "mcpServers": {- "context7": {- "command": "npx",- "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]- }- }-}+```diff+- "url": "https://mcp.context7.com/mcp"++ "url": "https://mcp.context7.com/mcp/oauth"```-</details>-<details>-<summary><b>在 Gemini CLI 中安装</b></summary>+OAuth仅适用于远程HTTP连接。对于使用stdio传输的本地MCP连接,请改用API密钥认证。-详细信息请参阅 [Gemini CLI 配置](https://google-gemini.github.io/gemini-cli/docs/tools/mcp-server.html)。-1. 打开 Gemini CLI 设置文件。位置是 `~/.gemini/settings.json`(其中 `~` 是你的主目录)。-2. 将以下内容添加到你的 `settings.json` 文件中的 `mcpServers` 对象:-```json-{- "mcpServers": {- "context7": {- "httpUrl": "https://mcp.context7.com/mcp",- "headers": {- "CONTEXT7_API_KEY": "YOUR_API_KEY"- }- }- }-}-```-或者,对于本地服务器:-```json-{- "mcpServers": {- "context7": {- "command": "npx",- "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]- }- }-}-```-如果 `mcpServers` 对象不存在,请创建它。</details>-<details>-<summary><b>在 Claude Desktop 中安装</b></summary>--#### 远程服务器连接-打开 Claude Desktop,进入【设置】>【连接器】>【添加自定义连接器】,将名称填写为 `Context7`,远程 MCP 服务器 URL 填写为 `https://mcp.context7.com/mcp`。+## 重点技巧-#### 本地服务器连接-打开 Claude Desktop 开发者设置,编辑您的 `claude_desktop_config.json` 文件,添加以下配置。更多信息请参见 [Claude Desktop MCP 文档](https://modelcontextprotocol.io/quickstart/user)。-```json-{- "mcpServers": {- "context7": {- "command": "npx",- "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]- }- }-}-```-</details>+### 添加规则-<details>-<summary><b>在 Opencode 中安装</b></summary>+为避免每次都在提示词中输入`用context7`,你可以在MCP客户端中添加规则,自动为代码相关问题调用 Context7:-将此内容添加到您的 Opencode 配置文件中。更多信息请参见 [Opencode MCP 文档](https://opencode.ai/docs/mcp-servers)。+- **Cursor**:`Cursor Settings > Rules`+- **Claude Code**:`CLAUDE.md`+- 或你的 MCP 客户端中的等效设置-#### Opencode 远程服务器连接+**规则示例:**-```json-"mcp": {- "context7": {- "type": "remote",- "url": "https://mcp.context7.com/mcp",- "headers": {- "CONTEXT7_API_KEY": "YOUR_API_KEY"- },- "enabled": true- }-}+```txt+无需我明确要求,当我需要库或API文档、生成代码、创建项目基架时或配置步骤时,始终使用Context7 MCP。```-#### Opencode 本地服务器连接+### 使用库 ID-```json-{- "mcp": {- "context7": {- "type": "local",- "command": ["npx", "-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"],- "enabled": true- }- }-}+如果你已经确切知道要使用哪个库,请将其Context7 ID添加到你的提示词中。这样,Context7 MCP服务器可以跳过库匹配步骤,直接检索文档。++```txt+使用Supabase实现基本身份验证。用/supabase/supabase作为库ID获取API和文档。```-</details>-<details>-<summary><b>在 OpenAI Codex 中安装</b></summary>+斜杠语法明确告知MCP工具需加载文档的库。-更多信息请参见 [OpenAI Codex](https://github.com/openai/codex)。-将以下配置添加到您的 OpenAI Codex MCP 服务器设置中:+### 指定版本-#### 本地服务器连接+要获取特定库版本的文档,只需在提示词中提及版本:-```toml-[mcp_servers.context7]-args = ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]-command = "npx"+```txt+如何设置Next.js 14中间件?用context7```-#### 远程服务器连接+Context7 将自动匹配适当的版本。-```toml-[mcp_servers.context7]-url = "https://mcp.context7.com/mcp"-http_headers = { "CONTEXT7_API_KEY" = "YOUR_API_KEY" }-```-</details>+## 可用工具-<details>-<summary><b>在 JetBrains AI Assistant 中安装</b></summary>+Context7 MCP提供以下工具供LLM使用:-更多详情请参见 [JetBrains AI Assistant 文档](https://www.jetbrains.com/help/ai-assistant/configure-an-mcp-server.html)。-1. 在 JetBrains IDE 中,进入 `Settings` -> `Tools` -> `AI Assistant` -> `Model Context Protocol (MCP)`。-2. 点击 `+ Add`。-3. 在对话框左上角点击 `Command`,然后从列表中选择 “以 JSON 形式”。-4. 添加以下配置并点击 `OK`。-```json-{- "mcpServers": {- "context7": {- "command": "npx",- "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]- }- }-}-```-5. 点击 应用 以保存更改。-6. 同样的方法可以在 `Settings` -> `Tools` -> `Junie` -> `MCP Settings` 中为 JetBrains Junie 添加 context7。-</details>+- `resolve-library-id`:将通用库名称解析为Context7兼容的库ID。+ - `query`(必需):用户的问题或任务(用于按相关性排名结果)+ - `libraryName`(必需):要搜索的库名称-<details>-<summary><b>在 Kiro 中安装</b></summary>+- `query-docs`:使用Context7兼容的库ID获取库的文档。+ - `libraryId`(必需):精确的Context7兼容的库ID(例如 `/mongodb/docs`、`/vercel/next.js`)+ - `query`(必需):用于获取相关文档的问题或任务-详情请见 [Kiro 模型上下文协议文档](https://kiro.dev/docs/mcp/configuration/)。-1. 进入 `Kiro` > `MCP Servers`-2. 点击 `+ Add` 按钮,新增一个 MCP 服务器。-3. 粘贴以下配置内容:-```json-{- "mcpServers": {- "Context7": {- "command": "npx",- "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"],- "env": {},- "disabled": false,- "autoApprove": []- }- }-}-```-4. 点击 `Save` 以应用更改。-</details>+## 更多文档-<details>-<summary><b>在 Trae 中安装</b></summary>+- [更多MCP客户端](https://context7.com/docs/resources/all-clients) - 30+客户端的安装说明+- [添加库](https://context7.com/docs/adding-libraries) - 将你的库提交到Context7+- [故障排除](https://context7.com/docs/resources/troubleshooting) - 常见问题和解决方案+- [API参考](https://context7.com/docs/api-guide) - REST API 文档+- [开发者指南](https://context7.com/docs/resources/developer) - 本地运行Context7 MCP-使用“手动添加”功能,填写该 MCP 服务器的 JSON 配置信息。-更多详情请访问 [Trae 文档](https://docs.trae.ai/ide/model-context-protocol?_lang=en)。+## 免责声明-#### Trae 远程服务器连接+1- Context7项目由社区贡献,虽然我们努力保持高质量,但我们不能保证所有库文档的准确性、完整性或安全性。Context7中列出的项目由其各自所有者开发和维护,而非由Context7开发和维护。如果你遇到任何可疑、不当或潜在有害的内容,请使用项目页面上的“Report”按钮立即通知我们。我们认真对待所有举报,并将及时审查被举报的内容,以维护我们平台的完整性和安全性。使用Context7即表示你承认自行承担风险。-```json-{- "mcpServers": {- "context7": {- "url": "https://mcp.context7.com/mcp"- }- }-}-```+2- 本仓库托管MCP服务器的源代码。支持组件——API 后端、解析引擎和爬取引擎——是私有的,不包含在本仓库中。-#### Trae 本地服务器连接+## 🤝 与我们联系-```json-{- "mcpServers": {- "context7": {- "command": "npx",- "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]- }- }-}-```-</details>+保持更新并加入我们的社区:-<details>-<summary><b>在 Bun 或 Deno 中使用</b></summary>+- 📢 在[X](https://x.com/context7ai)上关注我们获取最新新闻和更新+- 🌐 访问我们的[网站](https://context7.com)+- 💬 加入我们的[Discord社区](https://upstash.com/discord)-使用以下替代方法,在其他运行环境中运行本地 Context7 MCP 服务器。这些示例适用于任何支持通过命令 + 参数启动本地 MCP 服务器的客户端。+## 📺 Context7媒体报道-#### Bun+- [Better Stack:"免费工具让Cursor智能10倍"](https://youtu.be/52FC3qObp9E)+- [Cole Medin:"这绝对是AI编码助手的最佳MCP服务器"](https://www.youtube.com/watch?v=G7gK8H6u7Rs)+- [Income Stream Surfers:"Context7 + SequentialThinking MCP:这是AGI吗?"](https://www.youtube.com/watch?v=-ggvzyLpK6o)+- [Julian Goldie SEO:"Context7:新的MCP AI代理更新"](https://www.youtube.com/watch?v=CTZm6fBYisc)+- [JeredBlu:"Context 7 MCP:即时获取文档 + VS Code配置方法"](https://www.youtube.com/watch?v=-ls0D-rtET4)+- [Income Stream Surfers:"Context7:将改变AI编码的新MCP服务器"](https://www.youtube.com/watch?v=PS-2Azb-C3M)+- [AICodeKing:"Context7 + Cline & RooCode:这个MCP服务器让CLINE效果提升100倍!"](https://www.youtube.com/watch?v=qZfENAPMnyo)+- [Sean Kochel:"5个让编码更爽的MCP服务器(即插即用)"](https://www.youtube.com/watch?v=LqTQi8qexJM)-```json-{- "mcpServers": {- "context7": {- "command": "bunx",- "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]- }- }-}-```+## ⭐ Star 历史-#### Deno+[](https://www.star-history.com/#upstash/context7&Date)-```json-{- "mcpServers": {- "context7": {- "command": "deno",- "args": [- "run",- "--allow-env=NO_DEPRECATION,TRACE_DEPRECATION",- "--allow-net",- "npm:@upstash/context7-mcp"- ]- }- }-}-```-</details>+## 📄 许可证-<details>-<summary><b>使用 Docker</b></summary>--如果你更喜欢在 Docker 容器中运行 MCP 服务器:-1. **构建 Docker 镜像:**- 首先,在项目根目录(或任何你喜欢的地方)创建一个 `Dockerfile`:- <details>- <summary>点击查看 Dockerfile 内容</summary>-- ```Dockerfile- FROM node:18-alpine- WORKDIR /app- # 全局安装最新版本- RUN npm install -g @upstash/context7-mcp- # 如果需要,暴露默认端口(可选,取决于 MCP 客户端交互)- # EXPOSE 3000- # 运行服务器的默认命令- CMD ["context7-mcp"]- ```- </details>-- 然后,使用标签(例如,`context7-mcp`)构建镜像。**确保 Docker Desktop(或 Docker 守护进程)正在运行。** 在保存 `Dockerfile` 的同一目录中运行以下命令:- ```bash- docker build -t context7-mcp .- ```-2. **配置MCP客户端:**- 更新MCP客户端配置以使用Docker命令。- _cline_mcp_settings.json配置示例:_- ```json- {- "mcpServers": {- "Сontext7": {- "autoApprove": [],- "disabled": false,- "timeout": 60,- "command": "docker",- "args": ["run", "-i", "--rm", "context7-mcp"],- "transportType": "stdio"- }- }- }- ```- _注意:这是一个示例配置。请参考前面 README 中针对你的 MCP 客户端(如 Cursor、VS Code 等)的具体示例来调整结构(例如,`mcpServers` 与 `servers`)。另外,确保 `args` 中的镜像名称与 `docker build` 命令期间使用的标签匹配。_-</details>--<details>-<summary><b>使用桌面扩展安装</b></summary>--安装 dxt 文件夹下的 [context7.dxt](dxt/context7.dxt) 文件并将其添加到你的客户端。更多信息请查看[桌面扩展文档](https://github.com/anthropics/dxt#desktop-extensions-dxt)。-</details>--<details>-<summary><b>在 Windows 中安装</b></summary>--在 Windows 上的配置与 Linux 或 macOS 略有不同(_示例中使用了 `Cline`_), 其它编辑器同理, 参考`command`和`args`的配置即可。-```json-{- "mcpServers": {- "github.com/upstash/context7-mcp": {- "command": "cmd",- "args": ["/c", "npx", "-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"],- "disabled": false,- "autoApprove": []- }- }-}-```-</details>--<details>-<summary><b>在 Amazon Q Developer CLI 中安装</b></summary>--将以下内容添加到您的 Amazon Q Developer CLI 配置文件中。更多详情请参见 [Amazon Q Developer CLI 文档](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/command-line-mcp-configuration.html)。-```json-{- "mcpServers": {- "context7": {- "command": "npx",- "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]- }- }-}-```-</details>--<details>-<summary><b>在 Warp 中安装</b></summary>--详情请参见 [Warp 模型上下文协议文档](https://docs.warp.dev/knowledge-and-collaboration/mcp#adding-an-mcp-server)。-1. 进入 `Settings` > `AI` > `Manage MCP servers`。-2. 点击 `+ Add` 按钮,新增一个 MCP 服务器。-3. 粘贴以下配置内容:-```json-{- "Context7": {- "command": "npx",- "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"],- "env": {},- "working_directory": null,- "start_on_launch": true- }-}-```-4. 点击 `Save` 按钮以应用更改。-</details>--<details>-<summary><b>在 Copilot Coding Agent 中安装</b></summary>--## 在 Copilot Coding Agent 中使用 Context7-将以下配置添加到您的Copilot编码代理配置文件的 `mcp` 部分,路径为 Repository->Settings->Copilot->Coding agent->MCP configuration:-```json-{- "mcpServers": {- "context7": {- "type": "http",- "url": "https://mcp.context7.com/mcp",- "headers": {- "CONTEXT7_API_KEY": "YOUR_API_KEY"- },- "tools": ["query-docs", "resolve-library-id"]- }- }-}-```-更多信息请见 [官方 GitHub 文档](https://docs.github.com/zh/enterprise-cloud@latest/copilot/how-tos/agents/copilot-coding-agent/extending-copilot-coding-agent-with-mcp)。-</details>--<details>-<summary><b>在 Copilot CLI 中安装</b></summary>--1. 打开 Copilot CLI MCP 配置文件。文件位置是 `~/.copilot/mcp-config.json`(其中 `~` 是你的主目录)。-2. 将以下内容添加到 `mcp-config.json` 文件中的 `mcpServers` 对象:-```json-{- "mcpServers": {- "context7": {- "type": "http",- "url": "https://mcp.context7.com/mcp",- "headers": {- "CONTEXT7_API_KEY": "YOUR_API_KEY"- },- "tools": ["query-docs", "resolve-library-id"]- }- }-}-```-或者,对于本地服务器:-```json-{- "mcpServers": {- "context7": {- "type": "local",- "command": "npx",- "tools": ["query-docs", "resolve-library-id"],- "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]- }- }-}-```-如果 `mcp-config.json` 文件不存在,请创建它。-</details>--<details>-<summary><b>在 LM Studio 中安装</b></summary>--更多详情请参见 [LM Studio MCP 支持](https://lmstudio.ai/blog/lmstudio-v0.3.17)。--#### 一键安装:-[](https://lmstudio.ai/install-mcp?name=context7&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkB1cHN0YXNoL2NvbnRleHQ3LW1jcCJdfQ%3D%3D)--#### 手动设置:-1. 进入 `Program`(右侧)> `Install` > `Edit mcp.json`。-2. 粘贴以下配置内容:-```json-{- "mcpServers": {- "Context7": {- "command": "npx",- "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]- }- }-}-```-3. 点击 `Save` 应用更改。-4. 在右侧的 `Program` 下,或通过点击聊天框底部的插头图标,切换 MCP 服务器的开关。-</details>--<details>-<summary><b>在 Visual Studio 2022 中安装</b></summary>--您可以按照[Visual Studio MCP 服务器文档](https://learn.microsoft.com/visualstudio/ide/mcp-servers?view=vs-2022)中的说明,在 Visual Studio 2022 中配置 Context7 MCP。-将此添加到您的 Visual Studio MCP 配置文件中(详细信息请参阅[Visual Studio 文档](https://learn.microsoft.com/visualstudio/ide/mcp-servers?view=vs-2022)):-```json-{- "mcp": {- "servers": {- "context7": {- "type": "http",- "url": "https://mcp.context7.com/mcp"- }- }- }-}-```-或者,对于本地服务器:-```json-{- "mcp": {- "servers": {- "context7": {- "type": "stdio",- "command": "npx",- "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]- }- }- }-}-```-有关更多信息和故障排除,请参阅[Visual Studio MCP 服务器文档](https://learn.microsoft.com/visualstudio/ide/mcp-servers?view=vs-2022)。-</details>--<details>-<summary><b>在 Crush 中安装</b></summary>--将此添加到您的 Crush 配置文件中。更多信息请参见 [Crush MCP 文档](https://github.com/charmbracelet/crush#mcps)。-1. 转到 Zencoder 菜单 (...)-2. 从下拉菜单中选择代理工具-3. 点击添加自定义 MCP-4. 从下面添加名称和服务器配置,并确保点击安装按钮--#### Crush 远程服务器连接--```json-{- "$schema": "https://charm.land/crush.json",- "mcp": {- "context7": {- "type": "http",- "url": "https://mcp.context7.com/mcp",- "headers": {- "CONTEXT7_API_KEY": "YOUR_API_KEY"- }- }- }-}-```--#### Crush 本地服务器连接--```json-{- "$schema": "https://charm.land/crush.json",- "mcp": {- "context7": {- "type": "stdio",- "command": "npx",- "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]- }- }-}-```-</details>--<details>-<summary><b>在 BoltAI 中安装</b></summary>--打开应用的“Settings”页面,导航到“Plugins”,然后输入以下 JSON:-```json-{- "mcpServers": {- "context7": {- "command": "npx",- "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]- }- }-}-```-保存后,在聊天中输入 `query-docs`,后跟您的 Context7 文档 ID(例如,`query-docs /nuxt/ui`)。更多信息请访问 [BoltAI 的文档网站](https://docs.boltai.com/docs/plugins/mcp-servers)。有关 iOS 版 BoltAI,请参见[此指南](https://docs.boltai.com/docs/boltai-mobile/mcp-servers)。-</details>--<details>-<summary><b>在 Rovo Dev CLI 中安装</b></summary>--通过运行以下命令编辑您的 Rovo Dev CLI MCP 配置 --```bash-acli rovodev mcp-```-示例配置 ---#### 远程服务器连接--```json-{- "mcpServers": {- "context7": {- "url": "https://mcp.context7.com/mcp"- }- }-}-```--#### 本地服务器连接--```json-{- "mcpServers": {- "context7": {- "command": "npx",- "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]- }- }-}-```-</details>--<details>-<summary><b>在 Zencoder 中安装</b></summary>--要在 Zencoder 中配置 Context7 MCP,请按照以下步骤操作:-1. 进入 Zencoder 菜单(...)-2. 从下拉菜单中选择 Agent tools-3. 点击 Add custom MCP-4. 添加以下名称和服务器配置,确保点击安装按钮-```json-{- "command": "npx",- "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]-}-```-一旦添加了MCP服务器,您就可以轻松继续使用它。-</details>--<details>-<summary><b>在 Qodo Gen 中安装</b></summary>--详见 [Qodo Gen 文档](https://docs.qodo.ai/qodo-documentation/qodo-gen/qodo-gen-chat/agentic-mode/agentic-tools-mcps)。-1. 在 VSCode 或 IntelliJ 中打开 Qodo Gen 聊天面板。-2. 点击 Connect more tools 。-3. 点击 + Add new MCP 。-4. 添加以下配置:--#### Qodo Gen 本地服务器连接--```json-{- "mcpServers": {- "context7": {- "command": "npx",- "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]- }- }-}-```--#### Qodo Gen 远程服务器连接--```json-{- "mcpServers": {- "context7": {- "url": "https://mcp.context7.com/mcp"- }- }-}-```-</details>--<details>-<summary><b>在 Perplexity Desktop 中安装</b></summary>--更多信息请参阅 [Perplexity 的本地和远程 MCP](https://www.perplexity.ai/help-center/en/articles/11502712-local-and-remote-mcps-for-perplexity)。-1. 导航 `Perplexity` > `设置`-2. 选择 `连接器`。-3. 点击 `添加连接器`。-4. 选择 `高级`。-5. 输入服务器名称:`Context7`-6. 在文本区域粘贴以下 JSON:-```json-{- "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"],- "command": "npx",- "env": {}-}-```-7. 点击 `保存`。-</details>--## 🔨 可用工具-Context7 MCP 提供以下 LLM 可以使用的工具:-- `resolve-library-id`:将通用库名称解析为 Context7 兼容的库 ID。- - `query`(必需):用户的问题或任务(用于相关性排名)- - `libraryName`(必需):要搜索的库名称-- `query-docs`:使用 Context7 兼容的库 ID 获取库的文档。- - `libraryId`(必需):精确的 Context7 兼容库 ID(例如,`/mongodb/docs`、`/vercel/next.js`)- - `query`(必需):用于获取相关文档的问题或任务--## 🛟 技巧--### 添加规则-> 如果你不想在每个提示中添加 `use context7`,你可以在 Windsurf 的 `.windsurfrules` 文件中或从 Cursor 的 `Cursor Settings > Rules` 部分(或你的 MCP 客户端中的等效位置)定义一个简单规则,以在任何代码问题上自动调用 Context7:->-> ```toml-> [[calls]]-> match = "when the user requests code examples, setup or configuration steps, or library/API documentation"-> tool = "context7"-> ```->-> 从那时起,你将在任何相关对话中获得 Context7 的文档,而无需键入任何额外内容。你可以将你的用例添加到匹配部分。--### 使用库 ID-> 如果你已经确切地知道要使用哪个库,请将其 Context7 ID 添加到你的提示中。这样,Context7 MCP 服务器可以跳过库匹配步骤,直接继续检索文档。->-> ```txt-> 使用 supabase 实现基本身份验证。使用库 /supabase/supabase 获取 API 和文档-> ```->-> 斜杠语法告诉 MCP 工具确切要为哪个库加载文档。--## 💻 开发-克隆项目并安装依赖:-```bash-pnpm i-```-构建:-```bash-pnpm run build-```-运行服务器:-```bash-node packages/mcp/dist/index.js-```--### CLI 参数-`context7-mcp` 接受以下 CLI 标志:-- `--transport <stdio|http>` – 使用的传输方式(默认 `stdio`)。使用 `http` 作为远程 HTTP 服务器或 `stdio` 用于本地集成。-- `--port <number>` – 使用 `http` 传输时监听的端口(默认 `3000`)。-- `--api-key <key>` – 用于身份验证的API密钥。您可以通过在 [context7.com/dashboard](https://context7.com/dashboard) 创建账户来获取您的API密钥。-使用 http 传输和端口 8080 的示例:-```bash-node packages/mcp/dist/index.js --transport http --port 8080-```-另一个使用 stdio 传输 的示例:-```bash-node packages/mcp/dist/index.js --transport stdio --api-key YOUR_API_KEY-```-<details>-<summary><b>本地配置示例</b></summary>--```json-{- "mcpServers": {- "context7": {- "command": "npx",- "args": ["tsx", "/path/to/folder/context7-mcp/src/index.ts", "--api-key", "YOUR_API_KEY"]- }- }-}-```-</details>--<details>-<summary><b>使用 MCP Inspector 测试</b></summary>--```bash-npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp-```-</details>--## 🚨 故障排除-<details>-<summary><b>模块未找到错误(ERR_MODULE_NOT_FOUND)</b></summary>--如果你遇到 `ERR_MODULE_NOT_FOUND`,请尝试使用 `bunx` 而不是 `npx`:-```json-{- "mcpServers": {- "context7": {- "command": "bunx",- "args": ["-y", "@upstash/context7-mcp"]- }- }-}-```-这通常可以解决模块解析问题,特别是在`npx`无法正确安装或解析包的环境中。-</details>--<details>-<summary><b>ESM 解析问题</b></summary>--对于像 `Error: Cannot find module 'uriTemplate.js'` 这样的错误,请尝试 `--experimental-vm-modules` 标志:-```json-{- "mcpServers": {- "context7": {- "command": "npx",- "args": ["-y", "--node-options=--experimental-vm-modules", "@upstash/[email protected]"]- }- }-}-```-</details>--<details>-<summary><b>TLS/证书问题</b></summary>--使用 `--experimental-fetch` 标志绕过 TLS 相关问题:-```json-{- "mcpServers": {- "context7": {- "command": "npx",- "args": ["-y", "--node-options=--experimental-fetch", "@upstash/context7-mcp"]- }- }-}-```-</details>--<details>-<summary><b>通用 MCP 客户端错误</b></summary>--1. 尝试在包名中添加 `@latest` 。-2. 尝试使用`bunx`作为替代方案。-3. 尝试使用`deno`作为替代方案。-4. 确保你使用的是Node v18或更高版本,以便使用`npx`时获得原生fetch支持。-</details>--## ⚠️ 免责声明-Context7 项目由社区贡献,虽然我们努力保持高质量,但我们不能保证所有库文档的准确性、完整性或安全性。Context7 中列出的项目由其各自的所有者开发和维护,而不是由 Context7 开发和维护。如果你遇到任何可疑、不当或潜在有害的内容,请使用项目页面上的"举报"按钮立即通知我们。我们认真对待所有举报,并将及时审查标记的内容,以维护我们平台的完整性和安全性。通过使用 Context7,你承认你是自行判断和承担风险的。--## 🤝 与我们联系-保持更新并加入我们的社区:-- 📢 在 [X](https://x.com/context7ai) 上关注我们获取最新新闻和更新-- 🌐 访问我们的[网站](https://context7.com)-- 💬 加入我们的 [Discord 社区](https://upstash.com/discord)--## 📺 Context7媒体报道-- [Better Stack: "免费工具让 Cursor 智能 10 倍"](https://youtu.be/52FC3qObp9E)-- [Cole Medin: "这绝对是 AI 编码助手的最佳 MCP 服务器"](https://www.youtube.com/watch?v=G7gK8H6u7Rs)-- [Income Stream Surfers: "Context7 + SequentialThinking MCPs:这是 AGI 吗?"](https://www.youtube.com/watch?v=-ggvzyLpK6o)-- [Julian Goldie SEO: "Context7:新的 MCP AI 代理更新"](https://www.youtube.com/watch?v=CTZm6fBYisc)-- [JeredBlu: "Context 7 MCP:即时获取文档 + VS Code 设置"](https://www.youtube.com/watch?v=-ls0D-rtET4)-- [Income Stream Surfers: "Context7:将改变 AI 编码的新 MCP 服务器"](https://www.youtube.com/watch?v=PS-2Azb-C3M)-- [AICodeKing: "Context7 + Cline & RooCode:这个 MCP 服务器让 CLINE 效果提升 100 倍!"](https://www.youtube.com/watch?v=qZfENAPMnyo)-- [Sean Kochel: "5 个让编码更爽的 MCP 服务器(即插即用)"](https://www.youtube.com/watch?v=LqTQi8qexJM)--## ⭐ Star 历史-[](https://www.star-history.com/#upstash/context7&Date)--## 📄 许可证MITdiff --git a/i18n/README.zh-TW.md b/i18n/README.zh-TW.mdindex 5582e10d..41b4fef2 100644--- a/i18n/README.zh-TW.md+++ b/i18n/README.zh-TW.md@@ -1,652 +1,110 @@+++[](https://cursor.com/en/install-mcp?name=context7&config=eyJ1cmwiOiJodHRwczovL21jcC5jb250ZXh0Ny5jb20vbWNwIn0%3D)+# Context7 MCP - 即時更新的程式碼文件,適用於任何提示-[](https://context7.com) [](https://smithery.ai/server/@upstash/context7-mcp) [<img alt="在 VS Code 中安裝 (npx)" src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=安裝%20Context7%20MCP&color=0098FF">](https://insiders.vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%7B%22name%22%3A%22context7%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40upstash%2Fcontext7-mcp%40latest%22%5D%7D)+[](https://context7.com) [](https://smithery.ai/server/@upstash/context7-mcp) [](https://www.npmjs.com/package/@upstash/context7-mcp) [](./LICENSE)++[](../README.md) [](./README.zh-CN.md) [](./README.ja.md) [](./README.ko.md) [](./README.es.md) [](./README.fr.md) [-purple>)](./README.pt-BR.md) [](./README.it.md) [](./README.id-ID.md) [](./README.de.md) [](./README.ru.md) [](./README.uk.md) [](./README.tr.md) [](./README.ar.md) [](./README.vi.md)## ❌ 沒有 Context7大型語言模型(LLM)依賴過時或通用的函式庫資訊。你會遇到:-- ❌ 程式碼範例過時,僅根據一年前的訓練資料-- ❌ 產生不存在的 API-- ❌ 舊版套件的通用答案+- ❌ 程式碼範例已過時,基於一年前的訓練資料+- ❌ 產生根本不存在的幻覺 API+- ❌ 針對舊版本套件的通用回答## ✅ 有了 Context7-Context7 MCP 直接從來源拉取即時、特定版本的文件與程式碼範例,並直接放入你的提示中。-在 Cursor 的提示中加入 `use context7`:+Context7 MCP 直接從來源取得最新的、特定版本的文件與程式碼範例——並直接放入你的提示中。++在你的提示中加入 `use context7`(或[設定規則](#新增規則)自動調用):```txt-建立一個使用 app router 的基本 Next.js 專案。use context7+建立一個 Next.js 中介軟體,檢查 cookies 中的有效 JWT,+並將未認證使用者重新導向至 `/login`。use context7``````txt-根據 PostgreSQL 資訊,建立一個刪除 city 為 "" 的資料列的腳本。use context7+設定 Cloudflare Worker 腳本,將 JSON API 回應+快取五分鐘。use context7```-Context7 會將即時的程式碼範例與文件直接帶入你的 LLM 上下文。--- 1️⃣ 自然地撰寫你的提示-- 2️⃣ 告訴 LLM `use context7`-- 3️⃣ 取得可執行的程式碼解答- 不需切換分頁、不會產生不存在的 API、不會有過時的程式碼。--## 📚 新增專案--請參考我們的[專案新增指南](./adding-projects.md),學習如何將你喜愛的函式庫加入 Context7 或更新其內容。+Context7 將最新的程式碼範例與文件直接取得到你的 LLM 上下文中。不需切換分頁、不會產生不存在的幻覺 API、不會產生過時的程式碼。-## 🛠️ 安裝+## 安裝-### 系統需求+> [!NOTE]+> **建議使用 API 金鑰**:在 [context7.com/dashboard](https://context7.com/dashboard) 取得免費 API 金鑰,可獲得更高的請求速率限制。-- Node.js >= v18.0.0-- Cursor、Windsurf、Claude Desktop 或其他 MCP 客戶端<details>-<summary><b>透過 Smithery 安裝</b></summary>--要透過 [Smithery](https://smithery.ai/server/@upstash/context7-mcp) 自動安裝 Context7 MCP Server:--```bash-npx -y @smithery/cli@latest install @upstash/context7-mcp --client <CLIENT_NAME> --key <YOUR_SMITHERY_KEY>-```--你的 Smithery 金鑰可在 [Smithery.ai 網頁](https://smithery.ai/server/@upstash/context7-mcp) 取得。--</details>--<details>-<summary><b>在 Cursor 安裝</b></summary>+<summary><b>在 Cursor 中安裝</b></summary>前往:`Settings` -> `Cursor Settings` -> `MCP` -> `Add new global MCP server`-建議將下列設定貼到你的 Cursor `~/.cursor/mcp.json` 檔案。你也可以在專案資料夾建立 `.cursor/mcp.json` 進行專案安裝。詳見 [Cursor MCP 文件](https://docs.cursor.com/context/model-context-protocol)。--#### Cursor 遠端伺服器連線--```json-{- "mcpServers": {- "context7": {- "url": "https://mcp.context7.com/mcp"- }- }-}-```--#### Cursor 本地伺服器連線-[](https://cursor.com/install-mcp?name=context7&config=eyJjb21tYW5kIjoibnB4IC15IEB1cHN0YXNoL2NvbnRleHQ3LW1jcCJ9)-```json-{- "mcpServers": {- "context7": {- "command": "npx",- "args": ["-y", "@upstash/context7-mcp"]- }- }-}-```-<details>-<summary>替代方案:使用 Bun</summary>--[](https://cursor.com/install-mcp?name=context7&config=eyJjb21tYW5kIjoiYnVueCAteSBAdXBzdGFzaC9jb250ZXh0Ny1tY3AifQ%3D%3D)-```json-{- "mcpServers": {- "context7": {- "command": "bunx",- "args": ["-y", "@upstash/context7-mcp"]- }- }-}-```-</details>--<details>-<summary>替代方案:使用 Deno</summary>--[](https://cursor.com/install-mcp?name=context7&config=eyJjb21tYW5kIjoiZGVubyBydW4gLS1hbGxvdy1lbnYgLS1hbGxvdy1uZXQgbnBtOkB1cHN0YXNoL2NvbnRleHQ3LW1jcCJ9)-```json-{- "mcpServers": {- "context7": {- "command": "deno",- "args": ["run", "--allow-env", "--allow-net", "npm:@upstash/context7-mcp"]- }- }-}-```-</details>--</details>--<details>-<summary><b>在 Windsurf 安裝</b></summary>-將下列內容加入 Windsurf MCP 設定檔。詳見 [Windsurf MCP 文件](https://docs.windsurf.com/windsurf/mcp)。+建議將下列設定貼到你的 Cursor `~/.cursor/mcp.json` 檔案中。你也可以透過在專案資料夾中建立 `.cursor/mcp.json` 在特定專案中安裝。更多資訊請參閱 [Cursor MCP 文件](https://docs.cursor.com/context/model-context-protocol)。-#### Windsurf 遠端伺服器連線+> 自 Cursor 1.0 起,你可以點擊下方的安裝按鈕進行即時一鍵安裝。-```json-{- "mcpServers": {- "context7": {- "serverUrl": "https://mcp.context7.com/mcp"- }- }-}-```+#### Cursor 遠端伺服器連線-#### Windsurf 本地伺服器連線+[](https://cursor.com/en/install-mcp?name=context7&config=eyJ1cmwiOiJodHRwczovL21jcC5jb250ZXh0Ny5jb20vbWNwIn0%3D)```json{"mcpServers": {"context7": {- "command": "npx",- "args": ["-y", "@upstash/context7-mcp"]+ "url": "https://mcp.context7.com/mcp",+ "headers": {+ "CONTEXT7_API_KEY": "YOUR_API_KEY"+ }}}}```-</details>--<details>-<summary><b>在 Trae 安裝</b></summary>-請使用「手動新增」功能,並填寫該 MCP 伺服器的 JSON 設定資訊。-欲了解更多詳情,請參閱 [Trae 文件](https://docs.trae.ai/ide/model-context-protocol?_lang=zh-tw)。--#### Trae 遠端伺服器連線--```json-{- "mcpServers": {- "context7": {- "url": "https://mcp.context7.com/mcp"- }- }-}-```+#### Cursor 本地伺服器連線-#### Trae 本地伺服器連線+[](https://cursor.com/en/install-mcp?name=context7&config=eyJjb21tYW5kIjoibnB4IC15IEB1cHN0YXNoL2NvbnRleHQ3LW1jcCJ9)```json{"mcpServers": {"context7": {- "command": "npx",- "args": ["-y", "@upstash/context7-mcp"]- }- }-}-```-</details>--<details>-<summary><b>在 VS Code 安裝</b></summary>--[<img alt="在 VS Code 中安裝 (npx)" src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=安裝Context7%20MCP&color=0098FF">](https://insiders.vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%7B%22name%22%3A%22context7%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40upstash%2Fcontext7-mcp%40latest%22%5D%7D)-[<img alt="在 VS Code Insiders 中安裝 (npx)" src="https://img.shields.io/badge/VS_Code_Insiders-VS_Code_Insiders?style=flat-square&label=安裝Context7%20MCP&color=24bfa5">](https://insiders.vscode.dev/redirect?url=vscode-insiders%3Amcp%2Finstall%3F%7B%22name%22%3A%22context7%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40upstash%2Fcontext7-mcp%40latest%22%5D%7D)-將下列內容加入 VS Code MCP 設定檔。詳見 [VS Code MCP 文件](https://code.visualstudio.com/docs/copilot/chat/mcp-servers)。--#### VS Code 遠端伺服器連線--```json-"mcp": {- "servers": {- "context7": {- "type": "http",- "url": "https://mcp.context7.com/mcp"- }- }-}-```--#### VS Code 本地伺服器連線--```json-"mcp": {- "servers": {- "context7": {- "type": "stdio",- "command": "npx",- "args": ["-y", "@upstash/context7-mcp"]- }- }-}-```-</details>--<details>-<summary><b>在 Visual Studio 2022 安裝</b></summary>--您可以按照 [Visual Studio MCP 伺服器文件](https://learn.microsoft.com/visualstudio/ide/mcp-servers?view=vs-2022) 的說明,在 Visual Studio 2022 中設定 Context7 MCP。-請將以下內容新增至您的 Visual Studio MCP 設定檔(詳細資訊請參閱 [Visual Studio 文件](https://learn.microsoft.com/visualstudio/ide/mcp-servers?view=vs-2022)):-```json-{- "mcp": {- "servers": {- "context7": {- "type": "http",- "url": "https://mcp.context7.com/mcp"- }- }- }-}-```-或者,若要使用本地伺服器:-```json-{- "mcp": {- "servers": {- "context7": {- "type": "stdio",- "command": "npx",- "args": ["-y", "@upstash/context7-mcp"]- }- }- }-}-```-如需更多資訊與疑難排解,請參閱 [Visual Studio MCP 伺服器文件](https://learn.microsoft.com/visualstudio/ide/mcp-servers?view=vs-2022)。-</details>--<details>-<summary><b>在 Zed 安裝</b></summary>--可透過 [Zed 擴充套件](https://zed.dev/extensions?query=Context7) 安裝,或將下列內容加入 Zed `settings.json`。詳見 [Zed Context Server 文件](https://zed.dev/docs/assistant/context-servers)。-```json-{- "context_servers": {- "Context7": {- "source": "custom","command": "npx","args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]}}}```-</details>--<details>-<summary><b>在 Gemini CLI 安裝</b></summary>-詳閱 [Gemini CLI 設定說明](https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/configuration.md)。-1. 開啟 Gemini CLI 設定檔,位置為 `~/.gemini/settings.json`(其中 `~` 代表您的家目錄)。-2. 在您的 `settings.json` 檔案中的 `mcpServers` 物件內新增以下內容:-```json-{- "mcpServers": {- "context7": {- "httpUrl": "https://mcp.context7.com/mcp"- }- }-}-```-或者,若要使用本地伺服器:-```json-{- "mcpServers": {- "context7": {- "command": "npx",- "args": ["-y", "@upstash/context7-mcp"]- }- }-}-```-如果 `mcpServers` 物件不存在,請建立它。</details><details>-<summary><b>在 Claude Code 安裝</b></summary>+<summary><b>在 Claude Code 中安裝</b></summary>-執行下列指令。詳見 [Claude Code MCP 文件](https://docs.anthropic.com/zh-TW/docs/claude-code/mcp)。+執行下列指令。更多資訊請參見 [Claude Code MCP 文件](https://code.claude.com/docs/en/mcp)。#### Claude Code 本地伺服器連線```sh-claude mcp add context7 -- npx -y @upstash/context7-mcp+claude mcp add context7 -- npx -y @upstash/context7-mcp --api-key YOUR_API_KEY```#### Claude Code 遠端伺服器連線```sh-claude mcp add --transport http context7 https://mcp.context7.com/mcp+claude mcp add --header "CONTEXT7_API_KEY: YOUR_API_KEY" --transport http context7 https://mcp.context7.com/mcp```-</details>--<details>-<summary><b>在 Claude Desktop 安裝</b></summary>-將下列內容加入 Claude Desktop `claude_desktop_config.json`。詳見 [Claude Desktop MCP 文件](https://modelcontextprotocol.io/quickstart/user)。-```json-{- "mcpServers": {- "Context7": {- "command": "npx",- "args": ["-y", "@upstash/context7-mcp"]- }- }-}-```</details><details>-<summary>-<b>在 Cline 安裝</b>-</summary>--您可以按照以下說明,透過 [Cline MCP 伺服器市集](https://cline.bot/mcp-marketplace) 輕鬆安裝 Context7:-1. 開啟 **Cline**。-2. 點擊選單圖示(☰)進入 **MCP 伺服器** 區段。-3. 在 **市集** 分頁的搜尋欄中尋找 _Context7_。-4. 點擊 **安裝** 按鈕。-您也可以直接修改 MCP servers 設定檔案:-1. 開啟 Cline。-2. 點擊選單圖示 (☰),進入 MCP 伺服器部分。-3. 選擇遠端伺服器標籤。-4. 點擊編輯設定按鈕。-5. 將 context7 相關設定新增至 mcpServers:-```json-{- "mcpServers": {- "context7": {- "url": "https://mcp.context7.com/mcp",- "type": "streamableHttp",- "headers": {- "Authorization": "Bearer YOUR_API_KEY"- }- }- }-}-```-</details>+<summary><b>在 Opencode 中安裝</b></summary>-<details>-<summary><b>在 BoltAI 安裝</b></summary>--打開應用程式的「Settings」頁面,前往「Plugins」,並輸入下列 JSON:-```json-{- "mcpServers": {- "context7": {- "command": "npx",- "args": ["-y", "@upstash/context7-mcp"]- }- }-}-```-儲存後,在聊天中輸入 `query-docs` 並接上你的 Context7 文件 ID(例如 `query-docs /nuxt/ui`)。更多資訊請參考 [BoltAI 文件網站](https://docs.boltai.com/docs/plugins/mcp-servers)。如在 iOS 上使用 BoltAI,請參考[此指南](https://docs.boltai.com/docs/boltai-mobile/mcp-servers)。-</details>--<details>-<summary><b>在 Copilot Coding Agent 安裝</b></summary>--## 在 Copilot Coding Agent 使用 Context7-請將以下設定加入 Copilot Coding Agent 的 `mcp` 設定區塊(Repository->Settings->Copilot->Coding agent->MCP configuration):-```json-{- "mcpServers": {- "context7": {- "type": "http",- "url": "https://mcp.context7.com/mcp",- "tools": ["query-docs", "resolve-library-id"]- }- }-}-```-更多資訊請參見[官方 GitHub 文件](https://docs.github.com/en/enterprise-cloud@latest/copilot/how-tos/agents/copilot-coding-agent/extending-copilot-coding-agent-with-mcp)。-</details>--<details>-<summary><b>在 Copilot CLI 中安裝</b></summary>--1. 打開 Copilot CLI MCP 設定檔。位置為 `~/.copilot/mcp-config.json`(其中 `~` 是您的主目錄)。-2. 在 `mcp-config.json` 檔案中的 `mcpServers` 物件新增下列内容:-```json-{- "mcpServers": {- "context7": {- "type": "http",- "url": "https://mcp.context7.com/mcp",- "headers": {- "CONTEXT7_API_KEY": "YOUR_API_KEY"- },- "tools": ["query-docs", "resolve-library-id"]- }- }-}-```-或者,對於本地伺服器:-```json-{- "mcpServers": {- "context7": {- "type": "local",- "command": "npx",- "tools": ["query-docs", "resolve-library-id"],- "args": ["-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"]- }- }-}-```-如果 `mcp-config.json` 檔案不存在,請建立它。-</details>--<details>-<summary><b>使用 Docker</b></summary>--若你偏好在 Docker 容器中執行 MCP 伺服器:-1. **建立 Docker 映像檔:**- 先在專案根目錄(或任意位置)建立 `Dockerfile`:- <details>- <summary>點擊查看 Dockerfile 內容</summary>-- ```Dockerfile- FROM node:18-alpine- WORKDIR /app- # 全域安裝最新版- RUN npm install -g @upstash/context7-mcp- # 如有需要可開放預設埠(視 MCP 客戶端互動而定)- # EXPOSE 3000- # 預設啟動指令- CMD ["context7-mcp"]- ```- </details>-- 然後使用標籤(如 `context7-mcp`)建構映像檔。**請確保 Docker Desktop(或 Docker daemon)已啟動。**在存有 `Dockerfile` 的目錄執行:- ```bash- docker build -t context7-mcp .- ```-2. **設定 MCP 客戶端:**- 更新 MCP 客戶端設定以使用 Docker 指令。- _cline_mcp_settings.json 範例:_- ```json- {- "mcpServers": {- "Сontext7": {- "autoApprove": [],- "disabled": false,- "timeout": 60,- "command": "docker",- "args": ["run", "-i", "--rm", "context7-mcp"],- "transportType": "stdio"- }- }- }- ```- _注意:這是範例設定。請參考前述各 MCP 客戶端(如 Cursor、VS Code 等)的範例調整結構(如 `mcpServers` 與 `servers`)。同時確保 `args` 中的映像名稱與 `docker build` 使用的標籤一致。_-</details>--<details>-<summary><b>在 Windows 安裝</b></summary>--Windows 的設定與 Linux 或 macOS 略有不同(_範例以 Cline 為例_)。其他編輯器同理,請參考 `command` 與 `args` 設定。-```json-{- "mcpServers": {- "github.com/upstash/context7-mcp": {- "command": "cmd",- "args": ["/c", "npx", "-y", "@upstash/context7-mcp@latest"],- "disabled": false,- "autoApprove": []- }- }-}-```-</details>--<details>-<summary><b>在 Augment Code 安裝</b></summary>--在 Augment Code 設定 Context7 MCP,請依下列步驟:-1. 按 Cmd/Ctrl Shift P 或於 Augment 面板的漢堡選單中選擇-2. 選擇 Edit Settings-3. 於 Advanced 下點選 Edit in settings.json-4. 將伺服器設定加入 `augment.advanced` 物件的 `mcpServers` 陣列-```json-"augment.advanced": {- "mcpServers": [- {- "name": "context7",- "command": "npx",- "args": ["-y", "@upstash/context7-mcp"]- }- ]-}-```-加入 MCP 伺服器後,請重啟編輯器。如遇錯誤,請檢查語法是否有遺漏括號或逗號。-</details>--<details>-<summary><b>在 Roo Code 安裝</b></summary>--將以下內容加入你的 Roo Code MCP 設定檔。更多資訊請參考 [Roo Code MCP 文件](https://docs.roocode.com/features/mcp/using-mcp-in-roo)。--#### Roo Code 遠端伺服器連線--```json-{- "mcpServers": {- "context7": {- "type": "streamable-http",- "url": "https://mcp.context7.com/mcp"- }- }-}-```--#### Roo Code 本地伺服器連線--```json-{- "mcpServers": {- "context7": {- "command": "npx",- "args": ["-y", "@upstash/context7-mcp"]- }- }-}-```-</details>--<details>-<summary><b>在 Zencoder 安裝</b></summary>--要在 Zencoder 設定 Context7 MCP,請依照下列步驟操作:-1. 前往 Zencoder 選單(...)-2. 從下拉選單選擇 Agent tools-3. 點擊 Add custom MCP-4. 輸入名稱與下方伺服器設定,並記得點擊 Install 按鈕-```json-{- "command": "npx",- "args": ["-y", "@upstash/context7-mcp@latest"]-}-```-新增 MCP 伺服器後,即可繼續使用。-</details>--<details>-<summary><b>在 Amazon Q Developer CLI 安裝</b></summary>--將以下內容加入你的 Amazon Q Developer CLI 設定檔。更多細節請參考 [Amazon Q Developer CLI 文件](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/command-line-mcp-configuration.html)。-```json-{- "mcpServers": {- "context7": {- "command": "npx",- "args": ["-y", "@upstash/context7-mcp@latest"]- }- }-}-```-</details>--<details>-<summary><b>在 Qodo Gen 安裝</b></summary>--詳情請參考 [Qodo Gen 文件](https://docs.qodo.ai/qodo-documentation/qodo-gen/qodo-gen-chat/agentic-mode/agentic-tools-mcps)。-1. 在 VSCode 或 IntelliJ 開啟 Qodo Gen 聊天面板。-2. 點擊 Connect more tools。-3. 點擊 + Add new MCP。-4. 加入以下設定:-```json-{- "mcpServers": {- "context7": {- "url": "https://mcp.context7.com/mcp"- }- }-}-```-</details>--<details>-<summary><b>在 JetBrains AI Assistant 安裝</b></summary>--詳情請參考 [JetBrains AI Assistant 文件](https://www.jetbrains.com/help/ai-assistant/configure-an-mcp-server.html)。-1. 在 JetBrains IDE 前往 `Settings` -> `Tools` -> `AI Assistant` -> `Model Context Protocol (MCP)`-2. 點擊 `+ Add`-3. 在對話框左上角點擊 `Command` 並選擇 As JSON-4. 輸入以下設定並點擊 `OK`-```json-{- "mcpServers": {- "context7": {- "command": "npx",- "args": ["-y", "@upstash/context7-mcp"]- }- }-}-```-5. 點擊 `Apply` 儲存變更。-6. 同樣方式也可在 JetBrains Junie 的 `Settings` -> `Tools` -> `Junie` -> `MCP Settings` 新增 context7。-</details>--<details>-<summary><b>在 Warp 安裝</b></summary>--詳情請參考 [Warp Model Context Protocol 文件](https://docs.warp.dev/knowledge-and-collaboration/mcp#adding-an-mcp-server)。-1. 前往 `Settings` > `AI` > `Manage MCP servers`-2. 點擊 `+ Add` 新增 MCP 伺服器-3. 貼上以下設定:-```json-{- "Context7": {- "command": "npx",- "args": ["-y", "@upstash/context7-mcp"],- "env": {},- "working_directory": null,- "start_on_launch": true- }-}-```-4. 點擊 `Save` 套用變更。-</details>--<details>-<summary><b>在 Opencode 安裝</b></summary>--將以下內容加入你的 Opencode 設定檔。更多資訊請參考 [Opencode MCP 文件](https://opencode.ai/docs/mcp-servers)。+將此內容加入你的 Opencode 設定檔。更多資訊請參見 [Opencode MCP 文件](https://opencode.ai/docs/mcp-servers)。#### Opencode 遠端伺服器連線@@ -655,6 +113,9 @@ Windows 的設定與 Linux 或 macOS 略有不同(_範例以 Cline 為例_)"context7": {"type": "remote","url": "https://mcp.context7.com/mcp",+ "headers": {+ "CONTEXT7_API_KEY": "YOUR_API_KEY"+ },"enabled": true}}@@ -667,206 +128,118 @@ Windows 的設定與 Linux 或 macOS 略有不同(_範例以 Cline 為例_)"mcp": {"context7": {"type": "local",- "command": ["npx", "-y", "@upstash/context7-mcp"],+ "command": ["npx", "-y", "@upstash/context7-mcp", "--api-key", "YOUR_API_KEY"],"enabled": true}}}```-</details>--<details>-<summary><b>在 Kiro 安裝</b></summary>-詳情請參考 [Kiro Model Context Protocol 文件](https://kiro.dev/docs/mcp/configuration/)。-1. 前往 `Kiro` > `MCP Servers`-2. 點擊 `+ Add` 按鈕新增 MCP 伺服器。-3. 貼上以下設定:-```json-{- "mcpServers": {- "Context7": {- "command": "npx",- "args": ["-y", "@upstash/context7-mcp"],- "env": {},- "disabled": false,- "autoApprove": []- }- }-}-```-4. 點擊 `Save` 套用變更。</details>+**[其他 IDE 和客戶端 →](https://context7.com/docs/resources/all-clients)**+<details>-<summary><b>在 OpenAI Codex 安裝</b></summary>+<summary><b>OAuth 認證</b></summary>-詳情請參考 [OpenAI Codex](https://github.com/openai/codex)。-將下列設定加入你的 OpenAI Codex MCP 伺服器設定:+Context7 MCP 伺服器支援 OAuth 2.0 認證,適用於實作了 [MCP OAuth 規範](https://modelcontextprotocol.io/specification/2025-03-26/basic/authorization)的 MCP 客戶端。-#### 本地伺服器連接+要使用 OAuth,請在客戶端設定中將端點從 `/mcp` 更改為 `/mcp/oauth`:-```toml-[mcp_servers.context7]-args = ["-y", "@upstash/context7-mcp"]-command = "npx"+```diff+- "url": "https://mcp.context7.com/mcp"++ "url": "https://mcp.context7.com/mcp/oauth"```-#### 遠端伺服器連接+OAuth 僅適用於遠端 HTTP 連線。對於使用 stdio 傳輸的本地 MCP 連線,請改用 API 金鑰認證。-```toml-[mcp_servers.context7]-url = "https://mcp.context7.com/mcp"-http_headers = { "CONTEXT7_API_KEY" = "YOUR_API_KEY" }-```</details>-<details>-<summary><b>在 LM Studio 安裝</b></summary>+## 重要提示-詳情請參考 [LM Studio MCP 支援](https://lmstudio.ai/blog/lmstudio-v0.3.17)。+### 新增規則-#### 一鍵安裝:-[](https://lmstudio.ai/install-mcp?name=context7&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkB1cHN0YXNoL2NvbnRleHQ3LW1jcCJdfQ%3D%3D)+為避免每次都在提示中輸入 `use context7`,你可以在 MCP 客戶端中新增規則,自動為程式碼相關問題調用 Context7:-#### 手動設定:-1. 前往 `Program`(右側)> `Install` > `Edit mcp.json`-2. 貼上以下設定:-```json-{- "mcpServers": {- "Context7": {- "command": "npx",- "args": ["-y", "@upstash/context7-mcp"]- }- }-}-```-3. 點擊 `Save` 套用變更。-4. 可於右側 `Program` 下方或聊天框底部的插頭圖示切換 MCP 伺服器開關。-</details>+- **Cursor**:`Cursor Settings > Rules`+- **Claude Code**:`CLAUDE.md`+- 或你的 MCP 客戶端中的等效設定-## 🔨 可用工具-Context7 MCP 提供下列工具供 LLM 使用:-- `resolve-library-id`:將一般函式庫名稱解析為 Context7 相容的函式庫 ID。- - `query`(必填):使用者的問題或任務(用於相關性排名)- - `libraryName`(必填):要查詢的函式庫名稱-- `query-docs`:根據 Context7 相容的函式庫 ID 取得文件。- - `libraryId`(必填):Context7 相容的函式庫 ID(如 `/mongodb/docs`, `/vercel/next.js`)- - `query`(必填):用於取得相關文件的問題或任務+**規則範例:**-## 💻 開發-複製專案並安裝依賴:-```bash-pnpm i-```-建置:-```bash-pnpm run build+```txt+當我需要函式庫/API 文件、程式碼產生、設定或設定步驟時,始終使用 Context7 MCP,無需我明確要求。```-<details>-<summary><b>本地設定範例</b></summary>-```json-{- "mcpServers": {- "context7": {- "command": "npx",- "args": ["tsx", "/path/to/folder/context7-mcp/src/index.ts"]- }- }-}-```-</details>+### 使用函式庫 ID-<details>-<summary><b>使用 MCP Inspector 測試</b></summary>+如果你已經確切知道要使用哪個函式庫,請將其 Context7 ID 加入你的提示中。這樣,Context7 MCP 伺服器可以跳過函式庫匹配步驟,直接取得文件。-```bash-npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp+```txt+使用 Supabase 實作基本身分驗證。use library /supabase/supabase 取得 API 和文件。```-</details>-## 🚨 疑難排解-<details>-<summary><b>找不到模組錯誤</b></summary>+斜線語法告訴 MCP 工具確切要為哪個函式庫載入文件。-若遇到 `ERR_MODULE_NOT_FOUND`,請嘗試用 `bunx` 取代 `npx`:-```json-{- "mcpServers": {- "context7": {- "command": "bunx",- "args": ["-y", "@upstash/context7-mcp"]- }- }-}-```-這通常能解決 `npx` 無法正確安裝或解析套件的問題。-</details>+### 指定版本-<details>-<summary><b>ESM 解析問題</b></summary>+要取得特定函式庫版本的文件,只需在提示中提及版本:-若出現 `Error: Cannot find module 'uriTemplate.js'`,請嘗試加上 `--experimental-vm-modules` 參數:-```json-{- "mcpServers": {- "context7": {- "command": "npx",- "args": ["-y", "--node-options=--experimental-vm-modules", "@upstash/[email protected]"]- }- }-}+```txt+如何設定 Next.js 14 中介軟體?use context7```-</details>-<details>-<summary><b>TLS/憑證問題</b></summary>+Context7 將自動匹配適當的版本。-可加上 `--experimental-fetch` 參數繞過 TLS 問題:-```json-{- "mcpServers": {- "context7": {- "command": "npx",- "args": ["-y", "--node-options=--experimental-fetch", "@upstash/context7-mcp"]- }- }-}-```-</details>+## 可用工具-<details>-<summary><b>一般 MCP 客戶端錯誤</b></summary>+Context7 MCP 提供下列 LLM 可使用的工具:-1. 嘗試加上 `@latest` 於套件名稱-2. 改用 `bunx` 取代 `npx`-3. 或改用 `deno`-4. 請確認 Node.js 版本為 v18 或以上,以支援原生 fetch-</details>+- `resolve-library-id`:將通用函式庫名稱解析為 Context7 相容的函式庫 ID。+ - `query`(必填):使用者的問題或任務(用於按相關性排名結果)+ - `libraryName`(必填):要搜尋的函式庫名稱++- `query-docs`:使用 Context7 相容的函式庫 ID 取得函式庫的文件。+ - `libraryId`(必填):精確的 Context7 相容函式庫 ID(例如 `/mongodb/docs`、`/vercel/next.js`)+ - `query`(必填):用於取得相關文件的問題或任務++## 更多文件++- [更多 MCP 客戶端](https://context7.com/docs/resources/all-clients) - 30+ 客戶端的安裝說明+- [新增函式庫](https://context7.com/docs/adding-libraries) - 將你的函式庫提交到 Context7+- [疑難排解](https://context7.com/docs/resources/troubleshooting) - 常見問題與解決方案+- [API 參考](https://context7.com/docs/api-guide) - REST API 文件+- [開發者指南](https://context7.com/docs/resources/developer) - 本地執行 Context7 MCP++## 免責聲明-## ⚠️ 免責聲明-Context7 專案由社群貢獻,雖然我們致力於維持高品質,但無法保證所有函式庫文件的正確性、完整性或安全性。Context7 上的專案由各自擁有者開發與維護,非 Context7 官方。若發現可疑、不當或潛在有害內容,請於專案頁面點選「檢舉」按鈕通知我們。我們會嚴肅處理所有檢舉,並盡快審查標記內容,以維護平台的完整性與安全。使用 Context7 即表示你同意自行承擔風險。+1- Context7 專案由社群貢獻,雖然我們致力於維持高品質,但我們無法保證所有函式庫文件的準確性、完整性或安全性。Context7 中列出的專案由其各自擁有者開發和維護,而非由 Context7 開發和維護。如果你遇到任何可疑、不當或潛在有害的內容,請使用專案頁面上的「檢舉」按鈕立即通知我們。我們認真對待所有檢舉,並將及時審查標記的內容,以維護我們平台的完整性和安全性。使用 Context7 即表示你承認自行承擔風險。++2- 本儲存庫託管 MCP 伺服器的原始碼。支援元件——API 後端、解析引擎和爬取引擎——是私有的,不包含在本儲存庫中。## 🤝 與我們聯繫-歡迎追蹤與加入社群:-- 📢 追蹤我們的 [X](https://x.com/contextai) 以獲取最新消息-- 🌐 造訪我們的 [官方網站](https://context7.com)++保持更新並加入我們的社群:++- 📢 在 [X](https://x.com/context7ai) 上追蹤我們取得最新消息和更新+- 🌐 造訪我們的[網站](https://context7.com)- 💬 加入我們的 [Discord 社群](https://upstash.com/discord)## 📺 Context7 媒體報導-- [Better Stack:「免費工具讓 Cursor 智慧提升 10 倍」](https://youtu.be/52FC3qObp9E)++- [Better Stack:「免費工具讓 Cursor 智慧 10 倍」](https://youtu.be/52FC3qObp9E)- [Cole Medin:「這絕對是 AI 程式助理最強 MCP 伺服器」](https://www.youtube.com/watch?v=G7gK8H6u7Rs)- [Income Stream Surfers:「Context7 + SequentialThinking MCPs:這是 AGI 嗎?」](https://www.youtube.com/watch?v=-ggvzyLpK6o)- [Julian Goldie SEO:「Context7:全新 MCP AI 代理更新」](https://www.youtube.com/watch?v=CTZm6fBYisc)-- [JeredBlu:「Context 7 MCP:即時獲取文件 + VS Code 設定」](https://www.youtube.com/watch?v=-ls0D-rtET4)+- [JeredBlu:「Context 7 MCP:即時取得文件 + VS Code 設定」](https://www.youtube.com/watch?v=-ls0D-rtET4)- [Income Stream Surfers:「Context7:將改變 AI 程式開發的新 MCP 伺服器」](https://www.youtube.com/watch?v=PS-2Azb-C3M)- [AICodeKing:「Context7 + Cline & RooCode:這個 MCP 伺服器讓 CLINE 效率提升 100 倍!」](https://www.youtube.com/watch?v=qZfENAPMnyo)-- [Sean Kochel:「5 個 MCP 伺服器讓你程式開發如虎添翼(即插即用)」](https://www.youtube.com/watch?v=LqTQi8qexJM)+- [Sean Kochel:「5 個讓程式開發如虎添翼的 MCP 伺服器(即插即用)」](https://www.youtube.com/watch?v=LqTQi8qexJM)++## ⭐ Star 歷史-## ⭐ 星標歷史-[](https://www.star-history.com/#upstash/context7&Date)+[](https://www.star-history.com/#upstash/context7&Date)## 📄 授權+MIT