Git Sync Guardian
Provides AI-powered analysis of git diffs using local Ollama models to assess conflict risk and recommend sync strategies.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Git Sync GuardianStart monitoring my repo at /Users/me/my-project"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Git Sync Guardian
MCP Server that watches main for new commits and keeps your working branch in sync — powered by local AI (Ollama).
What it does
When you're working on a feature branch, main keeps moving. Git Sync Guardian:
Monitors
origin/mainat regular intervalsAnalyzes incoming changes with Ollama (local LLM) to assess conflict risk
Notifies you via macOS native dialogs with risk level and recommended strategy
Syncs your branch (rebase or merge) with automatic stash/unstash
Handles conflicts — offers manual resolution, AI-assisted (Claude Code), or abort
Related MCP server: Git Workflow MCP Server
Requirements
Node.js >= 18
Claude Code (MCP host)
Ollama running locally (optional — falls back to heuristics if unavailable)
macOS (notifications use
osascript)
Installation
Automatic (recommended)
curl -fsSL https://raw.githubusercontent.com/Mamisedra/git-sync-guardian/main/install.sh | bashThis will clone to ~/.git-sync-guardian, build, and register the MCP server in Claude Code automatically.
To install in a custom directory:
curl -fsSL https://raw.githubusercontent.com/Mamisedra/git-sync-guardian/main/install.sh | bash -s -- /path/to/installManual
git clone https://github.com/Mamisedra/git-sync-guardian.git
cd git-sync-guardian
npm install
npm run buildThen add to your ~/.claude.json:
{
"mcpServers": {
"git-sync-guardian": {
"command": "node",
"args": ["/absolute/path/to/git-sync-guardian/dist/index.js"]
}
}
}Restart Claude Code to load the server.
Usage
Git Sync Guardian exposes 4 tools in Claude Code:
init-sync — Start monitoring
> Use init-sync on /path/to/my-repoParameter | Default | Description |
| required | Absolute path to the git repo |
|
| Branch to watch |
|
| Git remote name |
|
| Check interval in minutes |
Note: You must be on a feature branch (not main) to start monitoring.
status — Check current state
> Check git-sync-guardian statusShows: monitoring state, divergence info, last analysis (strategy, risk level, conflict probability).
sync-now — Immediate sync
> Run sync-nowParameter | Default | Description |
|
|
|
Performs: fetch → stash → rebase/merge → unstash. Detects conflicts and offers resolution options.
stop-sync — Stop monitoring
> Stop git-sync-guardianHow the AI analysis works
When divergence is detected, the diff is sent to a local Ollama model which returns:
Strategy:
rebase(clean history) ormerge(safer for conflicts)Risk level:
low/medium/highConflict likelihood: 0–100%
Reasoning: Short explanation
If Ollama is unavailable, a heuristic fallback kicks in:
No common files modified → rebase, low risk
Common files modified → risk assessment based on overlap
Many commits behind (>20) → merge preferred
Configuration
Environment variables:
Variable | Default | Description |
|
| Ollama API endpoint |
|
| Ollama model for analysis |
|
| Log level: |
Architecture
src/
index.ts # MCP server entry point
server.ts # Tool registration (4 tools)
core/
sync-monitor.ts # Main monitoring loop & sync orchestration
git-operations.ts # Git commands (fetch, rebase, merge, stash)
diff-analyzer.ts # Ollama AI analysis + heuristic fallback
notifier.ts # macOS native notifications (osascript)
types/
index.ts # TypeScript interfaces & enums
utils/
config.ts # Default configuration
logger.ts # Structured stderr loggerLicense
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
Edit your Overleaf LaTeX projects from Claude and ChatGPT; every change is a real Git commit.
AI-native git hosting — repos, PRs, issues, CI gates, and AI code review over MCP (60 tools).
Plan Salesforce deploys, open pull requests and trigger pipelines from your AI client.
Connect AI assistants to your GitHub-hosted Obsidian vault to seamlessly access, search, and analy…
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables automated GitHub Pull Request reviews using local Ollama, Cursor CLI, or Gemini CLI as AI providers. Supports customizable review prompts, comprehensive PR analysis, and optional auto-posting of reviews to GitHub.5 npm5MIT
- FlicenseNot gradedqualityNot gradedmaintenanceEnables AI assistants to interact with local Git repositories for operations like status, commits, branching, and diffs, plus GitHub API integration for managing pull requests when authenticated.-
- AlicenseAqualityBmaintenanceProvides AI agents with persistent, branch-aware context memory by storing summaries per Git branch and automatically enriching them with recent commits and divergence from main. Enables agents to maintain coherent state across sessions without mixing contexts from different branches.38 npmMIT
- AlicenseNot gradedqualityBmaintenanceConnects AI tools to GitHub and local git repositories, enabling natural language management of issues, PRs, code analysis, and workflows.1MIT