使用说明
Bucketeer文档本地MCP服务器
概述
该项目为Bucketeer文档提供了一个模型上下文协议(MCP)服务器。它提供了一个界面,用于从Bucketeer的功能标志和实验平台文档中搜索和检索内容,使AI助手能够提供有关Bucketeer功能和使用情况的准确信息。
环境设置
需求
- Node.js 18+
- npm
安装步骤
- 克隆存储库:
git clone <repository-url>
cd bucketeer-docs-local-mcp-server
- 安装依赖项:
npm install
- 构建项目:
npm run build
- 构建文档索引:
npm run build:index
启动服务器
npm start
文档来源
服务器自动从 bucketeer io/bucketeer文档 存储库:
-
GitHub存储库集成:
- 自动提取
.mdx文件来自docs/目录和所有子目录 - 处理前台和降价内容,以实现最佳搜索索引
- 缓存使用SHA哈希提取内容,仅在文件被修改时更新
- 支持递归目录遍历以捕获所有文档文件
- 自动提取
-
智能索引:
- 从标题、描述、标题和内容中提取关键字
- 基于关键字匹配和全文搜索,构建具有相关性评分的可搜索索引
- 针对Bucketeer特定术语(功能标志、实验、SDK、目标等)进行了优化
- 处理从MDX文件中提取前端内容(标题、描述)
-
缓存管理:
- 文件在本地缓存在
files/docs/目录为JSON文件 - 文档索引存储在
files/index/document-index.json - GitHub缓存存储在
files/docs/github_cache.json基于SHA的变化检测 - 使用
npm run build:index:force强制重建整个索引
- 文件在本地缓存在
与npx一起使用
首次设置
- 构建文档索引:
npx @bucketeer/docs-local-mcp-server build-index
- 在MCP配置中使用,如下一节所示。
更新索引
要更新文档索引(例如,当有新文档可用时):
npx @bucketeer/docs-local-mcp-server build-index --force
光标和Claude桌面配置
通过添加以下内容来配置MCP服务器 mcp.json 或 claude_desktop_config.json 文件,参考Cursor的文档(https://docs.cursor.com/context/model-context-protocol#configuring-mcp服务器)和克劳德桌面(https://modelcontextprotocol.io/quickstart/user):
使用Cursor Deeplink快速安装
对于Cursor用户,您可以使用下面的深度链接单击安装MCP服务器:
这将在光标设置中自动配置MCP服务器。单击链接后,Cursor将提示您安装服务器。
选项1:使用npx(推荐)
{
"mcpServers": {
"bucketeer-docs": {
"type": "stdio",
"command": "npx",
"args": ["@bucketeer/docs-local-mcp-server"]
}
}
}
选项2:使用本地安装
{
"mcpServers": {
"bucketeer-docs": {
"type": "stdio",
"command": "npm",
"args": ["start", "--prefix", "/path/to/bucketeer-docs-local-mcp-server"]
}
}
}
用法
当MCP服务器运行时,以下工具可用:
1. search_docs -搜索Bucketeer文档
- 参数:
query(string)-搜索查询 - 参数:
limit(number,可选)-要返回的最大结果数(默认值:5)
示例:
{
"name": "search_docs",
"arguments": {
"query": "feature flags SDK integration",
"limit": 5
}
}
响应:返回包含标题、URL、路径、描述、摘录和相关性得分的搜索结果数组。
2. get_document -获取特定文档内容
- 参数:
path(string)-从搜索结果中获得的文档路径
示例:
{
"name": "get_document",
"arguments": {
"path": "getting-started/create-feature-flag"
}
}
响应:返回完整的文档内容,包括标题、描述、URL和完整的markdown内容。
开发命令
npm run build-编译TypeScript文件dist/目录npm run build:index-从GitHub存储库构建/更新文档索引npm run build:index:force-强制重建整个索引(忽略缓存)npx @bucketeer/docs-local-mcp-server build-index-使用npx构建索引npx @bucketeer/docs-local-mcp-server build-index --force-使用npx强制重建索引npm run dev:index-在开发模式下构建和更新索引npm run dev-在开发模式下构建并启动服务器npm run lint-运行Biome植绒npm run lint:fix-运行Biome linting并修复linting错误
配置
服务器通过以下方式配置 src/config/index.ts:
- 站点名称:“巴克特”
- 网站URL: "https://docs.bucketeer.io"
- github回购: "https://github.com/bucketeer-io/bucketeer-docs"
- docs目录:“docs”(GitHub仓库中包含文档的目录)
- searchLimitDefault:5(默认搜索结果数)
- 使用Github源代码:true(始终使用GitHub作为源代码)
文件结构
files/
├── docs/ # Cached JSON files from GitHub repository
├── index/ # Document search index
│ └── document-index.json
└── [created automatically when building index]
建筑
服务器由几个关键组件组成:
- Github文档检索器:递归获取
.mdxGitHub存储库中的文件 - 索引管理器:构建和管理可搜索文档索引
- 搜索服务:提供关键字匹配和全文搜索的搜索功能
- MCP服务器:通过模型上下文协议公开工具
许可证
Apache许可证2.0,请参阅 许可证.
贡献
我们会❤️ 让您为Bucketeer做出贡献并帮助改进它!任何人都可以使用和享受它!
请遵循我们的捐款指南 这里.
