Lean Github Mcp について
Lean Github Mcpは、19種類のツールでClaudeからGitHubのリポジトリ、Issue、PR、リリース、Actionsを管理するMCPサーバーです。応答を簡潔化してキャッシュし、Claudeに渡すデータ量を抑えます。
主な機能
- 0119種類のGitHub管理ツール
- 02IssueとPRの作成・管理
- 03差分、ファイル、コミットの閲覧
- 04ブランチとリリースの管理
- 05GitHub Actionsの一覧表示と実行
- 06API応答の簡潔化とキャッシュ
活用シーン
- 01Issueの分類と担当者の割り当て
- 02プルリクエストの確認とマージ
- 03ブランチ作成とリリース公開
- 04リポジトリのワークフロー実行
MCP 対応
stdio経由のMCPでClaudeをGitHub APIに接続します。リポジトリ、Issue、PR、ブランチ、ファイル、リリース、ワークフローを操作するツールを提供します。
設定
ローカルサーバーの設定はどのクライアントでも共通です。コピーしてクライアントの MCP 設定ファイルに貼り付けてください。
このサーバーのパッケージやリモートエンドポイントはまだ取得できていません。プロジェクトの README の手順に従ってください。
ツール
ローカルサーバーのツールはマシン上で起動して初めて取得できます。メンテナーはまだツール一覧を提供していません。
詳細
Lean GitHub MCP
Claude を通じて GitHub をすべて操作できます。自然な言葉で指示するだけです。
ブラウザーを開かずに、PR の作成、Issue の管理、ワークフローの実行、リリースの作成、差分のレビューができます。
公式 GitHub MCP より応答が 26 倍小さく、Claude のコンテキストウィンドウをより有効に使えます。
これは何ですか?
これは、Claude を GitHub API に直接接続する Model Context Protocol (MCP) サーバーです。インストールすると、GUI を使ったり、URL をコピー&ペーストしたり、作業のたびに画面を切り替えたりすることなく、自然な会話を通じて GitHub のワークフロー全体を管理できます。
Claude に次のように入力します:
Merge PR #47 with squash, delete the branch, then create a release v2.1.0 with those changes
Claude がすべて実行します。 API 呼び出し 3 回で完了です。
公式 GitHub MCP ではなく、こちらを選ぶ理由
| このサーバー | 公式 GitHub MCP | |
|---|---|---|
| セットアップ | npm install +トークン | Docker が必要 |
| 応答サイズ | 平均約 320 トークン | 2000 トークン以上(生の API 応答) |
| トークン効率 | null の削除、コンパクト化 | 生の JSON をそのまま転送 |
| キャッシュ | メモリー内に 120 秒間キャッシュ | キャッシュなし |
| ツール | 19 個 | 約 30 個 |
| デフォルトブランチ | 自動検出 | main に固定 |
| エラーメッセージ | ステータスコードを含む | 汎用メッセージ |
| ライセンス | MIT — どこでも利用可能 | MIT |
要するに: このサーバーは軽量さを重視して作られています。すべての応答から null 値を取り除き、適切に切り詰め、必要に応じてキャッシュします。Claude のコンテキストウィンドウを貴重なリソースとして扱います。
60 秒でセットアップ
オプション 1 — npx で実行(インストール不要):
GITHUB_TOKEN=ghp_your_token npx @noushad999/lean-github-mcp
オプション 2 — npm からグローバルにインストール:
npm install -g @noushad999/lean-github-mcp
lean-github-mcp
オプション 3 — Docker (近日公開):
docker run -e GITHUB_TOKEN=ghp_your_token ghcr.io/noushad999/lean-github-mcp
オプション 4 — ソースからクローン:
git clone https://github.com/noushad999/lean-github-mcp.git
cd lean-github-mcp
npm install && npm run build
echo "GITHUB_TOKEN=ghp_your_token" > .env
Claude Desktop — %APPDATA%\Claude\claude_desktop_config.json(Windows)または ~/Library/Application Support/Claude/claude_desktop_config.json(Mac)を編集します:
npx を使用する場合(最も簡単 — インストール不要):
{
"mcpServers": {
"github": {
"command": "npx",
"args": ["-y", "@noushad999/lean-github-mcp"],
"env": {
"GITHUB_TOKEN": "ghp_your_token_here"
}
}
}
}
ローカルビルドを使用する場合:
{
"mcpServers": {
"github": {
"command": "node",
"args": ["C:/absolute/path/to/lean-github-mcp/dist/index.js"],
"env": {
"GITHUB_TOKEN": "ghp_your_token_here"
}
}
}
}
Claude Code(CLI):
claude mcp add github -- node /absolute/path/to/lean-github-mcp/dist/index.js
Claude を再起動すれば完了です。
必要なトークン権限
github.com/settings/tokens?type=beta にアクセスし、Fine-grained token を選択します:
| 権限 | レベル | 使用するツール |
|---|---|---|
| Contents | 読み取りと書き込み | get_file、create_branch、delete_branch |
| Issues | 読み取りと書き込み | list_issues、create_issue、assign_issue、add_comment |
| Pull requests | 読み取りと書き込み | list_prs、create_pr、merge_pr、get_pr_diff |
| Actions | 読み取りと書き込み | list_workflows、trigger_workflow |
| Metadata | 読み取り | list_repos、get_repo |
利用可能なツール
リポジトリ
list_repos
任意のユーザーまたは組織のリポジトリを一覧表示します。
"Show me all of vercel's public repos sorted by recent activity"
| パラメーター | 型 | 必須 | デフォルト |
|---|---|---|---|
owner | string | はい | — |
type | owner | member | いいえ | owner |
get_repo
指定したリポジトリの詳細な統計情報を取得します。
"Tell me about facebook/react — stars, forks, language, open issues"
| パラメーター | 型 | 必須 |
|---|---|---|
owner | string | はい |
repo | string | はい |
Issue
list_issues
ラベルと担当者を含む Issue の一覧を取得します。
"Show all open bugs in my repo"
| パラメーター | 型 | 必須 | デフォルト |
|---|---|---|---|
owner | 文字列 | はい | — |
repo | 文字列 | はい | — |
state | open | closed | all | いいえ | open |
create_issue
ラベルを指定して新しい Issue を作成します。
"Create an issue titled 'Login crashes on Safari' with labels bug and priority"
| パラメーター | 型 | 必須 |
|---|---|---|
owner | 文字列 | はい |
repo | 文字列 | はい |
title | 文字列 | はい |
body | 文字列 | いいえ |
labels | 文字列[] | いいえ |
assign_issue
Issue または PR の担当者を追加または削除します。
"Assign issue #42 to alice and bob"
| パラメーター | 型 | 必須 | デフォルト |
|---|---|---|---|
owner | 文字列 | はい | — |
repo | 文字列 | はい | — |
issue_number | 数値 | はい | — |
assignees | 文字列[] | はい | — |
action | add | remove | いいえ | add |
プルリクエスト
list_prs
状態を指定してプルリクエストの一覧を取得します。
"What PRs are currently open in vercel/next.js?"
| パラメーター | 型 | 必須 | デフォルト |
|---|---|---|---|
owner | 文字列 | はい | — |
repo | 文字列 | はい | — |
state | open | closed | all | いいえ | open |
create_pr
プルリクエストを作成します。base を省略すると、リポジトリのデフォルトブランチを自動検出します。
"Create a PR from feat/dark-mode to main titled 'Add dark mode support'"
| パラメーター | 型 | 必須 | デフォルト |
|---|---|---|---|
owner | 文字列 | はい | — |
repo | 文字列 | はい | — |
title | 文字列 | はい | — |
body | 文字列 | いいえ | — |
head | 文字列 | はい | — |
base | 文字列 | いいえ | リポジトリのデフォルト |
get_pr_diff
プルリクエストの統合差分を取得します(最大 200 行)。
"Show me the diff for PR #88"
| パラメーター | 型 | 必須 |
|---|---|---|
owner | 文字列 | はい |
repo | 文字列 | はい |
pull_number | 数値 | はい |
merge_pr
選択した方法でマージします。
"Squash-merge PR #47 with title 'feat: dark mode'"
| パラメーター | 型 | 必須 | デフォルト |
|---|---|---|---|
owner | 文字列 | はい | — |
repo | 文字列 | はい | — |
pull_number | 数値 | はい | — |
method | merge | squash | rebase | いいえ | merge |
commit_title | 文字列 | いいえ | — |
ブランチ
create_branch
任意のベースからブランチを作成します。デフォルトブランチを自動検出します。
"Create branch fix/header-overflow from main"
| パラメーター | 型 | 必須 | デフォルト |
|---|---|---|---|
owner | 文字列 | はい | — |
repo | 文字列 | はい | — |
branch | 文字列 | はい | — |
base | 文字列 | いいえ | リポジトリのデフォルト |
delete_branch
ブランチを削除します(通常はマージ後に実行します)。
"Delete the feat/dark-mode branch, it's been merged"
| パラメーター | 型 | 必須 |
|---|---|---|
owner | 文字列 | はい |
repo | 文字列 | はい |
branch | 文字列 | はい |
コミットとファイル
list_commits
作成者とタイムスタンプを含む最近のコミット履歴を表示します。
"Show the last 5 commits on the main branch"
| パラメーター | 型 | 必須 | デフォルト |
|---|---|---|---|
owner | 文字列 | はい | — |
repo | 文字列 | はい | — |
branch | 文字列 | いいえ | リポジトリのデフォルト |
per_page | 1–10 | いいえ | 10 |
get_file
任意のブランチからファイルの内容を読み取ります。100 行を超えるファイルは切り詰められます。
"Show me the contents of src/auth.ts on the dev branch"
| パラメーター | 型 | 必須 | デフォルト |
|---|---|---|---|
owner | 文字列 | はい | — |
repo | 文字列 | はい | — |
path | 文字列 | はい | — |
branch | 文字列 | いいえ | リポジトリのデフォルト |
search_code
GitHub 全体からコードを検索します。
"Find all TypeScript files using useAuth hook"
| パラメーター | 型 | 必須 | デフォルト |
|---|---|---|---|
query | 文字列 | はい | — |
per_page | 1–10 | いいえ | 10 |
GitHub のコード検索 API では認証が必要で、レート制限は約 10 リクエスト/分です。結果は 120s 間キャッシュされます。
コメント
add_comment
任意の Issue またはプルリクエストにコメントします。
"Add a comment to PR #55 saying the deployment is ready for testing"
| パラメーター | 型 | 必須 |
|---|---|---|
owner | 文字列 | はい |
repo | 文字列 | はい |
issue_number | 数値 | はい |
body | 文字列 | はい |
リリース
get_release
最新のリリースを取得するか、特定のタグを検索します。
"What's the latest release of vercel/next.js?"
| パラメーター | 型 | 必須 | デフォルト |
|---|---|---|---|
owner | 文字列 | はい | — |
repo | 文字列 | はい | — |
tag | 文字列 | いいえ | latest |
create_release
リリースノートを付けて新しいリリースを公開します。
"Create release v2.1.0 on the main branch with the changelog I'll paste"
| Param | Type | Required | Default |
|---|---|---|---|
owner | string | はい | — |
repo | string | はい | — |
tag_name | string | はい | — |
name | string | いいえ | タグ名 |
body | string | いいえ | — |
draft | boolean | いいえ | false |
prerelease | boolean | いいえ | false |
target_commitish | string | いいえ | リポジトリのデフォルト |
GitHub Actions
list_workflows
リポジトリ内のすべてのワークフローを一覧表示します。
"What GitHub Actions workflows does this repo have?"
| Param | Type | Required |
|---|---|---|
owner | string | はい |
repo | string | はい |
trigger_workflow
オプションの入力値を指定して、ワークフローのディスパッチイベントをトリガーします。
"Trigger the deploy.yml workflow on the staging branch"
| Param | Type | Required | Default |
|---|---|---|---|
owner | string | はい | — |
repo | string | はい | — |
workflow_id | string | number | はい | — |
ref | string | いいえ | リポジトリのデフォルト |
inputs | object | いいえ | {} |
動作の仕組み
You (natural language)
│
▼
Claude AI
│ MCP Protocol (stdio)
▼
┌──────────────────────────────────┐
│ lean-github-mcp │
│ │
│ ┌─────────────────────────┐ │
│ │ 19 Tool Handlers │ │
│ └────────┬────────────────┘ │
│ │ │
│ ┌────────▼─────┐ ┌──────────┐ │
│ │ Token Guard │ │ Cache │ │
│ │ 4000 char │ │ 120s │ │
│ │ null strip │ │ 200 max │ │
│ └────────┬─────┘ └────┬─────┘ │
│ └──────┬───────┘ │
│ ▼ │
│ ┌──────────────────┐ │
│ │ GitHub Client │ │
│ │ Axios + Auth │ │
│ │ Status codes │ │
│ └──────────────────┘ │
└──────────────┬───────────────────┘
│ HTTPS
▼
api.github.com
トークン効率 — 重要な理由
MCP サーバーが送信するすべての応答は、Claude のコンテキストウィンドウを消費します。応答が膨大だと、Claude は会話の前半をより早く忘れてしまいます。このサーバーは、応答サイズを積極的に最小限に抑えます。
単一リポジトリに対する GitHub API の生の応答:
{
"id": 1296269,
"node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
"name": "Hello-World",
"full_name": "octocat/Hello-World",
"private": false,
"owner": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "...",
... 20 more owner fields
},
"html_url": "https://github.com/octocat/Hello-World",
"description": "This your first repo!",
... 80+ more fields, mostly null
}
約2,400トークン
このサーバーの応答:
{
"name": "Hello-World",
"full_name": "octocat/Hello-World",
"description": "This your first repo!",
"stars": 2045,
"forks": 1731,
"language": "JavaScript",
"open_issues": 12,
"updated_at": "2024-01-15T10:30:00Z",
"html_url": "https://github.com/octocat/Hello-World"
}
約90トークン — 26倍小さい
実際の会話例
PR ワークフロー全体:
You: Show me open PRs in my-org/my-repo
Claude: Found 3 open PRs:
#88 — "Add OAuth2 support" by sarah_dev
#91 — "Fix memory leak in worker" by john_k
#94 — "Upgrade to Node 22" by bot
You: Show me the diff for #91
Claude: [shows unified diff of the memory leak fix]
You: Looks good. Merge it with squash, then delete the branch
Claude: Done — squash merged PR #91 (sha: a3f9c21), deleted branch fix/memory-leak
You: Now create a release v3.2.1 from main with changelog: "Fixed memory leak in background workers"
Claude: Release v3.2.1 published — https://github.com/my-org/my-repo/releases/tag/v3.2.1
GitHub に対する4つの個別操作を、1回の会話で実行します。
自動トリアージ:
You: List open issues in my-org/api-server, assign the ones labeled "bug" to me
Claude: Found 4 open issues. 2 have the "bug" label (#34, #41).
Assigned #34 and #41 to you.
テスト
npm run build
npx tsx tests/simulate-10-users.ts
想定される出力:
╔══════════════════════════════════════════════════════════╗
║ GitHub MCP Server - 10 User Deployment Test ║
║ 19 Tools · Full Coverage Simulation ║
╚══════════════════════════════════════════════════════════╝
...
║ Total Tests: 49 ║
║ Passed: 49 ║
║ Failed: 0 ║
║ Pass Rate: 100.0 % ║
║ Null Fields Found: 0 ║
║ Avg Response: 319 tokens ║
╚══════════════════════════════════════════╝
🎉 ALL TESTS PASSED! Ready for production.
MCP Inspector を使ってライブで確認することもできます:
npx @modelcontextprotocol/inspector node dist/index.js
プロジェクト構成
lean-github-mcp/
├── src/
│ ├── index.ts # MCP server entry, tool registration
│ ├── github-client.ts # Axios client + getDefaultBranch helper
│ ├── middleware/
│ │ └── tokenGuard.ts # Response trimmer: null strip, compactify, 4000 char limit
│ ├── utils/
│ │ └── cache.ts # 120s TTL in-memory cache, max 200 entries
│ └── tools/ # 19 tool handlers (one file each)
│ ├── list_repos.ts
│ ├── get_repo.ts
│ ├── list_issues.ts
│ ├── create_issue.ts
│ ├── assign_issue.ts
│ ├── list_prs.ts
│ ├── create_pr.ts
│ ├── get_pr_diff.ts
│ ├── merge_pr.ts
│ ├── create_branch.ts
│ ├── delete_branch.ts
│ ├── list_commits.ts
│ ├── get_file.ts
│ ├── search_code.ts
│ ├── add_comment.ts
│ ├── get_release.ts
│ ├── create_release.ts
│ ├── list_workflows.ts
│ └── trigger_workflow.ts
├── tests/
│ └── simulate-10-users.ts # Full simulation test, 49 assertions
├── dist/ # Compiled JS (after npm run build)
├── package.json
├── tsconfig.json
└── .env.example
トラブルシューティング
GITHUB_TOKEN not set
cat .env # make sure GITHUB_TOKEN=ghp_... is there
GitHub API (403): Rate limited or insufficient permissions
- ファイングレインドトークンでは、リポジトリへの明示的なアクセス権が必要です。上記の権限表を確認してください
- コード検索の上限はより厳しく、約10リクエスト/分です。60秒待ってから再試行してください
GitHub API (404): Resource not found
ownerとrepoのスペルを再確認してください- プライベートリポジトリにアクセスするには、トークンにアクセス権が必要です
GitHub API (422): Unprocessable
- 通常、該当ブランチにすでに PR が存在するか、ブランチ名が無効であることを意味します
Claude Desktop での Command not found: node
- フルパスを使用してください:
C:\Program Files\nodejs\node.exe(Windows)、または Mac/Linux でwhich nodeを実行してください
コントリビューション
コントリビューションを歓迎します。新しいツールの追加方法、コード規約、PR チェックリストについては、手順ごとのガイド CONTRIBUTING.md をご覧ください。
ロードマップ
-
list_workflow_runs— ブランチの CI ステータスを確認 -
get_commit— 変更ファイルを含む、単一コミットの詳細を取得 -
compare_branches— 2つのブランチ間の差分を表示 -
update_file— ファイルの変更を直接コミット -
add_label/remove_label— ラベルを管理
追加してほしい機能があれば、issue を作成してください。
ライセンス
MIT — 自由にお使いください。
コメント
AI アプリケーションが外部のツールやデータソースに統一的な方法で接続するためのオープンなプロトコルです。クライアントはモデルとの対話を担い、MCP サーバーはツール・リソース・プロンプトテンプレートを提供します。標準メッセージでやり取りするため、1 つのサーバーを複数のクライアントで再利用できます。