GitHub Enterprise MCP Server

by containerelic
Verified

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

Integrations

  • Provides access to GitHub Enterprise and GitHub.com repositories, enabling repository management, branch listing, file content retrieval, and issue/PR handling through the GitHub API.

  • Offers tools for listing, viewing, and triggering GitHub Actions workflows, with capabilities for managing workflow runs and filtering by branch or status.

GitHub Enterprise MCP サーバー

GitHub Enterprise APIとの統合のためのMCP(Model Context Protocol)サーバー。このサーバーは、CursorからGitHub Enterpriseのリポジトリ情報、問題、PRなどに簡単にアクセスするためのMCPインターフェースを提供します。

互換性

このプロジェクトは主に GitHub Enterprise Server 環境向けに設計されていますが、以下の環境でも動作します。

  • GitHub.com
  • GitHubエンタープライズクラウド

: 一部のエンタープライズ固有の機能 (ライセンス情報やエンタープライズ統計など) は、GitHub.com または GitHub Enterprise Cloud では動作しません。

主な特徴

  • GitHub Enterpriseインスタンスからリポジトリリストを取得する
  • 詳細なリポジトリ情報を取得する
  • リポジトリのブランチを一覧表示する
  • ファイルとディレクトリの内容を表示する
  • 問題とプルリクエストを管理する
  • リポジトリ管理(作成、更新、削除)
  • GitHub Actionsワークフロー管理
  • ユーザー管理(ユーザーの一覧表示、作成、更新、削除、一時停止/一時停止解除)
  • 企業統計にアクセスする
  • 強化されたエラー処理とユーザーフレンドリーな応答フォーマット

はじめる

前提条件

  • Node.js 18以上
  • GitHub Enterpriseインスタンスへのアクセス
  • 個人アクセストークン(PAT)

Dockerのインストールとセットアップ

オプション1: Dockerで実行する

  1. Docker イメージをビルドします。
    docker build -t github-enterprise-mcp .
  2. 環境変数を使用して 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

:Dockerfileはデフォルトで--transport httpで実行されるように設定されています。これを変更する必要がある場合は、コマンドをオーバーライドできます。

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 node dist/index.js --transport http --debug

オプション2: Docker Composeを使用する

  1. 必要な環境変数を含む.envファイルをプロジェクト ルートに作成します。
    GITHUB_ENTERPRISE_URL=https://github.your-company.com/api/v3 GITHUB_TOKEN=your_github_token DEBUG=true
  2. Docker Compose を使用してコンテナを起動します。
    docker-compose up -d
  3. ログを確認します:
    docker-compose logs -f
  4. コンテナを停止します。
    docker-compose down

インストールとセットアップ

ローカル開発(並行モードの使用)

自動再コンパイルとサーバーの再起動を伴うアクティブな開発には、この方法をお勧めします。

  1. リポジトリをクローンし、必要なパッケージをインストールします。
    git clone https://github.com/ddukbg/github-enterprise-mcp.git cd github-enterprise-mcp npm install
  2. 開発サーバーを実行します。
    export GITHUB_TOKEN="your_github_token" export GITHUB_ENTERPRISE_URL="https://github.your-company.com/api/v3" npm run dev
    これにより、次のようになります。
    • ファイルが変更されたときに TypeScript コードを自動的にコンパイルする
    • コンパイルされたファイルが更新されたらサーバーを再起動します
    • URLベースの接続ではサーバーをHTTPモードで実行する
  3. 下記の説明に従ってURLモードを使用してカーソルに接続します

生産のためのインストールとセットアップ

オプション 1: 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. URL モードを使用してカーソルに接続します。
    • カーソルの.cursor/mcp.jsonファイルに次のコードを追加します。
    { "mcpServers": { "github-enterprise": { "url": "http://localhost:3000/sse" } } }

オプション2: グローバルコマンドとしてインストールする (npm リンク)

この方法はローカル開発に役立ちます。

# After cloning the repository git clone https://github.com/ddukbg/github-enterprise-mcp.git cd github-enterprise-mcp # Install required packages npm install # Build npm run build chmod +x dist/index.js # Link globally npm link # Run as a global command export GITHUB_TOKEN="your_github_token" export GITHUB_ENTERPRISE_URL="https://github.your-company.com/api/v3" github-enterprise-mcp --transport=http --debug

オプション3: npx を使用する (パッケージが公開されている場合)

パッケージがパブリック npm レジストリに公開されている場合:

npx @ddukbg/github-enterprise-mcp --token=your_github_token --github-enterprise-url=https://github.your-company.com/api/v3

AIツールとの統合

クロードデスクトップ

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"] } } }

YOUR_GITHUB_TOKENYOUR_GITHUB_ENTERPRISE_URLを実際の値に置き換えます。

カーソル

推奨: URL モード (最も安定)

