Skip to main content
Glama

git MCP server

Official

mcp-server-git: Git MCP サーバー

概要

Gitリポジトリのインタラクションと自動化のためのモデルコンテキストプロトコルサーバー。このサーバーは、大規模言語モデルを介してGitリポジトリの読み取り、検索、操作を行うツールを提供します。

mcp-server-gitは現在開発初期段階にあります。サーバーの開発と改良に伴い、機能と利用可能なツールは変更・拡張される可能性があります。

ツール

  1. git_status
    • 作業ツリーのステータスを表示します
    • 入力:
      • repo_path (文字列): Gitリポジトリへのパス
    • 戻り値: 作業ディレクトリの現在の状態をテキスト出力として返す
  2. git_diff_unstaged
    • 作業ディレクトリ内のまだステージングされていない変更を表示します
    • 入力:
      • repo_path (文字列): Gitリポジトリへのパス
    • 戻り値: ステージングされていない変更の差分出力
  3. git_diff_staged
    • コミットのためにステージングされた変更を表示します
    • 入力:
      • repo_path (文字列): Gitリポジトリへのパス
    • 戻り値: ステージングされた変更の差分出力
  4. git_diff
    • ブランチまたはコミット間の差異を表示します
    • 入力:
      • repo_path (文字列): Gitリポジトリへのパス
      • target (文字列): 比較する対象のブランチまたはコミット
    • 戻り値: 現在の状態とターゲットを比較した差分出力
  5. git_commit
    • リポジトリへの変更を記録する
    • 入力:
      • repo_path (文字列): Gitリポジトリへのパス
      • message (文字列): コミットメッセージ
    • 戻り値: 新しいコミットハッシュによる確認
  6. git_add
    • ファイルの内容をステージング領域に追加します
    • 入力:
      • repo_path (文字列): Gitリポジトリへのパス
      • files (文字列[]): ステージングするファイルパスの配列
    • 戻り値: ステージングされたファイルの確認
  7. git_reset
    • ステージングされたすべての変更をステージ解除します
    • 入力:
      • repo_path (文字列): Gitリポジトリへのパス
    • 戻り値: リセット操作の確認
  8. git_log
    • コミットログを表示します
    • 入力:
      • repo_path (文字列): Gitリポジトリへのパス
      • max_count (数値、オプション): 表示するコミットの最大数 (デフォルト: 10)
    • 戻り値: ハッシュ、作成者、日付、メッセージを含むコミットエントリの配列
  9. git_create_branch
    • 新しいブランチを作成します
    • 入力:
      • repo_path (文字列): Gitリポジトリへのパス
      • branch_name (文字列): 新しいブランチの名前
      • start_point (文字列、オプション): 新しいブランチの開始点
    • 戻り値: ブランチ作成の確認
  10. git_checkout
  • スイッチブランチ
  • 入力:
    • repo_path (文字列): Gitリポジトリへのパス
    • branch_name (文字列): チェックアウトするブランチの名前
  • 戻り値: ブランチ切り替えの確認
  1. git_show
  • コミットの内容を表示します
  • 入力:
    • repo_path (文字列): Gitリポジトリへのパス
    • revision (文字列):表示するリビジョン(コミットハッシュ、ブランチ名、タグ)
  • 戻り値: 指定されたコミットの内容
  1. git_init
  • Gitリポジトリを初期化する
  • 入力:
    • repo_path (文字列): gitリポジトリを初期化するディレクトリへのパス
  • 戻り値: リポジトリの初期化の確認

インストール

uvの使用(推奨)

uvを使用する場合、特別なインストールは必要ありません。uvx uvx使用してmcp-server-gitを直接実行します。

PIPの使用

あるいは、pip 経由でmcp-server-gitをインストールすることもできます。

pip install mcp-server-git

インストール後、次のコマンドを使用してスクリプトとして実行できます。

python -m mcp_server_git

構成

Claude Desktopでの使用

これをclaude_desktop_config.jsonに追加します:

"mcpServers": { "git": { "command": "uvx", "args": ["mcp-server-git", "--repository", "path/to/git/repo"] } }
  • 注: '/Users/username' を、このツールでアクセスできるようにするパスに置き換えてください。
"mcpServers": { "git": { "command": "docker", "args": ["run", "--rm", "-i", "--mount", "type=bind,src=/Users/username,dst=/Users/username", "mcp/git"] } }
"mcpServers": { "git": { "command": "python", "args": ["-m", "mcp_server_git", "--repository", "path/to/git/repo"] } }

VS Codeでの使用

素早くインストールするには、以下のワンクリック インストール ボタンのいずれかを使用します...

