Skip to main content
Glama

GuardGit MCP

Pre-Commit DevSecOps Safety Net & Structural Diff Cockpit for Autonomous AI Coding Agents

GuardGit MCP is an open-source (GNU AGPL-3.0, with Commercial Dual-Licensing available), zero-mutation SEP-1865 MCP App and CLI (npx guardgit-mcp) that protects repositories from the four most common failure modes of autonomous AI coding agents:

  1. Secret & Artifact Leakage (scan_precommit_guard): Catches .env files, AWS/OpenAI/Anthropic/GitHub/Stripe/Cloudflare/Google/Slack/npm tokens, JWTs, PEM private keys, database credentials, high-entropy assignments, large/binary blobs (>1 MB configurable), SQLite files, and build artifacts (node_modules/, dist/, .next/, *.vsix, *.db) — returning a 0-100 risk score, PASS / WARN / BLOCK verdict, redacted previews, .gitignore blocks, and copyable git rm --cached remediation commands.

  2. Unreadable Minified/Large JSON Diffs (diff_structural_json): Replaces 10,000-character single-line diffs in package.json, tsconfig.json, lockfiles, i18n locale dictionaries (en.json, tr.json), and Terraform/Kubernetes JSON with semantic key-level trees, keyed array matching, bulk-shift noise suppression, and automatic breaking-change flags.

  3. Blind Force-Pushes & Merge Surprises (analyze_blast_radius): Computes directory-level blast-radius heatmaps across sensitive surfaces (auth/RBAC, migrations, CI/CD, API contracts, runtime config) and executes strictly read-only, in-memory git merge-tree --write-tree conflict dry-runs against your target branch with zero working-tree mutations.

  4. 40-File AI Mega-Commits (plan_atomic_commits): Withholds blocked secrets/artifacts and groups safe changes into logically ordered Conventional Commits (build, ci, chore, feat, fix, refactor, test, docs) with ready-to-run staging commands.

Architecture

flowchart LR
    Host["MCP Host (Antigravity / Claude / Cursor / VS Code)"] <-->|"JSON-RPC stdio"| Server["GuardGit MCP Server (src/server.ts)"]
    Server -->|"ui://guardgit/cockpit.html (singlefile)"| UI["SEP-1865 Cockpit UI (iframe)"]
    UI <-->|"postMessage + @modelcontextprotocol/ext-apps"| Host
    Server --> Core["Pure TypeScript Core (src/core)"]
    Core --> G1["guardScan (Secrets + Entropy + Artifacts)"]
    Core --> G2["structuralJsonDiff (Key/Array Tree + Breaking Flags)"]
    Core --> G3["blastRadius + git merge-tree (Read-Only Dry Run)"]
    Core --> G4["planAtomicCommits (Conventional Commit Splitter)"]
    CLI["CLI (npx guardgit-mcp)"] --> Core

Related MCP server: sofagent

Quickstart

1. Run as an MCP Server (stdio)

npx guardgit-mcp

2. Run Directly in Terminal or CI Pre-Commit Hooks

# Scan working tree & staged diffs (exits code 2 on BLOCK with --strict)
npx guardgit-mcp scan . --strict

# Semantic JSON diff between two files (or git HEAD vs working tree)
npx guardgit-mcp diff old.json new.json
npx guardgit-mcp diff --repo . --file package.json --base HEAD

# Blast-radius score + read-only git merge-tree conflict dry-run
npx guardgit-mcp blast . --target main

# Generate an atomic Conventional Commit split plan
npx guardgit-mcp plan .

Host Configuration

Antigravity (Native SEP-1865 Plugin with Side Pane & Sidebar)

Build and copy the self-contained plugin bundle:

npm install
npm run build
cp -R ./plugin ~/.gemini/config/plugins/guardgit-mcp

PowerShell:

npm install; npm run build
Copy-Item -Recurse -Force ".\plugin" "$HOME\.gemini\config\plugins\guardgit-mcp"

Open GuardGit Cockpit directly from the side pane (+ menu) or the left sidebar.

Claude Desktop / Claude Code

Add to claude_desktop_config.json or .mcp.json:

{
  "mcpServers": {
    "guardgit": {
      "command": "npx",
      "args": ["-y", "guardgit-mcp"]
    }
  }
}

Cursor

Add to .cursor/mcp.json:

{
  "mcpServers": {
    "guardgit": {
      "command": "npx",
      "args": ["-y", "guardgit-mcp"]
    }
  }
}

Exposed MCP Tools & UI Resource

  • UI Resource: ui://guardgit/cockpit.html (text/html;profile=mcp-app, prefersBorder: false, bundled single-file HTML with zero external CDN calls).

  • open_guardgit_cockpit: Runs the full repo health overview (Guard + Blast Radius + Atomic Split + modified JSON detection) and opens the interactive cockpit (aux_pane and global entrypoints).

  • scan_precommit_guard: Scans a repository path, raw unified diff, or in-memory file array for secrets, high-entropy assignments, large blobs, binaries, and build artifacts.

  • diff_structural_json: Computes a semantic key/array diff with breaking-change flags on two JSON strings or a tracked Git file vs HEAD.

  • analyze_blast_radius: Scores commit blast radius (0-100), renders a folder-level heatmap, and runs a read-only git merge-tree --write-tree conflict dry-run.

  • plan_atomic_commits: Splits staged/unstaged changes into ordered Conventional Commits while automatically excluding blocked secrets and artifacts.

