mcp-server-git: Git MCP サーバー
概要
Git リポジトリの操作と自動化のための Model Context Protocol サーバーです。このサーバーは、大規模言語モデル(LLM)を介して Git リポジトリを読み取り、検索し、操作するためのツールを提供します。
mcp-server-git は現在初期開発段階にあることにご注意ください。サーバーの開発と改善を継続する中で、機能や利用可能なツールは変更・拡張される可能性があります。
ツール
git_statusワーキングツリーの状態を表示します
入力:
repo_path(string): Git リポジトリへのパス
戻り値: ワーキングディレクトリの現在の状態をテキスト出力として返します
git_diff_unstagedステージングされていないワーキングディレクトリの変更を表示します
入力:
repo_path(string): Git リポジトリへのパスcontext_lines(number, optional): 表示するコンテキスト行数 (デフォルト: 3)
戻り値: ステージングされていない変更の diff 出力
git_diff_stagedコミット用にステージングされた変更を表示します
入力:
repo_path(string): Git リポジトリへのパスcontext_lines(number, optional): 表示するコンテキスト行数 (デフォルト: 3)
戻り値: ステージングされた変更の diff 出力
git_diffブランチ間またはコミット間の差分を表示します
入力:
repo_path(string): Git リポジトリへのパスtarget(string): 比較対象のブランチまたはコミットcontext_lines(number, optional): 表示するコンテキスト行数 (デフォルト: 3)
戻り値: 現在の状態とターゲットを比較した diff 出力
git_commitリポジトリに変更を記録します
入力:
repo_path(string): Git リポジトリへのパスmessage(string): コミットメッセージ
戻り値: 新しいコミットハッシュを含む確認メッセージ
git_addファイルの内容をステージングエリアに追加します
入力:
repo_path(string): Git リポジトリへのパスfiles(string[]): ステージングするファイルパスの配列
戻り値: ステージングされたファイルの確認
git_resetすべてのステージングされた変更をアンステージします
入力:
repo_path(string): Git リポジトリへのパス
戻り値: リセット操作の確認
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') を受け付けます
戻り値: ハッシュ、作成者、日付、メッセージを含むコミットエントリの配列
git_create_branch新しいブランチを作成します
入力:
repo_path(string): Git リポジトリへのパスbranch_name(string): 新しいブランチの名前base_branch(string, optional): 作成元のベースブランチ (デフォルトは現在のブランチ)
戻り値: ブランチ作成の確認
git_checkout
ブランチを切り替えます
入力:
repo_path(string): Git リポジトリへのパスbranch_name(string): チェックアウトするブランチの名前
戻り値: ブランチ切り替えの確認
git_show
コミットの内容を表示します
入力:
repo_path(string): Git リポジトリへのパスrevision(string): 表示するリビジョン (コミットハッシュ、ブランチ名、タグ)
戻り値: 指定されたコミットの内容
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: GitLab 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 での使用
Zencoder メニュー (...) に移動します
ドロップダウンメニューから
Agent Toolsを選択しますAdd Custom MCPをクリックします名前 (例: 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-gittail -n 20 -f ~/Library/Logs/Claude/mcp*.log を実行するとサーバーからのログが表示され、問題のデバッグに役立つ場合があります。
開発
ローカル開発を行う場合、変更をテストする方法は2つあります:
MCP インスペクターを実行して変更をテストします。実行手順については デバッグ を参照してください。
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 ファイルを参照してください。
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Appeared in Searches
Latest Blog Posts
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
