mirror of
https://github.com/upstash/context7.git
synced 2025-06-26 23:50:04 +00:00
docs(zh-CN): Update installation guides and translations
This commit is contained in:
parent
be1aa31066
commit
73d6e06f86
@ -2,7 +2,7 @@
|
||||
|
||||
[](https://context7.com) [](https://smithery.ai/server/@upstash/context7-mcp)
|
||||
|
||||
## ❌ 不使用Context7时
|
||||
## ❌ 不使用Context7
|
||||
|
||||
大语言模型(LLM)可能依赖过时或通用的库信息。你可能会遇到:
|
||||
|
||||
@ -10,27 +10,27 @@
|
||||
- ❌ 幻觉产生的API根本不存在
|
||||
- ❌ 针对旧版本包的通用回答
|
||||
|
||||
## ✅ 使用Context7时
|
||||
## ✅ 使用Context7
|
||||
|
||||
Context7 MCP直接从源头获取最新的、特定版本的文档和代码示例 — 并将它们直接放入你的提示中。
|
||||
|
||||
在Cursor中添加`use context7`到你的提示:
|
||||
在Cursor中添加`使用 context7`到你的提示:
|
||||
|
||||
```txt
|
||||
创建一个使用app router的基本Next.js项目。use context7
|
||||
创建一个使用app router的基本Next.js项目。使用 context7
|
||||
```
|
||||
|
||||
```txt
|
||||
创建一个脚本,删除PostgreSQL数据库中city字段为""的行。use context7
|
||||
创建一个脚本,删除PostgreSQL数据库中city字段为""的行。使用 context7
|
||||
```
|
||||
|
||||
Context7将最新的代码示例和文档直接获取到你的LLM上下文中。
|
||||
|
||||
- 1️⃣ 按照往常,自然地编写你的提示
|
||||
- 2️⃣ 告诉LLM使用`use context7`
|
||||
- 3️⃣ 获取可用的代码答案
|
||||
- 2️⃣ 告诉LLM`使用 context7`
|
||||
- 3️⃣ 获取可用的代码回复
|
||||
|
||||
无需在标签间切换,没有不存在的幻觉API,没有过时的代码生成。
|
||||
无需在标签间切换,不存在幻觉API,不会生成过时的代码。
|
||||
|
||||
## 🛠️ 开始使用
|
||||
|
||||
@ -113,6 +113,9 @@ npx -y @smithery/cli install @upstash/context7-mcp --client claude
|
||||
|
||||
### 在VSCode中安装
|
||||
|
||||
[<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%257B%2522name%2522%253A%2522context7%2522%252C%2522config%2522%253A%257B%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522-y%2522%252C%2522%2540upstash%252Fcontext7-mcp%2540latest%2522%255D%257D%257D)
|
||||
[<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%257B%2522name%2522%253A%2522context7%2522%252C%2522config%2522%253A%257B%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522-y%2522%252C%2522%2540upstash%252Fcontext7-mcp%2540latest%2522%255D%257D%257D)
|
||||
|
||||
将此内容添加到你的VSCode MCP配置文件中。更多信息请参见[VSCode MCP文档](https://code.visualstudio.com/docs/copilot/chat/mcp-servers)。
|
||||
|
||||
```json
|
||||
@ -150,6 +153,44 @@ claude mcp add context7 -- npx -y @upstash/context7-mcp@latest
|
||||
}
|
||||
```
|
||||
|
||||
### 使用Docker(容器部署)
|
||||
|
||||
如果你希望使用Docker容器运行MCP服务器:
|
||||
|
||||
1. **构建Docker镜像:**
|
||||
|
||||
**确保Docker Desktop(或Docker守护进程)正在运行。** 在项目根目录运行:
|
||||
|
||||
```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"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
*注意事项:*
|
||||
<em>
|
||||
- 此为示例配置。请参考前面README中针对具体MCP客户端(如Cursor、VS Code等)的示例来调整结构(如`mcpServers`与`servers`)。同时确保`args`中的镜像名称与`docker build`命令使用的标签一致。
|
||||
- 当前Cursor版本(0.49.5), 请不要使用本方式启动MCP server,详情:[Cursor官方说明](https://docs.cursor.com/context/model-context-protocol#remote-development)
|
||||
</em>
|
||||
|
||||
### 可用工具
|
||||
|
||||
- `resolve-library-id`: 将通用库名称解析为Context7兼容的库ID。
|
||||
@ -192,6 +233,7 @@ bun run build
|
||||
npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp@latest
|
||||
```
|
||||
|
||||
|
||||
## 故障排除
|
||||
|
||||
### ERR_MODULE_NOT_FOUND
|
||||
@ -226,6 +268,7 @@ npx -y @modelcontextprotocol/inspector npx @upstash/context7-mcp@latest
|
||||
- [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)
|
||||
|
||||
## Star历史
|
||||
|
Loading…
x
Reference in New Issue
Block a user