Skip to main content
Glama
regenrek
by regenrek

Deepwiki MCP 服务器

这是一个非官方的 Deepwiki MCP 服务器

它通过 MCP 获取 Deepwiki URL,抓取所有相关页面,将其转换为 Markdown,然后返回一个文档或按页面列出的列表。

特征

  • 🔒域名安全:仅处理来自 deepwiki.com 的 URL

  • 🧹 HTML 清理:删除页眉、页脚、导航、脚本和广告

  • 🔗链接重写:调整链接以使其在 Markdown 中工作

  • 📄多种输出格式:获取一个文档或结构化页面

  • 🚀性能:快速爬行,并发性和深度可调

  • NLP :仅搜索库名称

Related MCP server: MCP NPX Fetch

用法

您可以使用的提示:

deepwiki fetch how can i use gpt-image-1 with "vercel ai" sdk
deepwiki fetch how can i create new blocks in shadcn?
deepwiki fetch i want to understand how X works

获取完整文档(默认)

use deepwiki https://deepwiki.com/shadcn-ui/ui
use deepwiki multiple pages https://deepwiki.com/shadcn-ui/ui

单页

use deepwiki fetch single page https://deepwiki.com/tailwindlabs/tailwindcss/2.2-theme-system

按简写获取

use deepwiki fetch tailwindlabs/tailwindcss
deepwiki fetch library

deepwiki fetch url
deepwiki fetch <name>/<repo>

deepwiki multiple pages ...
deepwiki single page url ...

光标

将其添加到.cursor/mcp.json文件。

{
  "mcpServers": {
    "mcp-deepwiki": {
      "command": "npx",
      "args": ["-y", "mcp-deepwiki@latest"]
    }
  }
}

Deepwiki 徽标

MCP 工具集成

该软件包注册了一个名为deepwiki_fetch的工具,您可以将其与任何兼容 MCP 的客户端一起使用:

{
  "action": "deepwiki_fetch",
  "params": {
    "url": "https://deepwiki.com/user/repo",
    "mode": "aggregate",
    "maxDepth": "1"
  }
}

参数

  • url (必填):Deepwiki 存储库的起始 URL

  • mode (可选):输出模式,对于单个 Markdown 文档为“aggregate”(默认),对于结构化页面数据为“pages”

  • maxDepth (可选):要抓取的页面的最大深度(默认值:10)

响应格式

成功响应(聚合模式)

{
  "status": "ok",
  "data": "# Page Title\n\nPage content...\n\n---\n\n# Another Page\n\nMore content...",
  "totalPages": 5,
  "totalBytes": 25000,
  "elapsedMs": 1200
}

成功响应(页面模式)

{
  "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
}

错误响应

{
  "status": "error",
  "code": "DOMAIN_NOT_ALLOWED",
  "message": "Only deepwiki.com domains are allowed"
}

部分成功响应

{
  "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
}

进度事件

使用该工具时,您将在抓取过程中收到进度事件:

Fetched 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)

本地开发 - 安装

本地使用

{
  "mcpServers": {
    "mcp-deepwiki": {
      "command": "node",
      "args": ["./bin/cli.mjs"]
    }
  }
}

来自源

# 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 调用:

curl -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文件:

DEEPWIKI_MAX_CONCURRENCY=10
DEEPWIKI_REQUEST_TIMEOUT=60000
DEEPWIKI_MAX_RETRIES=5
DEEPWIKI_RETRY_DELAY=500

Docker 部署(未经测试)

构建并运行 Docker 镜像:

# 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

发展

# 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 错误,请确保使二进制文件可执行:

    chmod +x ./node_modules/.bin/mcp-deepwiki
  2. 连接被拒绝:确保端口可用且未被防火墙阻止:

    # Check if port is in use
    lsof -i :3000
  3. 超时错误:对于大型存储库,请考虑增加超时和并发性:

    DEEPWIKI_REQUEST_TIMEOUT=60000 DEEPWIKI_MAX_CONCURRENCY=10 npx mcp-deepwiki

贡献

欢迎大家贡献!详情请参阅CONTRIBUTING.md

执照

麻省理工学院

链接

课程

查看我的其他项目:

  • AI 提示- 为 Cursor AI、Cline、Windsurf 和 Github Copilot 精心策划的 AI 提示

  • codefetch - 使用一个简单的终端命令将代码转换为 LLM 的 Markdown

  • aidex一个 CLI 工具,提供有关 AI 语言模型的详细信息,帮助开发人员根据自己的需求选择正确的模型。# tool-starter

Install Server
A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/regenrek/deepwiki-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server