Deepwiki MCP服务器
⚠️ 重要通知:此服务器当前无法工作,因为DeepWiki已切断了抓取它的可能性。我们建议使用官方DeepWiki MCP服务器https://docs.devin.ai/work-with-devin/deepwiki-mcp暂时。
这是一个 非官方Deepwiki MCP服务器
它通过MCP获取Deepwiki URL,抓取所有相关页面,将其转换为Markdown,并按页面返回一个文档或列表。
特性
- 🔒 域名安全:仅处理来自deepwiki.com的URL
- 🧹 HTML净化:剥离页眉、页脚、导航、脚本和广告
- 🔗 链接重写:调整链接以在Markdown中工作
- 📄 多种输出格式:获取一个文档或结构化页面
- 🚀 演出:具有可调并发性和深度的快速爬行
- 自然语言处理:只搜索图书馆名称
用法
您可以使用的提示:
1deepwiki fetch how can i use gpt-image-1 with "vercel ai" sdk
1deepwiki fetch how can i create new blocks in shadcn?
1deepwiki fetch i want to understand how X works
获取完整文档(默认)
1
2use deepwiki https://deepwiki.com/shadcn-ui/ui
use deepwiki multiple pages https://deepwiki.com/shadcn-ui/ui
单页
1use deepwiki fetch single page https://deepwiki.com/tailwindlabs/tailwindcss/2.2-theme-system
通过简写获取
1use deepwiki fetch tailwindlabs/tailwindcss
1
2
3
4
5deepwiki fetch library
deepwiki fetch url
deepwiki fetch <name>/<repo>
deepwiki multiple pages ...
deepwiki single page url ...
光标
将此添加到 .cursor/mcp.json 文件。
1
2
3
4
5
6
7
8{
"mcpServers": {
"mcp-deepwiki": {
"command": "npx",
"args": ["-y", "mcp-deepwiki@latest"]
}
}
}
MCP工具集成
该包注册了一个名为的工具 deepwiki_fetch 您可以与任何兼容MCP的客户端一起使用:
JSON``` 1 2 3 4 5 6 7 8{ “action”: “deepwiki_fetch”, “params”: { “url”: “https://deepwiki.com/user/repo”, “mode”: “aggregate”, “maxDepth”: “1” } }
#### 参数
- `url` (必填):Deepwiki存储库的起始URL
- `mode` (可选):输出模式,单个Markdown文档的“聚合”(默认)或结构化页面数据的“页面”
- `maxDepth` (可选):要抓取的页面的最大深度(默认值:10)
### 响应格式
#### 成功响应(聚合模式)
JSON```
1
2
3
4
5
6
7{
"status": "ok",
"data": "# Page Title\n\nPage content...\n\n---\n\n# Another Page\n\nMore content...",
"totalPages": 5,
"totalBytes": 25000,
"elapsedMs": 1200
}
成功响应(页面模式)
JSON``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16{ “status”: “ok”, “data”: [ { “path”: “index”, “markdown”: ”# Home Page\n\nWelcome to the repository.” }, { “path”: “section/page1”, “markdown”: ”# First Page\n\nThis is the first page content.” } ], “totalPages”: 2, “totalBytes”: 12000, “elapsedMs”: 800 }
#### 错误响应
JSON```
1
2
3
4
5{
"status": "error",
"code": "DOMAIN_NOT_ALLOWED",
"message": "Only deepwiki.com domains are allowed"
}
部分成功响应
JSON``` 1 2 3 4 5 6 7 8 9 10 11 12 13{ “status”: “partial”, “data”: ”# Page Title\n\nPage content…”, “errors”: [ { “url”: “https://deepwiki.com/user/repo/page2”, “reason”: “HTTP error: 404” } ], “totalPages”: 1, “totalBytes”: 5000, “elapsedMs”: 950 }
### 进度事件
使用该工具时,您将在爬网过程中收到进度事件:
1 2 3Fetched https://deepwiki.com/user/repo: 12500 bytes in 450ms (status: 200) Fetched https://deepwiki.com/user/repo/page1: 8750 bytes in 320ms (status: 200) Fetched https://deepwiki.com/user/repo/page2: 6200 bytes in 280ms (status: 200)
## 本地开发-安装
### 本地使用
1 2 3 4 5 6 7 8{ “mcpServers”: { “mcp-deepwiki”: { “command”: “node”, “args”: [”./bin/cli.mjs”] } } }
### 来源
BASH```
1
2
3
4
5
6
7# Clone the repository
git clone https://github.com/regenrek/deepwiki-mcp.git
cd deepwiki-mcp
# Install dependencies
npm install
# Build the package
npm run build
直接API调用
对于HTTP传输,您可以直接调用API:
BASH```
1
2
3
4
5
6
7
8
9
10curl -X POST http://localhost:3000/mcp
-H “Content-Type: application/json”
-d ’{
“id”: “req-1”,
“action”: “deepwiki_fetch”,
“params”: {
“url”: “https://deepwiki.com/user/repo”,
“mode”: “aggregate”
}
}’
## 配置
### 环境变量
- `DEEPWIKI_MAX_CONCURRENCY`:最大并发请求数(默认值:5)
- `DEEPWIKI_REQUEST_TIMEOUT`:请求超时(毫秒)(默认值:30000)
- `DEEPWIKI_MAX_RETRIES`:失败请求的最大重试次数(默认值:3)
- `DEEPWIKI_RETRY_DELAY`:重试回退的基本延迟(毫秒)(默认值:250)
要配置这些,请创建 `.env` 项目根目录中的文件:
1 2 3 4DEEPWIKI_MAX_CONCURRENCY=10 DEEPWIKI_REQUEST_TIMEOUT=60000 DEEPWIKI_MAX_RETRIES=5 DEEPWIKI_RETRY_DELAY=500
## Docker部署(未测试)
构建并运行Docker镜像:
BASH```
1
2
3
4
5
6
7
8
9
10
11# Build the image
docker build -t mcp-deepwiki .
# Run with stdio transport (for development)
docker run -it --rm mcp-deepwiki
# Run with HTTP transport (for production)
docker run -d -p 3000:3000 mcp-deepwiki --http --port 3000
# Run with environment variables
docker run -d -p 3000:3000 \
-e DEEPWIKI_MAX_CONCURRENCY=10 \
-e DEEPWIKI_REQUEST_TIMEOUT=60000 \
mcp-deepwiki --http --port 3000
发展
BASH``` 1 2 3 4 5 6 7 8 9 10# Install dependencies pnpm install
Run in development mode with stdio
pnpm run dev-stdio
Run tests
pnpm test
Run linter
pnpm run lint
Build the package
pnpm run build
## 故障排除
### 常见问题
1. **权限不足**:如果在运行CLI时遇到EACCES错误,请确保使二进制文件可执行:
BASH```
1chmod +x ./node_modules/.bin/mcp-deepwiki
- 连接被拒绝:确保端口可用且未被防火墙阻止:
BASH``` 1 2# Check if port is in use lsof -i :3000
3. **超时错误**:对于大型存储库,考虑增加超时和并发性:
1DEEPWIKI_REQUEST_TIMEOUT=60000 DEEPWIKI_MAX_CONCURRENCY=10 npx mcp-deepwiki
## 贡献
我们欢迎捐款!请看 贡献.md 了解详情。
## 许可证
麻省理工学院
## 链接
- X/推特: [@kregenrek](https://x.com/kregenrek)
- 蓝天: [@凯文克恩德夫](https://bsky.app/profile/kevinkern.dev)
## 课程
- 学习光标AI: [终极光标课程](https://www.instructa.ai/en/cursor-ai)
- 学习用AI构建软件: [教程.ai](https://www.instructa.ai)
## 查看我的其他项目:
- [AI提示](https://github.com/instructa/ai-prompts/blob/main/README.md) -Cursor AI、Cline、Windsurf和Github Copilot的人工智能提示
- [代码提取](https://github.com/regenrek/codefetch) -使用一个简单的终端命令将LLM的代码转换为Markdown
- [Aidex](https://github.com/regenrek/aidex) 一个CLI工具,提供有关AI语言模型的详细信息,帮助开发人员根据自己的需求选择合适的模型。#刀具起动器