hsx-git-tools
v1.1.0
Published
Complete Git operations MCP Server for Claude Code - Status, diff, log, commit, push, stash and more
Maintainers
Readme
hsx-git-tools
Complete Git operations MCP Server for Claude Code.
Features
This MCP server provides 20+ Git tools covering 90% of daily Git workflows. Claude can handle your Git operations without you switching to the terminal.
- Read-only queries: status, diff, log, show, branch, remote, blame
- Preview & Analysis: preview changes before commit, repository health check with sensitive info scanning
- Stash management: stash, list, pop
- Write operations: add, commit, checkout, fetch, pull, push, branch create, reset
Installation
Step 1: Add to Claude Code MCP
Windows (PowerShell):
claude mcp add-json hsx-git-tools -s user '{"command": "cmd", "args":["/c", "npx", "-y", "hsx-git-tools@latest"]}'macOS / Linux:
claude mcp add hsx-git-tools -- npx -y hsx-git-tools@latestManual configuration (edit ~/.mcp.json):
Windows:
{
"mcpServers": {
"hsx-git-tools": {
"command": "cmd",
"args": [
"/c",
"npx",
"-y",
"hsx-git-tools@latest"
]
}
}
}macOS / Linux:
{
"mcpServers": {
"hsx-git-tools": {
"command": "npx",
"args": [
"-y",
"hsx-git-tools@latest"
]
}
}
}Usage in Claude Code
Just ask Claude naturally, Claude will use the appropriate tools. Here are some examples:
Example Workflows
Workflow 1: Create a new feature branch and push it
create a new branch called feature/git-cleanup and push it to remoteClaude will:
- Check current status
- Create and checkout the new branch
- Push it to remote with upstream set
Workflow 2: Preview changes before commit
add all changed files and preview what will be committedClaude will:
- Add all files to staging
- Show you how many files/lines changed
- Automatically scan for sensitive information
- Warn you if any API keys or passwords detected!
- Help you write a good commit message based on the changes
Workflow 3: Quick save before switching branch
I need to switch to main to fix something, stash my current workClaude will:
- Stash your uncommitted changes
- Switch to main and pull latest
- After you're done, you can say "pop my stash" to continue working
Workflow 4: Check repository health
run a health check on this repositoryClaude will:
- Check repository size
- Find large files that shouldn't be committed
- Scan entire repo for accidentally committed sensitive info
- Check if
.gitignoreis complete - Give you optimization suggestions
More natural prompts:
- "show me git status"
- "what changes do I have"
- "show me the diff for file README.md"
- "show me the last 10 commits"
- "who changed this line in src/security-scan.js line 42"
- "list all stashes"
- "pop my latest stash"
- "checkout main and pull the latest changes"
- "commit all changes with message 'fix: sensitive info scan bug'"
- "push my current branch"
- "check the health of this repository"
Example MCP Call (if you need manual invocation)
{
"name": "git_preview_changes",
"arguments": {}
}{
"name": "git_status",
"arguments": {}
}{
"name": "git_repository_health",
"arguments": {}
}Available Tools
| Tool | Description |
|------|-------------|
| git_status | Get current working tree status |
| git_diff | Show diff of changes (all or specific file) |
| git_log | Get commit history with filtering |
| git_show | Show content of a specific commit |
| git_branch | List all branches |
| git_branch_create | Create new branch |
| git_remote | Show remote repository info |
| git_blame | Show line-by-line modification info |
| git_preview_changes | Preview staged changes, count lines, scan for sensitive info |
| git_repository_health | Check repository health (size, large files, sensitive info) |
| git_stash | Stash current changes |
| git_stash_list | List all stashes |
| git_stash_pop | Pop latest stash |
| git_add | Add file(s) to staging |
| git_commit | Commit staged changes |
| git_checkout | Switch branch |
| git_fetch | Fetch from remote |
| git_pull | Pull from remote |
| git_push | Push to remote |
| git_reset | Reset to specific commit (soft/mixed/hard) |
Key Features
1. Auto-detect Git repository
No configuration needed - automatically finds .git from current working directory upwards.
2. Pre-commit preview
Before you commit, Claude can preview:
- How many files changed
- How many lines added/removed
- Breakdown by file type
- Automatically scan for sensitive information (API keys, passwords, tokens) and warn you before commit!
3. Repository health check
- Checks repository size
- Finds large files (>1MB) that shouldn't be in Git
- Scans entire repository for accidentally committed sensitive info
- Checks
.gitignorecompleteness - Gives optimization suggestions
Safety Notes
- Dangerous operations like
git reset --hardare clearly marked in tool description - Claude will ask for your confirmation before executing dangerous operations
- All operations are logged via
console.errorwhich appears in Claude Code logs for debugging
How it works
Claude Code → hsx-git-tools (via MCP) → simple-git → your local Git repositoryUses the excellent simple-git library for all Git operations.
License
MIT