手動でインストールする場合は、VS Code のユーザー設定 (JSON) ファイルに次の JSON ブロックを追加します。Ctrl Ctrl + Shift + Pを押してPreferences: Open Settings (JSON)と入力すると、このブロックを追加できます。

オプションとして、ワークスペース内の.vscode/mcp.jsonというファイルに追加することもできます。これにより、他のユーザーと設定を共有できるようになります。

.vscode/mcp.jsonファイルではmcpキーは必要ないことに注意してください。

{ "mcp": { "servers": { "git": { "command": "uvx", "args": ["mcp-server-git"] } } } }

Docker インストールの場合:

{ "mcp": { "servers": { "git": { "command": "docker", "args": [ "run", "--rm", "-i", "--mount", "type=bind,src=${workspaceFolder},dst=/workspace", "mcp/git" ] } } } }

Zedでの使用

Zed のsettings.jsonに追加します:

"context_servers": [ "mcp-server-git": { "command": { "path": "uvx", "args": ["mcp-server-git"] } } ],
"context_servers": { "mcp-server-git": { "command": { "path": "python", "args": ["-m", "mcp_server_git"] } } },

デバッグ

MCPインスペクタを使用してサーバーをデバッグできます。UVXインストールの場合:

npx @modelcontextprotocol/inspector uvx mcp-server-git

または、パッケージを特定のディレクトリにインストールした場合や、そのディレクトリで開発している場合は、次のようにします。

cd path/to/servers/src/git npx @modelcontextprotocol/inspector uv run mcp-server-git

tail -n 20 -f ~/Library/Logs/Claude/mcp*.logを実行すると、サーバーのログが表示され、問題のデバッグに役立つ場合があります。

発達

ローカル開発を行っている場合、変更をテストする方法は 2 つあります。

  1. MCPインスペクタを実行して変更内容をテストしてください。実行手順についてはデバッグを参照してください。
  2. Claudeデスクトップアプリを使ってテストしclaude_desktop_config.json 。claude_desktop_config.json に以下のコードを追加してください。

ドッカー

{ "mcpServers": { "git": { "command": "docker", "args": [ "run", "--rm", "-i", "--mount", "type=bind,src=/Users/username/Desktop,dst=/projects/Desktop", "--mount", "type=bind,src=/path/to/other/allowed/dir,dst=/projects/other/allowed/dir,ro", "--mount", "type=bind,src=/path/to/file.txt,dst=/projects/path/to/file.txt", "mcp/git" ] } } }

UVX

{ "mcpServers": { "git": { "command": "uv", "args": [ "--directory", "/<path to mcp-servers>/mcp-servers/src/git", "run", "mcp-server-git" ] } }

建てる

Docker ビルド:

cd src/git docker build -t mcp/git .

ライセンス

このMCPサーバーはMITライセンスに基づいてライセンスされています。つまり、MITライセンスの条件に従って、ソフトウェアを自由に使用、改変、配布することができます。詳細については、プロジェクトリポジトリのLICENSEファイルをご覧ください。

-
security - not tested
A
license - permissive license
-
quality - not tested

local-only server

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

Gitリポジトリのインタラクションと自動化のためのモデルコンテキストプロトコルサーバー。このサーバーは、大規模言語モデルを介してGitリポジトリの読み取り、検索、操作を行うツールを提供します。

  1. 概要
    1. ツール
  2. インストール
    1. uvの使用(推奨)
    2. PIPの使用
  3. 構成
    1. Claude Desktopでの使用
    2. VS Codeでの使用
    3. Zedでの使用
  4. デバッグ
    1. 発達
      1. ドッカー
      2. UVX
    2. 建てる
      1. ライセンス

        Related MCP Servers

        • A
          security
          A
          license
          A
          quality
          A Model Context Protocol server that enables Large Language Models to interact with Git repositories through a robust API, supporting operations like repository initialization, cloning, file staging, committing, and branch management.
          Last updated -
          21
          482
          65
          TypeScript
          Apache 2.0
        • -
          security
          F
          license
          -
          quality
          Provides integration with Github through the Model Context Protocol (MCP), allowing Large Language Models to interact with Github's repositories, issues, pull requests and search functionality.
          Last updated -
          1
          TypeScript
          • Apple
        • -
          security
          F
          license
          -
          quality
          A Model Context Protocol server that enables AI assistants to perform GitHub operations including repository management, file operations, issue tracking, and pull request creation.
          Last updated -
          1
          TypeScript
        • -
          security
          A
          license
          -
          quality
          A Model Context Protocol server that generates prompts based on Git repository content, including a command to generate PR descriptions from diffs.
          Last updated -
          1
          Python
          MIT License

        View all related MCP servers

        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/modelcontextprotocol/git'

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