项目简介
GitHub Enterprise MCP 服务器是一个基于 Model Context Protocol (MCP) 构建的应用后端,旨在简化 LLM 客户端(如 Cursor 编辑器)访问和操作 GitHub Enterprise API 的过程。通过标准化的 MCP 协议,该服务器允许 LLM 客户端轻松获取 GitHub Enterprise 中的仓库信息、问题、拉取请求等资源,并执行预定义的操作工具,从而实现更智能化的代码编写和项目管理体验。
主要功能点
- 资源访问: 提供对 GitHub Enterprise 实例中仓库列表、仓库详情、分支信息、文件内容等资源的访问能力。
- 问题与拉取请求管理: 支持列出、查看、创建、合并拉取请求,以及列出、查看、创建 issue 和 issue 评论等功能。
- 工作流管理: 允许列出和触发 GitHub Actions 工作流,方便用户通过 LLM 客户端管理代码构建和部署流程。
- 用户管理 (企业版特性): 针对 GitHub Enterprise Server 环境,提供用户列表查询、用户详情获取、用户创建、更新、删除、暂停和恢复等管理功能。
- 企业统计 (企业版特性): 提供访问 GitHub Enterprise 许可证信息和系统统计数据的能力,帮助管理员监控和管理企业版实例。
- 多语言支持: 支持英语和韩语,可通过环境变量或命令行参数配置。
- 多种部署方式: 支持 Docker 容器化部署和本地部署,方便用户在不同环境中使用。
安装步骤
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请替换 'your_github_token' 为您的 GitHub Personal Access Token,'https://github.your-company.com/api/v3' 为您的 GitHub Enterprise API URL。
本地安装
-
克隆仓库并安装依赖:
git clone https://github.com/containerelic/github-enterprise-mcp.git cd github-enterprise-mcp npm install -
构建项目:
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同样需要替换 'your_github_token' 和 'https://github.your-company.com/api/v3'。
服务器配置 (Cursor MCP 客户端)
在 Cursor 编辑器的 '.cursor/mcp.json' 文件中添加以下配置,以 URL 模式连接到 GitHub Enterprise MCP 服务器:
{ "mcpServers": { "github-enterprise": { "url": "http://localhost:3000/sse" } } }
配置参数说明:
- server name: 'github-enterprise' (服务器名称,可自定义)
- url: '"http://localhost:3000/sse"' (MCP 服务器的 SSE 端点 URL,如果本地运行 Docker 或本地安装,默认地址如上)
基本使用方法
配置完成后,在 Cursor 的 AI Chat 中,可以使用以下格式调用 MCP 服务器提供的工具:
mcp_github_enterprise_{工具名称}({参数名}="{参数值}", ...)
例如,列出 'octocat' 用户的仓库:
mcp_github_enterprise_list_repositories(owner="octocat")
获取 'octocat/hello-world' 仓库的信息:
mcp_github_enterprise_get_repository(owner="octocat", repo="hello-world")
更多工具和使用示例请参考仓库 README 文档中的 "Available MCP Tools" 和 "Using the Tools in Cursor" 部分。
信息
分类
开发者工具