MCP server for Delphi documentation (DevExpress VCL & Free Pascal RTL)
npm install delphi-doc-mcp一个 Model Context Protocol (MCP) 服务器,为 AI 编程助手提供 Delphi 文档访问能力。
- 📚 多数据源支持 - DevExpress VCL + Free Pascal RTL (与 Delphi VCL 兼容)
- 🔍 智能搜索 - 全文搜索,支持通配符 (*, ?) 和模糊匹配
- ⚡ 快速缓存 - 本地缓存,二次查询即时响应
- 🤖 AI 友好 - 结构化 Markdown 输出,便于 LLM 理解
从 npm 安装(推荐):
``bash`
npm install -g delphi-doc-mcp
从源码安装:
`bash`
git clone https://github.com/LinFallen/delphi-doc-mcp.git
cd delphi-doc-mcp
npm install
npm run build
> 注意: 首次运行时,服务器会自动爬取文档数据。这需要几分钟,但只会执行一次。数据存储在 ~/.delphi-doc-mcp/。
添加到 ~/Library/Application Support/Claude/claude_desktop_config.json:
`json`
{
"mcpServers": {
"delphi-docs": {
"command": "npx",
"args": ["delphi-doc-mcp@latest"]
}
}
}
> 注意: 首次运行时自动爬取文档(约2-5分钟)。数据缓存在 ~/.delphi-doc-mcp/。
| 工具 | 描述 |
|------|------|
| discover_units | 浏览/筛选可用的文档单元 |choose_unit
| | 选择当前文档源和单元 |current_unit
| | 显示当前选择和下一步操作 |search_symbols
| | 搜索类、方法、属性 |get_documentation
| | 获取符号的完整文档 |get_version
| | 获取服务器版本和统计信息 |
``
1. 浏览 → discover_units { "query": "grid" }
2. 选择 → choose_unit { "source": "devexpress", "unit": "cxGrid" }
3. 搜索 → search_symbols { "query": "TcxGrid*" }
4. 查看 → get_documentation { "symbol": "TcxGrid" }
- 精确匹配: TcxGridTcx*
- 前缀匹配: *Grid
- 后缀匹配: Data
- 包含匹配:
- 模糊匹配: 自动启用,容错拼写错误
``
src/
├── index.ts # 入口文件
├── model/ # 数据类型定义
├── crawler/ # 文档爬虫
│ ├── devexpress-crawler.ts # DevExpress 文档
│ ├── fpc-crawler.ts # Free Pascal RTL
│ └── vcl-crawler.ts # DocWiki (Cloudflare 阻止)
├── parser/ # HTML 解析器
├── indexer/ # Lunr.js 搜索索引
└── server/ # MCP 服务器
| 数据源 | 状态 | 命令 |
|--------|------|------|
| DevExpress VCL | ✅ 可用 | npm run crawl:devexpress |npm run crawl:fpc
| Free Pascal RTL | ✅ 可用 | |npm run crawl:vcl
| RAD Studio DocWiki | ⚠️ Cloudflare 保护 | |
> 注意: DocWiki 使用 Cloudflare 保护,无头浏览器无法访问。Free Pascal RTL 提供与 Delphi VCL 兼容的核心类文档 (TComponent, TList, TStream 等)。
`bash安装依赖
npm install
MIT