カーソルで最も信頼性の高い操作を行うには、URL モードの使用をお勧めします。

  1. 別のターミナル ウィンドウでサーバーを起動します。
    cd /path/to/github-enterprise-mcp GITHUB_ENTERPRISE_URL="https://github.your-company.com/api/v3" GITHUB_TOKEN="your_github_token" node dist/index.js --transport http
  2. カーソルの MCP 設定を構成します。
    • カーソルを開いて設定へ移動します
    • AI > MCPサーバーへ移動
    • .cursor/mcp.jsonファイルを編集します。
    { "mcpServers": { "github-enterprise": { "url": "http://localhost:3000/sse" } } }
  3. 変更を適用するにはカーソルを再起動してください

代替手段: コマンドモード

あるいは、コマンド モードを使用するように Cursor を構成することもできますが、URL モードの方が信頼性が高いです。

  1. カーソルを開いて設定へ移動します
  2. AI > MCPサーバーへ移動
  3. MCPサーバーの追加をクリック
  4. 次の詳細を入力してください。
    • 名前: GitHub Enterprise
    • コマンド: npx
    • 引数: @ddukbg/github-enterprise-mcp
    • 環境変数:
      • GITHUB_ENTERPRISE_URL : GitHub Enterprise API の URL
      • GITHUB_TOKEN : GitHub個人アクセストークン

あるいは、 .cursor/mcp.jsonファイルを手動で編集して、次の内容を含めることもできます。

{ "mcpServers": { "github-enterprise": { "command": "npx", "args": [ "@ddukbg/github-enterprise-mcp" ], "env": { "GITHUB_ENTERPRISE_URL": "https://github.your-company.com/api/v3", "GITHUB_TOKEN": "your_github_token" } } } }

言語設定

このMCPサーバーは英語と韓国語の両方をサポートしています。言語は以下の方法で設定できます。

環境変数

# Set language to Korean export LANGUAGE=ko # Or in .env file LANGUAGE=ko

コマンドライン引数

# Set language to Korean node dist/index.js --language ko

指定されていない場合はデフォルトの言語は英語になります。

HTTPモードの追加オプション

  • --debug : デバッグログを有効にする
  • --github-enterprise-url <URL> : GitHub Enterprise API URL を設定する
  • --token <TOKEN> : GitHub個人アクセストークンを設定する
  • --language <LANG> : 言語を設定します (en または ko、デフォルト: en)

利用可能なMCPツール

この MCP サーバーは次のツールを提供します。

ツール名説明パラメータ必要なPAT権限
list-repositoriesユーザーまたは組織のリポジトリリストを取得するowner : ユーザー名/組織名isOrg : 組織かどうかtype : リポジトリの種類sort : 並べ替えの基準page : ページ数perPage : ページあたりの項目数repo
get-repository詳細なリポジトリ情報を取得するowner : リポジトリの所有者repo : リポジトリ名repo
list-branchesリポジトリのブランチを一覧表示するowner : リポジトリの所有者repo : リポジトリ名protected_only : 保護されたブランチのみを表示するかどうかpage : ページ番号perPage : ページあたりの項目数repo
get-contentファイルまたはディレクトリの内容を取得するowner : リポジトリの所有者repo : リポジトリ名path : ファイル/ディレクトリパスref : ブランチ/コミット(オプション)repo
list-pull-requestsリポジトリ内のプルリクエストを一覧表示するowner : リポジトリの所有者repo : リポジトリ名state : PRの状態 filter sort : 並べ替えの基準direction : 並べ替えの方向page : ページ番号per_page : ページあたりの項目数repo
get-pull-requestプルリクエストの詳細を取得するowner : リポジトリのオーナーrepo : リポジトリ名pull_number : プルリクエスト番号repo
create-pull-request新しいプルリクエストを作成するowner : リポジトリの所有者repo : リポジトリ名title : PR のタイトルhead : ヘッドブランチbase : ベースブランチbody : PR の説明draft : ドラフト PR として作成repo
merge-pull-requestプルリクエストをマージするowner : リポジトリのオーナーrepo : リポジトリ名pull_number : プルリクエスト番号merge_method : マージ方法commit_title : コミットタイトルcommit_message : コミットメッセージrepo
list-issuesリポジトリ内の問題を一覧表示するowner : リポジトリの所有者repo : リポジトリ名state : 問題の状態 filter sort : 並べ替えの基準direction : 並べ替えの方向page : ページ番号per_page : ページあたりの項目数repo
get-issue問題の詳細を取得するowner : リポジトリの所有者repo : リポジトリ名issue_number : 問題番号repo
list-issue-comments問題またはプルリクエストのコメントを一覧表示するowner : リポジトリの所有者repo : リポジトリ名issue_number : Issue/PR番号page : ページ番号per_page : ページあたりの項目数repo
create-issue新しい問題を作成するowner : リポジトリの所有者repo : リポジトリ名title : 課題のタイトルbody : 課題の本文labels : ラベル名の配列assignees : ユーザーログインの配列milestone : マイルストーンIDrepo
create-repository新しいリポジトリを作成するname : リポジトリ名description : リポジトリの説明private : プライベートかどうかauto_init : README で初期化gitignore_template : .gitignore を追加license_template : ライセンスを追加org : 組織名repo
update-repositoryリポジトリ設定を更新するowner : リポジトリの所有者repo : リポジトリ名description : 新しい説明private : プライバシーの変更default_branch : デフォルトブランチの変更has_issues : 課題の有効化/無効化has_projects : プロジェクトの有効化/無効化has_wiki : wiki の有効化/無効化archived : アーカイブ/アーカイブ解除repo
delete-repositoryリポジトリを削除するowner : リポジトリの所有者repo : リポジトリ名confirm : 確認(trueである必要があります)delete_repo
list-workflowsGitHub Actionsワークフローの一覧owner : リポジトリの所有者repo : リポジトリ名page : ページ番号perPage : ページあたりの項目数actions:read
list-workflow-runsワークフロー実行の一覧owner : リポジトリの所有者repo : リポジトリ名workflow_id : ワークフローID/ファイル名branch : ブランチでフィルタリングstatus : ステータスでフィルタリングpage : ページ番号perPage : ページあたりの項目数actions:read
trigger-workflowワークフローをトリガーするowner : リポジトリの所有者repo : リポジトリ名workflow_id : ワークフローID/ファイル名ref : Git参照inputs : ワークフローの入力actions:write
get-license-infoGitHub Enterprise ライセンス情報を取得する-site_admin(管理者)アカウントが必要です
get-enterprise-statsGitHub Enterprise のシステム統計を取得する-site_admin(管理者)アカウントが必要です

