G

Git MCP Server

Provides comprehensive Git repository operations through MCP. Read commit history, view diffs, search logs, manage branches, and inspect repository state without direct CLI access.

MCPAnthropicgit workflowv1.0.0MIT
0 views0 copies

MCP Server Configuration

{ "mcpServers": { "git": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-git"] } } }

Available Tools

ToolDescription
git_statusShow working tree status
git_diff_unstagedShow unstaged changes
git_diff_stagedShow staged changes
git_diffShow diff between branches or commits
git_commitCreate a new commit
git_addStage files for commit
git_resetUnstage files
git_logView commit history
git_create_branchCreate a new branch
git_checkoutSwitch branches
git_showShow commit details
git_initInitialize a new repository
git_cloneClone a remote repository

Example Operations

# View recent commits with details
git_log: { repo_path: "/path/to/repo", max_count: 10 }

# Check current changes
git_status: { repo_path: "/path/to/repo" }

# View diff between branches
git_diff: { repo_path: "/path/to/repo", target: "main...feature-branch" }

# Create and switch to new branch
git_create_branch: { repo_path: "/path/to/repo", branch_name: "feat/new-feature" }

# Stage and commit
git_add: { repo_path: "/path/to/repo", files: ["src/index.ts"] }
git_commit: { repo_path: "/path/to/repo", message: "feat: add new feature" }

Setup

  1. Add the configuration to .claude/settings.json
  2. Git must be installed and available in PATH
  3. No API keys required
  4. Works with any local Git repository

Use Cases

  • Code review β€” View diffs, check commit history, understand changes
  • Branch management β€” Create, switch, and compare branches
  • Commit workflow β€” Stage, commit, and track changes
  • History analysis β€” Search commits, understand evolution of code

Security Notes

  • Only operates on local repositories β€” no remote push/pull operations
  • No credentials stored or managed
  • Repository path must be explicitly provided for each operation
  • Does not modify git config or hooks
  • Safe for read-heavy workflows β€” write operations (commit, reset) require explicit action
Community

Reviews

Write a review

No reviews yet. Be the first to review this template!

Similar Templates