null
Find a file
2025-12-27 02:41:38 +03:30
examples Add initial project structure with configuration files, main application logic, and testing framework. Includes Git hooks for pre-commit and pre-push validation, static analysis setup, and example test cases. 2025-12-27 02:33:36 +03:30
hooks Add initial project structure with configuration files, main application logic, and testing framework. Includes Git hooks for pre-commit and pre-push validation, static analysis setup, and example test cases. 2025-12-27 02:33:36 +03:30
pkg Update MCP server response handling: change ID field to be required in Response struct, and enhance request handling to ignore notifications without IDs while logging unknown methods. 2025-12-27 02:38:10 +03:30
scripts Add initial project structure with configuration files, main application logic, and testing framework. Includes Git hooks for pre-commit and pre-push validation, static analysis setup, and example test cases. 2025-12-27 02:33:36 +03:30
testcases Add initial project structure with configuration files, main application logic, and testing framework. Includes Git hooks for pre-commit and pre-push validation, static analysis setup, and example test cases. 2025-12-27 02:33:36 +03:30
.gitignore Add .gitignore file to exclude binaries, test outputs, and IDE files 2025-12-27 02:33:25 +03:30
.golangci.yml Add initial project structure with configuration files, main application logic, and testing framework. Includes Git hooks for pre-commit and pre-push validation, static analysis setup, and example test cases. 2025-12-27 02:33:36 +03:30
.mcp.example.yml Add initial project structure with configuration files, main application logic, and testing framework. Includes Git hooks for pre-commit and pre-push validation, static analysis setup, and example test cases. 2025-12-27 02:33:36 +03:30
.mcp.yml Add initial project structure with configuration files, main application logic, and testing framework. Includes Git hooks for pre-commit and pre-push validation, static analysis setup, and example test cases. 2025-12-27 02:33:36 +03:30
CODE_STANDARDS.md Add initial project structure with configuration files, main application logic, and testing framework. Includes Git hooks for pre-commit and pre-push validation, static analysis setup, and example test cases. 2025-12-27 02:33:36 +03:30
CONTRIBUTING.md Add initial project structure with configuration files, main application logic, and testing framework. Includes Git hooks for pre-commit and pre-push validation, static analysis setup, and example test cases. 2025-12-27 02:33:36 +03:30
go.mod Add initial project structure with configuration files, main application logic, and testing framework. Includes Git hooks for pre-commit and pre-push validation, static analysis setup, and example test cases. 2025-12-27 02:33:36 +03:30
go.sum Add initial project structure with configuration files, main application logic, and testing framework. Includes Git hooks for pre-commit and pre-push validation, static analysis setup, and example test cases. 2025-12-27 02:33:36 +03:30
LICENSE Add initial project structure with configuration files, main application logic, and testing framework. Includes Git hooks for pre-commit and pre-push validation, static analysis setup, and example test cases. 2025-12-27 02:33:36 +03:30
main.go Add initial project structure with configuration files, main application logic, and testing framework. Includes Git hooks for pre-commit and pre-push validation, static analysis setup, and example test cases. 2025-12-27 02:33:36 +03:30
Makefile Add initial project structure with configuration files, main application logic, and testing framework. Includes Git hooks for pre-commit and pre-push validation, static analysis setup, and example test cases. 2025-12-27 02:33:36 +03:30
README.md Add screenshots section to README and include example screenshot 2025-12-27 02:41:38 +03:30
screenshot-1.png Add screenshots section to README and include example screenshot 2025-12-27 02:41:38 +03:30
setup-cursor.sh Add initial project structure with configuration files, main application logic, and testing framework. Includes Git hooks for pre-commit and pre-push validation, static analysis setup, and example test cases. 2025-12-27 02:33:36 +03:30
test-mcp-connection.sh Add initial project structure with configuration files, main application logic, and testing framework. Includes Git hooks for pre-commit and pre-push validation, static analysis setup, and example test cases. 2025-12-27 02:33:36 +03:30

Git Guardian MCP

AI-powered Git hook validation using Model Context Protocol

License: MIT Go Version

Screenshots

Example 1

What is this?

Git Guardian MCP is a developer tool that validates code quality before commits and pushes. It works with AI assistants like Cursor through the Model Context Protocol (MCP).

Key Features:

  • 🔍 Analyzes unpushed commits
  • Multi-language static analysis (Go, Dart, Bash, JS/TS)
  • 🧪 Configurable test runner
  • 🤖 AI integration via MCP
  • 🚀 Git hooks automation

Quick Start

# Build
go build -o git-guardian-mcp

# Connect to Cursor
./setup-cursor.sh

# Install Git hooks (optional)
./scripts/install-hooks.sh

Usage

With Cursor AI

Once connected, just ask Cursor naturally:

"Check my code for issues before I push"
"Validate my unpushed commits"
"Run static analysis"

Command Line

# Analyze unpushed commits
./git-guardian-mcp  # runs as MCP server

# Install hooks
./scripts/install-hooks.sh

# Remove hooks
./scripts/uninstall-hooks.sh

Configuration

Create .mcp.yml in your repository:

tests:
  - name: go-tests
    command: go test ./...
    blocking: true
    timeout: 300

  - name: lint
    command: golangci-lint run
    blocking: true
    timeout: 120

MCP Tools

The server exposes these tools to AI assistants:

Tool Description
analyze_commits Analyze unpushed commits
run_checks Run static analysis
run_tests Execute test suite
explain_failure Get error explanations
validate_push Full pre-push validation

Static Analysis

Automatically runs for:

  • Go: gofmt, go vet, golangci-lint
  • Dart: dart analyze, flutter analyze
  • Bash: shellcheck
  • JS/TS: eslint

Project Structure

.
├── main.go              # Entry point
├── pkg/
│   ├── mcp/            # MCP server implementation
│   ├── git/            # Git operations
│   ├── analyzer/       # Static analysis
│   ├── config/         # Configuration loading
│   └── tests/          # Test runner
├── hooks/              # Git hook templates
├── scripts/            # Setup scripts
└── testcases/          # Example error cases

Development

# Build
make build

# Run tests
make test

# Format code
make fmt

# Install locally
make install

Requirements

  • Go 1.21+
  • Git
  • Optional: golangci-lint, shellcheck, eslint

License

MIT - See LICENSE

Contributing

See CONTRIBUTING.md and CODE_STANDARDS.md


Made for developers who care about code quality 🛡️