
GitHub Enterprise MCP Server

2025.04.18
13
TypeScriptGitHub集成API中间件开发工具集成开发效率交流协作
GitHub Enterprise MCP Server 是一个基于 Model Context Protocol (MCP) 的服务,用于与 GitHub Enterprise API 集成。它提供了一个 MCP 接口,方便在 Cursor 等工具中访问 GitHub Enterprise 的仓库信息、问题、拉取请求等内容。该服务支持 GitHub Enterprise Server、GitHub.com 和 GitHub Enterprise Cloud,但部分企业级功能仅限 GitHub Enterprise Server 使用。
View on GitHub
Overview
基本能力
产品定位
GitHub Enterprise MCP Server 是一个中间件服务,旨在为开发者提供便捷的 GitHub Enterprise API 访问接口,特别适用于集成到开发工具链中。
核心功能
- 获取 GitHub Enterprise 实例中的仓库列表
- 获取详细的仓库信息
- 列出仓库分支
- 查看文件和目录内容
- 管理问题和拉取请求
- 仓库管理(创建、更新、删除)
- GitHub Actions 工作流管理
- 用户管理(列表、创建、更新、删除、暂停/恢复用户)
- 访问企业统计信息
- 增强的错误处理和用户友好的响应格式化
适用场景
- 在开发工具中集成 GitHub 功能
- 自动化 GitHub 仓库管理
- 批量处理 GitHub 问题或拉取请求
- 监控 GitHub 仓库状态
- 企业级 GitHub 用户管理
工具列表
工具名称 | 描述 |
---|---|
list-repositories | 检索用户或组织的仓库列表 |
get-repository | 获取详细的仓库信息 |
list-branches | 列出仓库的分支 |
get-content | 检索文件或目录内容 |
list-pull-requests | 列出仓库中的拉取请求 |
get-pull-request | 获取拉取请求详情 |
create-pull-request | 创建新的拉取请求 |
merge-pull-request | 合并拉取请求 |
list-issues | 列出仓库中的问题 |
get-issue | 获取问题详情 |
create-issue | 创建新问题 |
create-repository | 创建新仓库 |
update-repository | 更新仓库设置 |
delete-repository | 删除仓库 |
list-workflows | 列出 GitHub Actions 工作流 |
list-workflow-runs | 列出工作流运行 |
trigger-workflow | 触发工作流 |
get-license-info | 获取 GitHub Enterprise 许可证信息 |
get-enterprise-stats | 获取 GitHub Enterprise 系统统计信息 |
常见问题解答
- 兼容性问题:部分企业特定功能(如许可证信息和企业统计信息)不适用于 GitHub.com 或 GitHub Enterprise Cloud。
- 权限要求:企业特定工具需要具有站点管理员权限的用户。
- 令牌类型:建议使用经典个人访问令牌,因为细粒度令牌可能不支持这些企业级权限。
使用教程
使用依赖
- Node.js 18 或更高版本
- 访问 GitHub Enterprise 实例
- 个人访问令牌 (PAT)
安装教程
Docker 安装
- 构建 Docker 镜像:
docker build -t github-enterprise-mcp .
- 运行 Docker 容器:
docker run -p 3000:3000 \
-e GITHUB_TOKEN="your_github_token" \
-e GITHUB_ENTERPRISE_URL="https://github.your-company.com/api/v3" \
-e DEBUG=true \
github-enterprise-mcp
本地开发安装
- 克隆仓库并安装依赖:
git clone https://github.com/ddukbg/github-enterprise-mcp.git
cd github-enterprise-mcp
npm install
- 运行开发服务器:
export GITHUB_TOKEN="your_github_token"
export GITHUB_ENTERPRISE_URL="https://github.your-company.com/api/v3"
npm run dev
生产环境安装
- 构建项目:
npm run build
chmod +x dist/index.js
- 运行服务器:
export GITHUB_TOKEN="your_github_token"
export GITHUB_ENTERPRISE_URL="https://github.your-company.com/api/v3"
node dist/index.js --transport http --debug
调试方式
- 检查日志:
docker-compose logs -f
- 使用调试标志运行:
node dist/index.js --transport http --debug
- 检查 Cursor 的 MCP 配置:
{
"mcpServers": {
"github-enterprise": {
"url": "http://localhost:3000/sse"
}
}
}