Skip to main content
Glama

MCP Git/PR Assist

by dk-niwamoto

MCP Git/PR Assist

Claude AI用のGitおよびGitHubプルリクエスト操作を支援するMCP(Model Context Protocol)サーバーです。

機能

Git操作ツール

  • git_status - リポジトリの状態確認
  • create_branch - 新しいブランチの作成
  • stage_and_commit - 変更のステージングとコミット
  • push_branch - ブランチのプッシュ

GitHub操作ツール

  • open_pull_request - プルリクエストの作成
  • comment_pr - プルリクエストへのコメント追加

プロンプト

  • pr_description - プルリクエスト説明文テンプレートの生成

セットアップ

1. 依存関係のインストール

npm install

2. 環境変数の設定

.envファイルを作成し、以下の環境変数を設定してください:

# GitHub Personal Access Token (repo権限が必要) GITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx # Git作成者情報 GIT_AUTHOR_NAME=Your Name GIT_AUTHOR_EMAIL=your.email@example.com

3. GitHub Personal Access Tokenの取得

  1. GitHubの Settings > Developer settings > Personal access tokens にアクセス
  2. "Generate new token (classic)" をクリック
  3. 以下の権限を選択:
    • repo - プライベートリポジトリへのフルアクセス
    • public_repo - パブリックリポジトリへのアクセス
  4. 生成されたトークンを.envファイルに設定

Claude Codeでの使用方法

オプション1: MCP Inspector での動作確認

# サーバーを起動 npm run dev # 別のターミナルでInspectorを起動 npx @modelcontextprotocol/inspector

オプション2: Claude Code設定

Claude Codeのsettings.jsonに以下を追加:

{ "mcpServers": { "git-pr-assist": { "command": "node", "args": ["C:\\Users\\niwamoto\\Documents\\mcp-git-assist\\dist\\server.js"], "env": { "GITHUB_TOKEN": "your_token_here", "GIT_AUTHOR_NAME": "Your Name", "GIT_AUTHOR_EMAIL": "your.email@example.com" } } } }

使用例

基本的なGitワークフロー

1. git_status() でリポジトリの状態確認 2. create_branch(ref: "feature/new-feature") で新しいブランチ作成 3. [ファイル編集] 4. stage_and_commit(message: "Add new feature") でコミット 5. push_branch(ref: "feature/new-feature") でプッシュ 6. open_pull_request(...) でプルリクエスト作成

プルリクエスト作成例

// プルリクエストを作成 open_pull_request({ owner: "username", repo: "repository-name", base: "main", head: "feature/new-feature", title: "新機能の追加", body: "この変更は..." }) // コメントを追加 comment_pr({ owner: "username", repo: "repository-name", prNumber: 123, body: "レビューをお願いします!" })

トラブルシューティング

よくある問題

  1. 環境変数が設定されていません
    • .envファイルが正しく作成されているか確認
    • 必要な環境変数がすべて設定されているか確認
  2. GitHub認証エラー
    • Personal Access Tokenが有効か確認
    • トークンに必要な権限(repo)が付与されているか確認
  3. Git操作エラー
    • 対象ディレクトリがGitリポジトリか確認
    • リモートリポジトリが正しく設定されているか確認
  4. SSL証明書エラー
    • 企業ネットワーク環境の場合、IT部門に相談してください

ログの確認

サーバーのログを確認するには:

npm run dev 2>&1 | tee server.log

開発

ビルド

npm run build

型チェック

npx tsc --noEmit

ライセンス

ISC License

-
security - not tested
F
license - not found
-
quality - not tested

local-only server

The server can only run on the client's local machine because it depends on local resources.

Enables Git and GitHub pull request operations through Claude AI, including repository management, branch operations, commits, and PR creation/commenting. Streamlines development workflows by providing Git commands and GitHub API integration through natural language interactions.

  1. 機能
    1. Git操作ツール
    2. GitHub操作ツール
    3. プロンプト
  2. セットアップ
    1. 1. 依存関係のインストール
    2. 2. 環境変数の設定
    3. 3. GitHub Personal Access Tokenの取得
  3. Claude Codeでの使用方法
    1. オプション1: MCP Inspector での動作確認
    2. オプション2: Claude Code設定
  4. 使用例
    1. 基本的なGitワークフロー
    2. プルリクエスト作成例
  5. トラブルシューティング
    1. よくある問題
    2. ログの確認
  6. 開発
    1. ビルド
    2. 型チェック
  7. ライセンス

    MCP directory API

    We provide all the information about MCP servers via our MCP API.

    curl -X GET 'https://glama.ai/api/mcp/v1/servers/dk-niwamoto/sample_mcp'

    If you have feedback or need assistance with the MCP directory API, please join our Discord server