Git MCP

local-only server

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

Integrations

  • Supports configuration through environment variables that can be set directly or through a .env file, particularly for specifying the path to Git repositories.

  • Provides tools for managing local Git repositories, including listing repositories, retrieving and creating tags, listing commits, pushing tags to remote repositories, and refreshing repositories by pulling from remotes.

Git MCP

ローカル リポジトリでの Git 操作を管理するための MCP サーバー。

インストール

Smithery経由でインストール

Smithery経由で Claude Desktop 用の Git MCP を自動的にインストールするには:

npx -y @smithery/cli install @kjozsa/git-mcp --client claude

手動でインストールする

uvx install git-mcp

構成

次の JSON 構成スニペットを使用して MCP サーバーを追加します。

{ "mcpServers": { "git-mcp": { "command": "uvx", "args": ["git-mcp"], "env": { "GIT_REPOS_PATH": "/path/to/your/git/repositories" } } } }

機能と使用方法

環境変数

  • GIT_REPOS_PATH : Gitリポジトリを含むディレクトリへのパス(必須)

これを環境で設定するか、サーバーを実行するディレクトリに.envファイルを作成することができます。

利用可能な方法

リポジトリ一覧

設定されたパス内のすべての Git リポジトリを一覧表示します。

  • パラメータ: なし
  • 戻り値: リポジトリ名のリスト

最後のgitタグを取得する

指定されたリポジトリ内の最後の Git タグを検索します。

  • パラメータ: repo_name (Gitリポジトリの名前)
  • 戻り値: version (タグ名) とdate (タグ作成日) を含む辞書

最後のタグ以降のコミット一覧

最後の Git タグと HEAD 間のコミット メッセージを一覧表示します。

  • パラメータ:
    • repo_name : Gitリポジトリの名前
    • max_count (オプション): 返されるコミットの最大数
  • 戻り値: hashauthordatemessageを含む辞書のリスト

gitタグを作成する

指定されたリポジトリに新しい git タグを作成します。

  • パラメータ:
    • repo_name : Gitリポジトリの名前
    • tag_name : 作成するタグの名前
    • message (オプション):注釈付きタグのメッセージ(指定されていない場合は軽量タグを作成します)
  • 戻り値: statusversion (タグ名)、 date (タグ作成日)、 type (注釈付きまたは軽量) を含む辞書

プッシュ_git_tag

既存の git タグをデフォルトのリモート リポジトリにプッシュします。

  • パラメータ:
    • repo_name : Gitリポジトリの名前
    • tag_name : プッシュするタグの名前
  • 戻り値: statusremote (リモートの名前)、 tag (タグの名前)、 message (成功メッセージ) を含む辞書

リポジトリの更新

メイン ブランチ (またはフォールバックとしてのマスター) をチェックアウトし、すべてのリモートからプルしてリポジトリを更新します。

  • パラメータ:
    • repo_name : Gitリポジトリの名前
  • 戻り値: statusrepositorybranchpull_results (各リモートの結果)を含む辞書

トラブルシューティング

  • リポジトリが見つかりません: GIT_REPOS_PATHが正しく設定されており、リポジトリが存在することを確認してください
  • タグが見つかりません: リポジトリにはまだタグがありません

発達

# Install dependencies uv pip install -r requirements.txt # Run in dev mode with Inspector mcp dev git_mcp/server.py

テスト

このプロジェクトには 2 つのテスト スクリプトが含まれています。

  1. test_git_mcp.py - MCP サーバーを使用せずに、基礎となる Git コマンド機能を直接テストします。
  2. test_mcp_server.py - サーバー インスタンスを起動して呼び出しを行うことで、MCP サーバーの機能をテストします。

テストを実行するには:

# Test the Git command functionality python test_git_mcp.py # Test the MCP server (requires the git-mcp package to be installed) python test_mcp_server.py

You must be authenticated.

A
security – no known vulnerabilities
F
license - not found
A
quality - confirmed to work

ローカル リポジトリでの Git 操作を管理するための MCP サーバー。ユーザーは、標準化されたインターフェースを通じてリポジトリの一覧表示、タグの取得と作成、コミットの一覧表示、タグのプッシュ、リポジトリの更新を行うことができます。

  1. Installation
    1. Installing via Smithery
    2. Installing Manually
  2. Configuration
    1. Features and Usage
      1. Environment Variables
      2. Available Methods
      3. Troubleshooting
    2. Development
      1. Testing
        ID: s9v9iezy1u