All tool arguments are optional; invoking any tool with {} returns a complete default view for the current working directory.

Development & Testing

npm install
npm run build
npm test

Security & Privacy

  • 100% local & read-only: GuardGit never pushes, checks out, resets, or mutates your working tree, and makes zero network requests.

  • Automatic redaction: Detected secret tokens are masked (sk-a***...***9f2a) before returning tool results so raw credentials are never echoed into LLM conversation logs.

License (Dual-Licensed: GNU AGPL-3.0 + Commercial)

  • Open-Source License (Free): Copyright (c) 2026 Hessam Mamagani. Licensed under the GNU Affero General Public License v3.0 (AGPL-3.0) — see LICENSE. Free for personal, open-source, and local developer CLI/MCP usage. Any modified or network-hosted derivative must remain open-source under AGPL-3.0 with original copyright attribution.

  • Commercial / Enterprise License: Organizations or developers wishing to embed GuardGit MCP inside proprietary/closed-source software, distribute modified closed-source derivatives, or license enterprise Pro integrations can obtain a commercial license — see COMMERCIAL_LICENSE.md.

Available Tools

5 tools
analyze_blast_radiusBlast-Radius & Merge-Tree Conflict AdvisorB

Analyze commit blast radius across sensitive paths (auth, migrations, CI/CD, API contracts, config) and execute a strictly read-only git merge-tree --write-tree dry-run conflict check against the target branch.

Inputs: files, repoPath, sourceRef, targetBranch.

diff_structural_jsonStructural JSON Diff EngineA

Compute a semantic key-level and keyed-array diff with automatic breaking-change detection for two JSON payloads or a tracked JSON file against HEAD.

Inputs: baseRef, newJson, oldJson, filePath, +2 more.

open_guardgit_cockpitGuardGit CockpitC

Open the interactive GuardGit DevSecOps Cockpit for a repository: runs pre-commit secret/artifact guard, blast-radius + read-only git merge-tree conflict check, atomic commit splitter, and structural JSON diff.

Inputs: repoPath, jsonFilePath, targetBranch.

plan_atomic_commitsAtomic Commit SplitterA

Group staged and unstaged repository changes into logically ordered Conventional Commits while automatically excluding blocked secrets and build artifacts.

Inputs: files, repoPath, excludeRisky.

scan_precommit_guardPre-Commit Secret & Artifact GuardA

Scan a repository, unified diff, or file list for leaked .env files, cloud/LLM API keys, JWTs, private keys, high-entropy secrets, large/binary blobs, local DBs, and build artifacts. Returns masked findings, 0-100 risk score, PASS/WARN/BLOCK verdict, and remediation commands.

Inputs: diff, files, repoPath, allowedPaths, +2 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 5 tools

    Disambiguation3/5

    Four tools are specialized and distinct, but open_guardgit_cockpit explicitly bundles their capabilities, so an agent may choose the cockpit instead of the specific scan, diff, analyze, or plan tool. The overlap is limited to one orchestrator, but it creates a real selection ambiguity.

    Naming Consistency5/5

    All names use snake_case with verb-first phrasing (open_, scan_, diff_, analyze_, plan_) and end with a clear object or domain noun. Minor variation in compound length does not break predictability.

    Tool Count5/5

    Five tools is well-scoped for a focused DevSecOps guard server, and each tool maps to a distinct stage of the pre-commit workflow. There is no redundant count pressure or thin single-tool surface.

    Completeness4/5

    The surface covers secret/artifact scanning, structural JSON diffing, blast-radius and conflict analysis, atomic commit planning, and an interactive cockpit. Minor gaps exist around applying remediations or configuring policies, but core guard workflows are covered.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      B
      maintenance
      Commit-time audit engine for AI coding agents. Scans git diffs with 24 audit rules, writes HMAC-signed tamper-evident audit history, and ships MCP tools for governance aggregation.
      104
      56
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Agentic DevOps control loop and MCP server featuring polyglot Tree-sitter AST blast-radius analysis, OPA Rego policy evaluation, and isolated --network=none Docker test verification[cite: 1]. Exposes tools to inspect impacted dependency closures, validate security guardrails, and run targeted test suites.
      3
      2
      Apache 2.0
    • A
      license
      B
      quality
      A
      maintenance
      Local stdio MCP server (diffci-mcp) that tells AI coding agents which tests and checks their change affects, explains why, and verifies the working tree before push, falling back to the full suite when evidence is incomplete. MIT, no account, sends nothing by default.
      9
      4
      MIT