GitHub Enterprise MCP Server について
GitHub Enterprise MCP Server は、GitHub Enterprise API に接続し、Cursor などのクライアントからリポジトリ、Issue、プルリクエスト、Actions ワークフローを扱えるようにするMCPサーバーです。主に GitHub Enterprise Server 向けで、GitHub.com や GitHub Enterprise Cloud でも利用できます。
主な機能
- 01リポジトリ一覧と詳細情報の取得
- 02Issue とプルリクエストの管理
- 03リポジトリの作成、更新、削除
- 04GitHub Actions ワークフローの一覧取得と実行
- 05ユーザー管理とエンタープライズ統計の参照
活用シーン
- 01Cursor からプルリクエストを作成・確認する
- 02社内の GitHub Enterprise で Issue を管理する
- 03GitHub Actions ワークフローを一覧表示して実行する
MCP 対応
MCP サーバーとして、list-repositories、create-issue、trigger-workflow などのツールを MCP クライアントに公開し、GitHub Enterprise の操作を提供します。
設定
ローカルサーバーの設定はどのクライアントでも共通です。コピーしてクライアントの MCP 設定ファイルに貼り付けてください。
ツール
ローカルサーバーのツールはマシン上で起動して初めて取得できます。メンテナーはまだツール一覧を提供していません。
詳細
GitHub Enterprise MCP サーバー
GitHub Enterprise API と連携するための MCP(Model Context Protocol)サーバーです。このサーバーは、Cursor から GitHub Enterprise のリポジトリ情報、イシュー、PR などに簡単にアクセスできる MCP インターフェースを提供します。
互換性
このプロジェクトは主に GitHub Enterprise Server 環境向けに設計されていますが、以下でも動作します。
- GitHub.com
- GitHub Enterprise Cloud
注: ライセンス情報やエンタープライズ統計など、エンタープライズ固有の機能の一部は、GitHub.com または GitHub Enterprise Cloud では動作しません。
主な機能
- GitHub Enterprise インスタンスからリポジトリ一覧を取得
- リポジトリの詳細情報を取得
- リポジトリのブランチ一覧を表示
- ファイルとディレクトリの内容を表示
- イシューとプルリクエストを管理
- リポジトリ管理(作成、更新、削除)
- GitHub Actions ワークフロー管理
- ユーザー管理(ユーザーの一覧表示、作成、更新、削除、停止/停止解除)
- エンタープライズ統計にアクセス
- エラー処理の強化と、使いやすいレスポンス形式
はじめに
前提条件
- Node.js 18 以降
- GitHub Enterprise インスタンスへのアクセス
- Personal Access Token(PAT)
Docker のインストールとセットアップ
オプション 1: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
注: 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 を使用
-
プロジェクトのルートに、必要な環境変数を記載した
.envファイルを作成します。GITHUB_ENTERPRISE_URL=https://github.your-company.com/api/v3 GITHUB_TOKEN=your_github_token DEBUG=true -
Docker Compose でコンテナを起動します。
docker-compose up -d -
ログを確認します。
docker-compose logs -f -
コンテナを停止します。
docker-compose down
インストールとセットアップ
ローカル開発(並行モードを使用)
自動再コンパイルとサーバー再起動を利用して積極的に開発する場合は、この方法をおすすめします。
-
リポジトリをクローンし、必要なパッケージをインストールします。
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これにより、以下が実行されます。
- ファイルの変更時に TypeScript コードを自動的にコンパイル
- コンパイル済みファイルの更新時にサーバーを再起動
- URL ベースの接続用に HTTP モードでサーバーを実行
-
以下の説明に従い、URL モードを使用して Cursor に接続します。
本番環境向けのインストールとセットアップ
オプション 1:URL モードを使用する(ローカル開発に推奨)
この方法は最も安定しており、ローカル開発やテストにおすすめです。
-
リポジトリをクローンし、必要なパッケージをインストールします。
git clone https://github.com/ddukbg/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 -
URL モードを使用して Cursor に接続します。
- 次の内容を Cursor の
.cursor/mcp.jsonファイルに追加します。
{ "mcpServers": { "github-enterprise": { "url": "http://localhost:3000/sse" } } } - 次の内容を Cursor の
オプション 2:グローバルコマンドとしてインストールする(npm link)
この方法はローカル開発に便利です。
# 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
次の内容を 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_TOKEN と YOUR_GITHUB_ENTERPRISE_URL を実際の値に置き換えてください。
Cursor
推奨:URL モード(最も安定)
Cursor で最も安定して動作させるには、URL モードの使用をおすすめします。
-
別のターミナルウィンドウでサーバーを起動します。
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 -
Cursor の MCP 設定を構成します。
- Cursor を開き、Settings に移動します。
- AI > MCP Servers に移動します。
.cursor/mcp.jsonファイルを編集します。
{ "mcpServers": { "github-enterprise": { "url": "http://localhost:3000/sse" } } } -
Cursor を再起動して変更を適用します。
代替方法:コマンドモード
URL モードの方が安定していますが、コマンドモードを使用するよう Cursor を構成することもできます。
- Cursor を開き、Settings に移動します。
- AI > MCP Servers に移動します。
- Add MCP Server をクリックします。
- 次の詳細を入力します。
- Name:GitHub Enterprise
- Command:
npx - Arguments:
@ddukbg/github-enterprise-mcp - Environment Variables:
GITHUB_ENTERPRISE_URL:GitHub Enterprise API の URLGITHUB_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: 1ページあたりの項目数 | repo |
get-repository | リポジトリの詳細情報を取得します | owner: リポジトリの所有者repo: リポジトリ名 | repo |
list-branches | リポジトリのブランチ一覧を取得します | owner: リポジトリの所有者repo: リポジトリ名protected_only: 保護されたブランチのみを表示するかどうかpage: ページ番号perPage: 1ページあたりの項目数 | repo |
get-content | ファイルまたはディレクトリの内容を取得します | owner: リポジトリの所有者repo: リポジトリ名path: ファイル/ディレクトリのパスref: ブランチ/コミット(任意) | repo |
list-pull-requests | リポジトリのプルリクエスト一覧を取得します | owner: リポジトリの所有者repo: リポジトリ名state: PR の状態フィルターsort: 並べ替え基準direction: 並べ替え順page: ページ番号per_page: 1ページあたりの項目数 | 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 | リポジトリの Issue 一覧を取得します | owner: リポジトリの所有者repo: リポジトリ名state: Issue の状態フィルターsort: 並べ替え基準direction: 並べ替え順page: ページ番号per_page: 1ページあたりの項目数 | repo |
get-issue | Issue の詳細を取得します | owner: リポジトリの所有者repo: リポジトリ名issue_number: Issue 番号 | repo |
list-issue-comments | Issue またはプルリクエストのコメント一覧を取得します | owner: リポジトリの所有者repo: リポジトリ名issue_number: Issue/PR 番号page: ページ番号per_page: 1ページあたりの項目数 | repo |
create-issue | 新しい Issue を作成します | owner: リポジトリの所有者repo: リポジトリ名title: Issue のタイトルbody: Issue の本文labels: ラベル名の配列assignees: ユーザーログイン名の配列milestone: マイルストーン ID | repo |
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: Issue を有効/無効にするかどうかhas_projects: Projects を有効/無効にするかどうかhas_wiki: Wiki を有効/無効にするかどうかarchived: アーカイブ/アーカイブ解除 | repo |
delete-repository | リポジトリを削除します | owner: リポジトリの所有者repo: リポジトリ名confirm: 確認(true である必要があります) | delete_repo |
list-workflows | GitHub Actions ワークフロー一覧を取得します | owner: リポジトリの所有者repo: リポジトリ名page: ページ番号perPage: 1ページあたりの項目数 | actions:read |
list-workflow-runs | ワークフローの実行一覧を取得します | owner: リポジトリの所有者repo: リポジトリ名workflow_id: ワークフロー ID/ファイル名branch: ブランチで絞り込みstatus: ステータスで絞り込みpage: ページ番号perPage: 1ページあたりの項目数 | actions:read |
trigger-workflow | ワークフローを起動します | owner: リポジトリの所有者repo: リポジトリ名workflow_id: ワークフロー ID/ファイル名ref: Git リファレンスinputs: ワークフローの入力値 | actions:write |
get-license-info | GitHub Enterprise のライセンス情報を取得します | - | site_admin(管理者)アカウントが必要です |
get-enterprise-stats | GitHub Enterprise のシステム統計情報を取得します | - | site_admin(管理者)アカウントが必要です |
注:Enterprise 専用ツール(
get-license-infoおよびget-enterprise-stats)を使用するには、サイト管理者権限を持つユーザーが必要です。Fine-grained トークンでは Enterprise レベルの権限がサポートされない場合があるため、Classic Personal Access Token の使用をおすすめします。
Cursor でツールを使用する
MCP サーバーをセットアップし、接続するように Cursor を設定すると、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")
Issue の管理
# 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
)
ユーザー管理(Enterprise 専用)
これらの機能は 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="[email protected]",
name="New User",
company="ACME Inc."
)
# Update a user's information (Enterprise only)
mcp_github_enterprise_update_user(
username="octocat",
email="[email protected]",
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 設定(さまざまな環境変数とコマンドライン引数をサポート)
- エラー処理とタイムアウト管理の強化
- ユーザーフレンドリーなレスポンス形式とメッセージ
コントリビューション
コントリビューションを歓迎します。お気軽に Pull Request を送信してください。
ライセンス
ISC
コメント
AI アプリケーションが外部のツールやデータソースに統一的な方法で接続するためのオープンなプロトコルです。クライアントはモデルとの対話を担い、MCP サーバーはツール・リソース・プロンプトテンプレートを提供します。標準メッセージでやり取りするため、1 つのサーバーを複数のクライアントで再利用できます。
