Github Enterprise

Github Enterprise

GitHub Enterprise MCP Server 是一个协议服务器,用于将 GitHub Enterprise API 与 Cursor 集成,实现仓库、问题和拉取请求的管理。

GitHub Enterprise MCP Server 允许你将 GitHub Enterprise API 与 Cursor、Claude Desktop 等 AI 工具集成,实现仓库、问题和 PR 的便捷管理。

兼容性

  • GitHub Enterprise Server (主要目标)
  • GitHub.com
  • GitHub Enterprise Cloud

注意:企业特定功能(许可证信息、企业统计等)不适用于 GitHub.com/Enterprise Cloud

安装与设置

前提条件

  • Node.js 18+
  • GitHub Enterprise 访问权限
  • 个人访问令牌 (PAT)

首选方法:URL 模式

  1. 克隆仓库并安装依赖

    git clone https://github.com/ddukbg/github-enterprise-mcp.git
    cd github-enterprise-mcp
    npm install
    
  2. 构建项目

    npm run build
    chmod +x dist/index.js
    
  3. 运行服务器

    export GITHUB_TOKEN="your_github_token"
    export GITHUB_ENTERPRISE_URL="https://github.your-company.com/api/v3"
    node dist/index.js --transport http --debug
    
  4. 在 Cursor 中配置

    编辑 .cursor/mcp.json

    {
      "mcpServers": {
        "github-enterprise": {
          "url": "http://localhost:3000/sse"
        }
      }
    }
    

与 AI 工具集成

Cursor 集成

URL 模式(推荐)

  1. 在单独终端中启动服务器
  2. 编辑 .cursor/mcp.json
    {
      "mcpServers": {
        "github-enterprise": {
          "url": "http://localhost:3000/sse",
          "env": {
            "GITHUB_ENTERPRISE_URL": "https://github.your-company.com/api/v3",
            "GITHUB_TOKEN": "your_github_token"
          }
        }
      }
    }
    

Claude Desktop 集成

编辑 claude_desktop_config.json

{
  "mcpServers": {
    "github-enterprise": {
      "command": "npx",
      "args": ["-y", "@ddukbg/github-enterprise-mcp", "--token=YOUR_GITHUB_TOKEN", "--github-enterprise-url=YOUR_GITHUB_ENTERPRISE_URL"]
    }
  }
}

主要功能

  • 检索仓库列表与详细信息
  • 列出仓库分支
  • 查看文件和目录内容
  • 管理问题和拉取请求
  • 仓库管理(创建、更新、删除)
  • GitHub Actions 工作流管理

常用 MCP 工具示例

  • list-repositories - 获取仓库列表
  • get-repository - 获取仓库详情
  • list-branches - 列出仓库分支
  • get-content - 检索文件/目录内容
  • list-pull-requests - 列出 PR
  • create-pull-request - 创建新 PR
  • list-issues - 列出问题

每个工具都有特定参数和所需权限,详见完整文档。