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 では動作しません。
Related MCP server: GitHub MCP Server Plus
主な特徴
GitHub Enterpriseインスタンスからリポジトリリストを取得する
詳細なリポジトリ情報を取得する
リポジトリのブランチを一覧表示する
ファイルとディレクトリの内容を表示する
問題とプルリクエストを管理する
リポジトリ管理(作成、更新、削除)
GitHub Actionsワークフロー管理
ユーザー管理(ユーザーの一覧表示、作成、更新、削除、一時停止/一時停止解除)
企業統計にアクセスする
強化されたエラー処理とユーザーフレンドリーな応答フォーマット
はじめる
前提条件
Node.js 18以上
GitHub Enterpriseインスタンスへのアクセス
個人アクセストークン(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=trueDocker 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モードを使用してカーソルに接続します
生産のためのインストールとセットアップ
オプション 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 --debugURL モードを使用してカーソルに接続します。
カーソルの
.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/v3AIツールとの統合
クロードデスクトップ
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を実際の値に置き換えます。
カーソル
推奨: URL モード (最も安定)
カーソルで最も信頼性の高い操作を行うには、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カーソルの MCP 設定を構成します。
カーソルを開いて設定へ移動します
AI > MCPサーバーへ移動
.cursor/mcp.jsonファイルを編集します。
{ "mcpServers": { "github-enterprise": { "url": "http://localhost:3000/sse" } } }変更を適用するにはカーソルを再起動してください
代替手段: コマンドモード
あるいは、コマンド モードを使用するように Cursor を構成することもできますが、URL モードの方が信頼性が高いです。
カーソルを開いて設定へ移動します
AI > MCPサーバーへ移動
MCPサーバーの追加をクリック
次の詳細を入力してください。
名前: GitHub Enterprise
コマンド:
npx引数:
@ddukbg/github-enterprise-mcp環境変数:
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権限 |
| ユーザーまたは組織のリポジトリリストを取得する |
|
|
| 詳細なリポジトリ情報を取得する |
|
|
| リポジトリのブランチを一覧表示する |
|
|
| ファイルまたはディレクトリの内容を取得する |
|
|
| リポジトリ内のプルリクエストを一覧表示する |
|
|
| プルリクエストの詳細を取得する |
|
|
| 新しいプルリクエストを作成する |
|
|
| プルリクエストをマージする |
|
|
| リポジトリ内の問題を一覧表示する |
|
|
| 問題の詳細を取得する |
|
|
| 問題またはプルリクエストのコメントを一覧表示する |
|
|
| 新しい問題を作成する |
|
|
| 新しいリポジトリを作成する |
|
|
| リポジトリ設定を更新する |
|
|
| リポジトリを削除する |
|
|
| GitHub Actionsワークフローの一覧 |
|
|
| ワークフロー実行の一覧 |
|
|
| ワークフローをトリガーする |
|
|
| GitHub Enterprise ライセンス情報を取得する | - | site_admin(管理者)アカウントが必要です |
| GitHub 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