Skip to main content
Glama
git MCP server

git MCP server

Official

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

概要

Git リポジトリの操作と自動化のための Model Context Protocol サーバーです。このサーバーは、大規模言語モデル(LLM)を介して Git リポジトリを読み取り、検索し、操作するためのツールを提供します。

mcp-server-git は現在初期開発段階にあることにご注意ください。サーバーの開発と改善を継続する中で、機能や利用可能なツールは変更・拡張される可能性があります。

ツール

  1. git_status

    • ワーキングツリーの状態を表示します

    • 入力:

      • repo_path (string): Git リポジトリへのパス

    • 戻り値: ワーキングディレクトリの現在の状態をテキスト出力として返します

  2. git_diff_unstaged

    • ステージングされていないワーキングディレクトリの変更を表示します

    • 入力:

      • repo_path (string): Git リポジトリへのパス

      • context_lines (number, optional): 表示するコンテキスト行数 (デフォルト: 3)

    • 戻り値: ステージングされていない変更の diff 出力

  3. git_diff_staged

    • コミット用にステージングされた変更を表示します

    • 入力:

      • repo_path (string): Git リポジトリへのパス

      • context_lines (number, optional): 表示するコンテキスト行数 (デフォルト: 3)

    • 戻り値: ステージングされた変更の diff 出力

  4. git_diff

    • ブランチ間またはコミット間の差分を表示します

    • 入力:

      • repo_path (string): Git リポジトリへのパス

      • target (string): 比較対象のブランチまたはコミット

      • context_lines (number, optional): 表示するコンテキスト行数 (デフォルト: 3)

    • 戻り値: 現在の状態とターゲットを比較した diff 出力

  5. git_commit

    • リポジトリに変更を記録します

    • 入力:

      • repo_path (string): Git リポジトリへのパス

      • message (string): コミットメッセージ

    • 戻り値: 新しいコミットハッシュを含む確認メッセージ

  6. git_add

    • ファイルの内容をステージングエリアに追加します

    • 入力:

      • repo_path (string): Git リポジトリへのパス

      • files (string[]): ステージングするファイルパスの配列

    • 戻り値: ステージングされたファイルの確認

  7. git_reset

    • すべてのステージングされた変更をアンステージします

    • 入力:

      • repo_path (string): Git リポジトリへのパス

    • 戻り値: リセット操作の確認

  8. git_log

    • オプションの日付フィルタリングを使用してコミットログを表示します

    • 入力:

      • repo_path (string): Git リポジトリへのパス

      • max_count (number, optional): 表示するコミットの最大数 (デフォルト: 10)

      • start_timestamp (string, optional): コミットをフィルタリングするための開始タイムスタンプ。ISO 8601 形式 (例: '2024-01-15T14:30:25')、相対日付 (例: '2 weeks ago', 'yesterday')、または絶対日付 (例: '2024-01-15', 'Jan 15 2024') を受け付けます

      • end_timestamp (string, optional): コミットをフィルタリングするための終了タイムスタンプ。ISO 8601 形式 (例: '2024-01-15T14:30:25')、相対日付 (例: '2 weeks ago', 'yesterday')、または絶対日付 (例: '2024-01-15', 'Jan 15 2024') を受け付けます

    • 戻り値: ハッシュ、作成者、日付、メッセージを含むコミットエントリの配列

  9. git_create_branch

    • 新しいブランチを作成します

    • 入力:

      • repo_path (string): Git リポジトリへのパス

      • branch_name (string): 新しいブランチの名前

      • base_branch (string, optional): 作成元のベースブランチ (デフォルトは現在のブランチ)

    • 戻り値: ブランチ作成の確認

  10. git_checkout

  • ブランチを切り替えます

  • 入力:

    • repo_path (string): Git リポジトリへのパス

    • branch_name (string): チェックアウトするブランチの名前

  • 戻り値: ブランチ切り替えの確認

  1. git_show

  • コミットの内容を表示します

  • 入力:

    • repo_path (string): Git リポジトリへのパス

    • revision (string): 表示するリビジョン (コミットハッシュ、ブランチ名、タグ)

  • 戻り値: 指定されたコミットの内容

  1. git_branch

  • Git ブランチを一覧表示します

  • 入力:

    • repo_path (string): Git リポジトリへのパス

    • branch_type (string): ローカルブランチ ('local')、リモートブランチ ('remote')、またはすべてのブランチ ('all') のいずれを一覧表示するか

    • contains (string, optional): ブランチが含むべきコミット SHA。コミット SHA が指定されていない場合は、このパラメータに何も渡さないでください

    • not_contains (string, optional): ブランチが含むべきではないコミット SHA。コミット SHA が指定されていない場合は、このパラメータに何も渡さないでください

  • 戻り値: ブランチのリスト

Related MCP server: GitHub Tools MCP Server

インストール

uv を使用する場合 (推奨)

uv を使用する場合、特別なインストールは不要です。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 での使用

クイックインストールには、以下のワンクリックインストールボタンのいずれかを使用してください...

Install with UV in VS Code Install with UV in VS Code Insiders

Install with Docker in VS Code Install with Docker in VS Code Insiders

手動インストールの場合、以下のいずれかの方法で MCP サーバーを設定できます:

方法 1: ユーザー設定 (推奨) ユーザーレベルの MCP 設定ファイルに設定を追加します。コマンドパレット (Ctrl + Shift + P) を開き、MCP: Open User Configuration を実行します。これによりユーザーの mcp.json ファイルが開かれ、そこにサーバー設定を追加できます。

方法 2: ワークスペース設定 あるいは、ワークスペース内の .vscode/mcp.json というファイルに設定を追加することもできます。これにより、他のユーザーと設定を共有できます。

VS Code での MCP 設定の詳細については、公式 VS Code 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"]
    }
  }
},

Zencoder での使用

  1. Zencoder メニュー (...) に移動します

  2. ドロップダウンメニューから Agent Tools を選択します

  3. Add Custom MCP をクリックします

  4. 名前 (例: git) と以下のサーバー設定を追加し、必ず Install ボタンを押してください

{
    "command": "uvx",
    "args": ["mcp-server-git", "--repository", "path/to/git/repo"]
}

デバッグ

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 に以下を追加してください:

Docker

{
  "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 ファイルを参照してください。

Available Tools

14 tools
git_addC
Idempotent

Adds file contents to the staging area

Inputs: files (required), repo_path (required).

git_branchC
Read-onlyIdempotent

List Git branches

Inputs: repo_path (required), branch_type (required), contains, not_contains.

git_checkoutC

Switches branches

Inputs: repo_path (required), branch_name (required).

git_commitD

Records changes to the repository

Inputs: message (required), repo_path (required).

git_create_branchC

Creates a new branch from an optional base branch or commit

Inputs: repo_path (required), branch_name (required), base_branch.

git_diffB
Read-onlyIdempotent

Shows differences between branches or commits, or across a revision range (main..feature, main...feature)

Inputs: target (required), repo_path (required), context_lines.

git_diff_stagedB
Read-onlyIdempotent

Shows changes that are staged for commit

Inputs: repo_path (required), context_lines.

git_diff_unstagedB
Read-onlyIdempotent

Shows changes in the working directory that are not yet staged

Inputs: repo_path (required), context_lines.

git_logA
Read-onlyIdempotent

Shows the commit log, newest commit first. For the latest commits, pass only repo_path (and optionally max_count). start_timestamp and end_timestamp are optional filters for a date range: omit them unless a specific period is asked for, because a range that holds no commits returns none.

Inputs: repo_path (required), max_count, end_timestamp, start_timestamp.

git_mergeA
Idempotent

Merges a branch into the current branch. Fast-forward only unless fast_forward_only is false; refuses a dirty working tree, and aborts a merge that conflicts, leaving the repository unchanged

Inputs: repo_path (required), source_branch (required), fast_forward_only.

git_remoteA
Read-onlyIdempotent

Lists the repository's remotes with their fetch and push URLs, like git remote -v. Credentials embedded in a URL's userinfo, query values or fragment are shown as ; path segments are shown as configured

Inputs: repo_path (required).

git_resetB
DestructiveIdempotent

Unstages all staged changes

Inputs: repo_path (required).

git_showB
Read-onlyIdempotent

Shows the contents of a commit, or of a file or directory given as :

Inputs: revision (required), repo_path (required).

git_statusB
Read-onlyIdempotent

Shows the working tree status

Inputs: repo_path (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3/5.0

    Scored across 14 tools

    Disambiguation4/5

    Each tool maps to a recognizable git operation with mostly distinct targets: the three diff variants (git_diff, git_diff_staged, git_diff_unstaged) are the closest overlap, but their descriptions clearly scope each one. git_branch (list) vs git_create_branch (create) vs git_checkout (switch) are distinguishable, though an agent could occasionally reach for the wrong branch tool. No two tools appear to do the same thing.

    Naming Consistency4/5

    All 14 names share a uniform `git_` prefix and snake_case, and most mirror familiar git CLI verbs (log, show, checkout, merge, commit, add, reset). A few are noun-only (git_branch, git_status, git_remote) which deviates slightly from a strict verb_noun pattern, but this matches git conventions and stays predictable.

    Tool Count5/5

    14 tools sit squarely in the well-scoped range: one tool per core local git workflow (status, diff variants, add, commit, log, show, branch, checkout, merge, remote). Nothing feels redundant or padded.

    Completeness3/5

    Local read/write coverage is solid, but the lifecycle dead-ends at the remote boundary: there is no push, pull, or fetch, and no branch deletion, stash, tag, or remote-management operation. Merge and git_remote imply remote collaboration, so the missing publishing step is a notable gap an agent will hit.

    Maintenance

    ActivityActive
    ResponsivenessSyncing

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      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.
      28
      6,847 npm
      246
      Apache 2.0
    • A
      license
      B
      quality
      D
      maintenance
      A Model Context Protocol server that enables LLMs to interact with Git repositories, providing tools to read, search, and manipulate Git repositories through commands like status, diff, commit, and branch management.
      12
      MIT
    • A
      license
      C
      quality
      B
      maintenance
      A Model Context Protocol server that enables LLMs to interact with Git repositories, providing tools to read, search, and manipulate Git repositories through commands like status, diff, commit, and branch operations.
      22
      4
      MIT