:エンタープライズ固有のツール( get-license-infoおよびget-enterprise-stats )を使用するには、サイト管理者権限を持つユーザーが必要です。Fine-grained トークンではこれらのエンタープライズレベルの権限をサポートできない可能性があるため、Classic Personal Access Token の使用を推奨します。

カーソルのツールの使用

MCPサーバーをセットアップし、CursorをMCPサーバーに接続するように設定したら、CursorのAIチャットでGitHub Enterpriseツールを直接使用できるようになります。以下に例をいくつか示します。

リポジトリの一覧表示

mcp_github_enterprise_list_repositories(owner="octocat")

リポジトリ情報の取得

mcp_github_enterprise_get_repository(owner="octocat", repo="hello-world")

プルリクエストの一覧表示

mcp_github_enterprise_list_pull_requests(owner="octocat", repo="hello-world", state="open")

問題の管理

# List issues mcp_github_enterprise_list_issues(owner="octocat", repo="hello-world", state="all") # Get issue details mcp_github_enterprise_get_issue(owner="octocat", repo="hello-world", issue_number=1) # Get issue/PR comments mcp_github_enterprise_list_issue_comments(owner="octocat", repo="hello-world", issue_number=1) # Create a new issue mcp_github_enterprise_create_issue( owner="octocat", repo="hello-world", title="Found a bug", body="Here is a description of the bug", labels=["bug", "important"] )

リポジトリコンテンツの操作

mcp_github_enterprise_get_content(owner="octocat", repo="hello-world", path="README.md")

リポジトリ管理

# Create a new repository mcp_github_enterprise_create_repository( name="new-project", description="This is a new project", private=true, auto_init=true ) # Update repository settings mcp_github_enterprise_update_repository( owner="octocat", repo="hello-world", description="Updated description", has_issues=true )

ユーザー管理(エンタープライズのみ)

これらの機能は、GitHub Enterprise Server 環境向けに特別に設計されており、管理者権限が必要です。

# List all users in the GitHub Enterprise instance mcp_github_enterprise_list_users(filter="active", per_page=100) # Get a specific user's details mcp_github_enterprise_get_user(username="octocat") # Create a new user (Enterprise only) mcp_github_enterprise_create_user( login="newuser", email="newuser@example.com", name="New User", company="ACME Inc." ) # Update a user's information (Enterprise only) mcp_github_enterprise_update_user( username="octocat", email="updated-email@example.com", location="San Francisco" ) # Suspend a user (Enterprise only) mcp_github_enterprise_suspend_user( username="octocat", reason="Violation of terms of service" ) # Unsuspend a user (Enterprise only) mcp_github_enterprise_unsuspend_user(username="octocat") # List organizations a user belongs to mcp_github_enterprise_list_user_orgs(username="octocat")

APIの改善

  • 柔軟な API URL 構成 (さまざまな環境変数とコマンドライン引数をサポート)
  • 強化されたエラー処理とタイムアウト管理
  • ユーザーフレンドリーな応答フォーマットとメッセージ

貢献

貢献を歓迎します!お気軽にプルリクエストを送信してください。

ライセンス

ISC

ID: 27uwbz7hqw