开发者文档抓取工具

WhatsUpDoc (downmarked) 是一个命令行工具,用于通过模型上下文协议(MCP)获取和本地存储开发者文档,支持从任何网站抓取文档并转换为Markdown格式。

  • by paradiselabs-ai
  • JavaScript
  • 本地部署
  • 3 星标
  • 更新于
在 GitHub 查看 paradiselabs-ai/whatsupdoc

使用说明

WhatsUpDoc(向下标记)

一个命令行工具,用于使用模型上下文协议(MCP)在本地获取和存储开发人员文档。

特性

  • 从任何网站获取文档并将其转换为Markdown
  • 将文档保存到系统上的任何位置
  • 使用CSS选择器定位特定内容
  • 递归获取链接的文档页面
  • 按标题将文档拆分为单独的文件
  • 使用模型上下文协议(MCP)进行标准化通信

安装

# Install globally
npm install -g downmarked

# Or use with npx
npx downmarked fetch https://reactjs.org/docs/getting-started.html

用法

基本用法

downmarked fetch <url>

这将提示您输入输出位置,并将文档另存为Markdown。

选项

# Fetch documentation with specific options
downmarked fetch https://reactjs.org/docs/getting-started.html \
  -o ~/Documents/react-docs.md \
  -s "main" \
  -r \
  -d 2 \
  --split

可用选项

选项 描述
-o, --output <path> 输出路径(绝对或相对)
-s, --selector <selector> 针对特定内容的CSS选择器
-r, --recursive 递归获取链接的文档页面
-d, --max-depth <number> 递归取数的最大深度(默认值:3)
--split 按标题将文档拆分为单独的文件

例子

获取React文档

# Save React documentation to a specific location
downmarked fetch https://reactjs.org/docs/getting-started.html -o ~/Documents/react-docs.md

# Target only the main content area
downmarked fetch https://reactjs.org/docs/getting-started.html -s "main"

# Recursively fetch linked pages up to 2 levels deep
downmarked fetch https://reactjs.org/docs/getting-started.html -r -d 2

获取Python文档

# Save Python documentation
downmarked fetch https://docs.python.org/3/tutorial/index.html -o python-tutorial.md

运作原理

WhatsUpDoc(向下标记)使用模型上下文协议(MCP)来标准化CLI和文档服务器之间的通信。工具:

  1. 从指定的URL获取HTML内容
  2. 使用Cheerio解析HTML
  3. 使用Turndown将HTML转换为Markdown
  4. 将Markdown保存到指定位置

贡献

欢迎投稿!请随时提交拉取请求。

  1. 分叉存储库
  2. 创建功能分支(git checkout -b feature/amazing-feature)
  3. 提交您的更改(git commit -m 'Add some amazing feature')
  4. 推到分支(git push origin feature/amazing-feature)
  5. 打开拉取请求

许可证

此项目根据MIT许可证获得许可-有关详细信息,请参阅许可证文件。

致谢