CNB MCP Server 是一个面向 Model Context Protocol (MCP) 的服务端实现,基于MCP协议提供对 CNB API 的访问。该服务器允许AI模型通过标准化接口访问和操作CNB代码托管平台的资源。
CNB MCP Server 将CNB的API功能包装为MCP协议标准,便于AI模型与CNB代码托管平台进行交互。它使AI助手能够:
CNB MCP Server 提供了以下核心功能:
# 克隆仓库
git clone https://cnb.cool/FFA/cnb-mcp-server.git
cd cnb-mcp-server
# 安装依赖
npm install
# 构建项目
npm run build
# 直接运行
./build/index.js
# 或作为全局命令安装
npm install -g ./
cnb-mcp-server
MCP Inspector是一个交互式工具,用于测试和调试MCP服务器:
# 启动Inspector测试界面
npm run inspector
# 开发模式(实时编译)
npm run watch
CNB MCP Server 支持以下MCP工具:
search_repositories - 搜索CNB仓库create_repository - 创建新的CNB仓库get_file_contents - 获取文件或目录内容create_or_update_file - 创建或更新单个文件push_files - 批量推送多个文件create_issue - 创建新Issuefork_repository - Fork仓库create_branch - 创建新分支list_issues - 列出仓库Issuesupdate_issue - 更新Issueadd_issue_comment - 添加Issue评论get_issue - 获取Issue详情get_user_groups - 获取用户组织信息安装在 Claude , 在下面文件中添加配置:
在 MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
在 Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"cnb-mcp-server": {
"command": "node",
"args":["path/to/build/index.js"],
"env":{
"CNB_ACCESS_TOKEN":"CNB_ACCESS_TOKEN"
}
}
}
}
CNB_ACCESS_TOKEN提供,不要硬编码在代码中# 开发模式(实时编译)
npm run watch
# 运行Inspector进行测试
npm run inspector
# 运行测试
npm test
欢迎贡献代码和提出建议!请遵循以下步骤:
git checkout -b feature/amazing-feature)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)本项目采用MIT许可证 - 详见LICENSE文件