git-filter-repo-mcp
Provides tools for analyzing and rewriting Git repository history, including commit message updates, author/date changes, file removal, path filtering, text replacement, secret scanning, and squashing commits.
Integrates with a local Ollama server to generate AI-assisted commit message rewrites for Git history.
Supports OpenAI as an AI provider for AI-generated commit message rewriting, using the configured OpenAI API key and model.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
git-filter-repo-mcp
MCP server for git-filter-repo - AI-assisted git history rewriting.
Features
Commit Rewriting - AI-powered message rewriting (Ollama/OpenAI/Anthropic/OpenAI-compatible local LLMs) or manual mappings
Author/Date Changes - Bulk update author info, move commits to evenings/weekends
File Operations - Remove files, large files, filter paths from history
Secret Scanning - Detect API keys, tokens, credentials with severity levels
Text Replacement - Find and replace across all commits
Backup/Restore - Auto-backup before every destructive operation
Squash Commits - Merge commit ranges into a single commit
Related MCP server: GitHub Auditor MCP Server
Requirements
Python 3.10+
git, git-filter-repo
(Optional) Ollama, LM Studio, vLLM, llama.cpp, LocalAI, OpenAI, Anthropic, or OpenRouter
Installation
git clone https://github.com/zacala1/git-filter-repo-mcp.git
cd git-filter-repo-mcp
uv syncMCP Setup
Add to Claude Desktop config:
Windows (%APPDATA%\Claude\claude_desktop_config.json):
{
"mcpServers": {
"git-filter-repo": {
"command": "uv",
"args": ["--directory", "C:\\path\\to\\git-filter-repo-mcp", "run", "git-filter-repo-mcp"],
"env": {
"GIT_FILTER_REPO_AI_PROVIDER": "lmstudio",
"GIT_FILTER_REPO_AI_MODEL": "local-model",
"LMSTUDIO_BASE_URL": "http://localhost:1234/v1"
}
}
}
}macOS/Linux (~/.config/claude/claude_desktop_config.json):
{
"mcpServers": {
"git-filter-repo": {
"command": "uv",
"args": ["--directory", "/path/to/git-filter-repo-mcp", "run", "git-filter-repo-mcp"],
"env": {
"GIT_FILTER_REPO_AI_PROVIDER": "ollama",
"GIT_FILTER_REPO_AI_MODEL": "llama3.2"
}
}
}
}Set GIT_FILTER_REPO_AI_PROVIDER=none if you want to disable AI rewrites.
Local LLM Token Offload
When rewrite_commit_messages or rewrite_single_commit runs with
use_ai: true, this MCP server calls the configured provider directly. The MCP
host still spends tokens to request the tool and read the result, but commit
message generation is handled by your local or third-party LLM instead of the
host model.
For commit-message rewrite calls, the provider receives the original commit message and changed file paths. Full file contents are not sent by the batch rewrite flow.
Environment Variables
Variable | Description | Default |
|
|
|
| Model name |
|
|
|
|
| Ollama server URL |
|
| OpenAI API key | - |
| Official OpenAI API base URL |
|
| Anthropic API key | - |
| Generic OpenAI-compatible API base URL |
|
| Optional key for OpenAI-compatible APIs | - |
| LM Studio local server URL |
|
| vLLM OpenAI-compatible server URL |
|
| llama.cpp OpenAI-compatible server URL |
|
| LocalAI OpenAI-compatible server URL |
|
| OpenRouter API key | - |
| OpenRouter API base URL |
|
Configuration Files
Configuration is loaded in this priority order:
Environment variables
Local project config:
./config.jsonUser config:
~/.config/git-filter-repo-mcp/config.jsonBuilt-in defaults
Use config.example.json as the template for either config file location. Local project config is useful when one repository should always use a specific local model or endpoint; environment variables are best for MCP host configuration such as Claude Desktop.
AI Provider Setup
Ollama
{
"GIT_FILTER_REPO_AI_PROVIDER": "ollama",
"GIT_FILTER_REPO_AI_MODEL": "llama3.2",
"OLLAMA_BASE_URL": "http://localhost:11434"
}LM Studio
Start the local server in LM Studio, then use:
{
"GIT_FILTER_REPO_AI_PROVIDER": "lmstudio",
"GIT_FILTER_REPO_AI_MODEL": "local-model",
"LMSTUDIO_BASE_URL": "http://localhost:1234/v1"
}Generic OpenAI-Compatible Endpoint
Use this for local or hosted services that expose /v1/chat/completions:
{
"GIT_FILTER_REPO_AI_PROVIDER": "openai-compatible",
"GIT_FILTER_REPO_AI_MODEL": "qwen2.5-coder",
"OPENAI_COMPATIBLE_BASE_URL": "http://localhost:1234/v1"
}Set OPENAI_COMPATIBLE_API_KEY if the endpoint requires auth.
OpenRouter
{
"GIT_FILTER_REPO_AI_PROVIDER": "openrouter",
"GIT_FILTER_REPO_AI_MODEL": "openai/gpt-4o-mini",
"OPENROUTER_API_KEY": "sk-or-..."
}Per-Call Overrides
The rewrite tools can override config for a single MCP call:
{
"repo_path": "/path/to/repo",
"use_ai": true,
"ai_provider": "lmstudio",
"ai_model": "local-model",
"ai_base_url": "http://localhost:1234/v1",
"ai_temperature": 0.2,
"ai_max_tokens": 120,
"dry_run": true
}check_ai_provider accepts the same provider override fields plus
check_connection. Set check_connection: false to resolve config without
contacting the model server.
{
"ai_provider": "lmstudio",
"ai_model": "local-model",
"ai_base_url": "http://localhost:1234/v1",
"check_connection": true
}Rewrite Modes
rewrite_commit_messages supports exactly one rewrite mode per call:
Mode | Arguments | Use when |
AI generation |
| You want the configured provider to generate messages |
Message mapping |
| You want to replace every matching old message string |
Commit mapping |
| You want to apply exact reviewed messages by commit hash |
Do not combine these modes in one call. Use dry_run: true first for every
mode, then apply with dry_run: false after reviewing the result.
Apply an Approved Preview Without AI
AI dry runs return both hash and hash_short for each proposed rewrite. After
reviewing the preview, apply exact messages without calling the AI provider
again by using manual_commit_mappings:
{
"repo_path": "/path/to/repo",
"manual_commit_mappings": {
"abc123def456": "feat: add provider diagnostics",
"789abc12": "docs: explain local llm setup"
},
"dry_run": false
}Keys may be full or abbreviated hexadecimal commit hashes. Abbreviations must match exactly one commit on the selected branch.
MCP Workflow
Typical local-LLM rewrite flow:
1. "Validate repo safety before rewriting /path/to/repo"
2. "List git-filter-repo MCP AI providers"
3. "Check the LM Studio AI provider"
4. "Rewrite commit messages in /path/to/repo using AI, dry run first"
5. "Apply the approved preview using manual_commit_mappings"Useful providers:
Provider | Base URL | Notes |
|
| Uses Ollama |
|
| API key usually not required |
|
| OpenAI-compatible |
|
| llama.cpp server |
|
| OpenAI-compatible |
| configurable | Generic local or third-party endpoint |
|
| Requires |
Tools (22)
Analysis (read-only)
Tool | Description |
| Commit stats, author breakdown, recent commits |
| Check branch, HEAD, clean worktree, upstream, backups before rewrites |
| Read-only large file discovery before removal |
| Resolve a commit ref to a full hash and metadata |
| Full details for a specific commit |
| Commit history for a specific file |
| All files that ever existed in the repo |
| Detect API keys, tokens, credentials |
AI Provider Tools
Tool | Description |
| Show supported local and hosted AI providers |
| Verify AI provider configuration before generation |
Modification (destructive - use dry_run: true first)
Tool | Description |
| AI or manual message rewriting |
| Edit one commit's message/author |
| Bulk author/email change |
| Move commits to evenings/weekends |
| Delete files from all history |
| Remove files above a size threshold |
| Keep or exclude specific paths |
| Search and replace across history |
| Merge a commit range into one |
AI Rewrite Options
rewrite_commit_messages supports these AI and mapping options:
Argument | Description |
| Enable provider-backed message generation |
| Provider override for this call |
| Model override for this call |
| Endpoint override for Ollama/OpenAI-compatible providers |
| Generation temperature, |
| Max tokens per generated commit message |
| Check provider before generation |
| Concurrent AI requests for batch rewrites |
| Limit rewrite generation to the newest N commits |
| Apply |
| Apply exact |
|
|
rewrite_single_commit supports the same AI provider overrides except
ai_max_concurrency and max_commits.
Backup
Tool | Description |
| Create a backup branch |
| List available backup branches |
| Restore from a backup branch |
Usage Examples
"Analyze /path/to/repo"
"Validate repo safety before rewriting"
"Find large files over 25MB"
"Check the LM Studio AI provider"
"Rewrite commits to conventional format"
"Apply the approved commit-message preview without calling AI again"
"Remove secrets.json from history"
"Change author old@email.com to new@email.com"
"Move commits to evening hours"
"Find files larger than 10MB"
"Scan for API keys"
"List backup branches"
"Squash the last 3 commits"Safety
All destructive tools default to
dry_run: trueBackups are automatically created before every destructive operation
Input validation blocks injection attempts (dash-prefixed args, invalid hashes)
Timeout protection prevents hanging on large repos
Use
git push --force-with-leaseafter changesCoordinate with team before shared branch changes
Development
uv sync --all-extras
uv run pytest tests/ -v # 545+ tests
uv run ruff check src/ tests/ # lint
uv run pyright src/ # type checkLicense
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
AI-native git hosting — repos, PRs, issues, CI gates, and AI code review over MCP (60 tools).
One searchable history across every AI coding tool, with secret scanning and a shared task board.
AI that works, like you: in your own files, with every change signed.
Generate changelogs, release emails, help-center articles, banners, and social posts from commits.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceVisualizes Git history and commit logs with before/after animations for operations like merge, rebase, and cherry-pick. Integrates with AI assistants to provide Git analysis tools and smart command suggestions through natural language.1MIT
- AlicenseNot gradedqualityDmaintenanceTransforms messy commit histories into clean, secure repositories by scanning for secrets, sanitizing history, and generating professional reports.2GPL 3.0
- AlicenseNot gradedqualityCmaintenanceProvides AI assistants with a Development Time Machine by analyzing git reflogs, commit history, working directory deltas, and shell history for temporal context, including safe git operations and smart commit generation.Apache 2.0
- AlicenseAqualityBmaintenanceEnables AI assistants to perform Git workflows with semantic commit messages, pre-PR secret audits, conflict resolution, and release changelog generation.5MIT