Git MCP
ローカル リポジトリでの Git 操作を管理するための MCP サーバー。
インストール
Smithery経由でインストール
Smithery経由で Claude Desktop 用の Git MCP を自動的にインストールするには:
手動でインストールする
構成
次の JSON 構成スニペットを使用して MCP サーバーを追加します。
機能と使用方法
環境変数
GIT_REPOS_PATH
: Gitリポジトリを含むディレクトリへのパス(必須)
これを環境で設定するか、サーバーを実行するディレクトリに.env
ファイルを作成することができます。
利用可能な方法
リポジトリ一覧
設定されたパス内のすべての Git リポジトリを一覧表示します。
- パラメータ: なし
- 戻り値: リポジトリ名のリスト
最後のgitタグを取得する
指定されたリポジトリ内の最後の Git タグを検索します。
- パラメータ:
repo_name
(Gitリポジトリの名前) - 戻り値:
version
(タグ名) とdate
(タグ作成日) を含む辞書
最後のタグ以降のコミット一覧
最後の Git タグと HEAD 間のコミット メッセージを一覧表示します。
- パラメータ:
repo_name
: Gitリポジトリの名前max_count
(オプション): 返されるコミットの最大数
- 戻り値:
hash
、author
、date
、message
を含む辞書のリスト
gitタグを作成する
指定されたリポジトリに新しい git タグを作成します。
- パラメータ:
repo_name
: Gitリポジトリの名前tag_name
: 作成するタグの名前message
(オプション):注釈付きタグのメッセージ(指定されていない場合は軽量タグを作成します)
- 戻り値:
status
、version
(タグ名)、date
(タグ作成日)、type
(注釈付きまたは軽量) を含む辞書
プッシュ_git_tag
既存の git タグをデフォルトのリモート リポジトリにプッシュします。
- パラメータ:
repo_name
: Gitリポジトリの名前tag_name
: プッシュするタグの名前
- 戻り値:
status
、remote
(リモートの名前)、tag
(タグの名前)、message
(成功メッセージ) を含む辞書
リポジトリの更新
メイン ブランチ (またはフォールバックとしてのマスター) をチェックアウトし、すべてのリモートからプルしてリポジトリを更新します。
- パラメータ:
repo_name
: Gitリポジトリの名前
- 戻り値:
status
、repository
、branch
、pull_results
(各リモートの結果)を含む辞書
トラブルシューティング
- リポジトリが見つかりません:
GIT_REPOS_PATH
が正しく設定されており、リポジトリが存在することを確認してください - タグが見つかりません: リポジトリにはまだタグがありません
発達
テスト
このプロジェクトには 2 つのテスト スクリプトが含まれています。
test_git_mcp.py
- MCP サーバーを使用せずに、基礎となる Git コマンド機能を直接テストします。test_mcp_server.py
- サーバー インスタンスを起動して呼び出しを行うことで、MCP サーバーの機能をテストします。
テストを実行するには:
local-only server
The server can only run on the client's local machine because it depends on local resources.
Tools
ローカル リポジトリでの Git 操作を管理するための MCP サーバー。ユーザーは、標準化されたインターフェースを通じてリポジトリの一覧表示、タグの取得と作成、コミットの一覧表示、タグのプッシュ、リポジトリの更新を行うことができます。
Related Resources
Related MCP Servers
- AsecurityFlicenseAqualityMCP Server for the GitHub API, providing features for file operations, repository management, and advanced search, with automatic branch creation and comprehensive error handling.Last updated -1843TypeScript
- AsecurityAlicenseAqualityMCP Tool Server for Gitee, supporting the management of repository files/branches, Issues, and Pull Requests.Last updated -20104TypeScriptMIT License
- AsecurityFlicenseAqualityAn MCP server that enables integration with GitHub Enterprise API, allowing users to access repository information, manage issues, pull requests, workflows, and other GitHub features through Cursor.Last updated -162022TypeScript
- -securityAlicense-qualityAn MCP server that provides semantic search over local git repositories, enabling users to clone repositories, process branches, and search code through vectorized code chunks.Last updated -9TypeScriptMIT License