GitArchaeologist-MCP
README.md
# GitArchaeologist-MCP: 100% Offline Git Graph & AST Blast-Radius Intelligence
[](https://www.python.org/downloads/)
[](https://opensource.org/licenses/Apache-2.0)
[-purple.svg)]()
[]()
> **Architect & Author:** Chethan Raj D S (`chethanraj.d.s@gmail.com`)
> **Credentials:** IIT Delhi Executive CTO Alumnus · B.E. Electrical & Electronics Engineering (85.60%)
> **Engineering Focus:** High-Performance Developer Tooling · AST Code Analysis · Offline Systems · Zero-Trust Architecture
---
## 1. Executive Overview
**GitArchaeologist-MCP** is an open-source, 100% offline **Model Context Protocol (MCP)** server engineered to give AI coding assistants (**Claude Code**, **Cursor**, **Windsurf**, **GitHub Copilot**, **Antigravity**) deep structural repository intelligence directly from local `.git` trees and Abstract Syntax Trees (AST).
Standard AI coding agents fail on real-world codebases because:
1. **Context Window Exhaustion:** Running raw `git diff` on dirty branches returns thousands of lines of noise, overflowing the LLM context window.
2. **Ignorance of Blast Radius:** LLMs modify a shared function signature without realizing it breaks 14 downstream callers across 6 other files.
3. **No Historical Intent:** Line-by-line `git blame` gets poisoned by formatting, whitespace, or linter PRs, hiding the original architectural intent.
**GitArchaeologist-MCP solves this completely offline with zero API keys and zero network egress.**
```
┌─────────────────────────────────────────┐
│ AI Coding Agent (Claude Code/Cursor) │
└────────────────────┬────────────────────┘
│
JSON-RPC 2.0 over Stdio
│
▼
┌─────────────────────────────────────────────────────────────────────────────┐
│ GitArchaeologist MCP Server Engine │
├───────────────────────────────┬─────────────────────────────────────────────┤
│ AST Static Analysis Core │ Native Git Operations Core │
│ • Top-level & Class Symbols │ • Porcelain Blame Parser │
│ • Call-Site Graph Visitor │ • Working Tree Bounded Diff │
│ • Topological Blast Radius │ • File Churn Velocity Engine │
│ • Quantitative Risk Scoring │ • Commit Archaeology Log │
└───────────────┬───────────────┴──────────────────────┬──────────────────────┘
│ │
▼ ▼
[ Local Python Source ] [ Local .git Tree ]
(Pure In-Memory AST) (Packfiles & Reflog)
```
---
## 2. Core Capabilities & MCP Tools
### 1. `git_blast_radius` (Topological Impact Analysis)
* **What it does:** Before an agent modifies a function, class, or file, this tool parses the entire repository AST to identify every direct and indirect caller.
* **Risk Scoring:** Outputs a deterministic risk score (`0.0` to `10.0`) and categorization (`LOW`, `MEDIUM`, `HIGH`, `CRITICAL`), accompanied by actionable regression test targets.
### 2. `git_semantic_blame` (AST-Scoped Lineage)
* **What it does:** Eliminates noise from formatting and whitespace commits. Identifies the exact line boundaries of a target symbol (function/class) and analyzes author distribution, original creation commit, and latest functional change.
### 3. `git_churn_hotspots` (Instability Detector)
* **What it does:** Scans recent commit history to calculate the modification velocity (commits, lines added, lines deleted) across all files in the repository. Flags architectural hotspots that suffer from frequent regressions.
### 4. `git_working_tree_status` (Token-Bounded Diff Summary)
* **What it does:** Generates a structured breakdown of staged, unstaged, and untracked changes, accompanied by a token-bounded diff preview (default: 1,500 chars). Protects the LLM from context blowout.
### 5. `git_commit_archaeology` (Historical Intent Retrieval)
* **What it does:** Extracts chronological commit history, author rationale, and change descriptions for specific files.
---
## 3. Installation & Integration
### Option A: Cursor IDE (`.cursor/mcp.json`)
```json
{
"mcpServers": {
"gitarchaeologist": {
"command": "python",
"args": ["-m", "gitarchaeologist.mcp.server"],
"cwd": "/path/to/your/project"
}
}
}
```
### Option B: Claude Code CLI
```bash
claude mcp add gitarchaeologist -- python -m gitarchaeologist.mcp.server
```
### Option C: Claude Desktop (`claude_desktop_config.json`)
```json
{
"mcpServers": {
"gitarchaeologist": {
"command": "python",
"args": ["-m", "gitarchaeologist.mcp.server"],
"cwd": "/absolute/path/to/gitarchaeologist-mcp"
}
}
}
```
---
## 4. Standalone CLI Usage
GitArchaeologist can also be run as a standalone developer CLI:
```bash
# Check working tree status
python -m gitarchaeologist.cli status
# Calculate blast radius for a symbol
python -m gitarchaeologist.cli blast-radius compute_hash
# Perform semantic blame on a function
python -m gitarchaeologist.cli blame module_a.py compute_hash
# Inspect repository churn hotspots
python -m gitarchaeologist.cli hotspots
```
---
## 5. Verification & Test Suite
The test suite runs 100% offline with zero external network access:
```bash
# Clone the repository
git clone https://github.com/Chethan-Raj-D-S/gitarchaeologist-mcp.git
cd gitarchaeologist-mcp
# Run full test suite
pytest tests/ -v
```
**Verification Results:**
```text
tests/test_ast_analyzer.py::test_extract_symbols PASSED
tests/test_ast_analyzer.py::test_find_callers PASSED
tests/test_ast_analyzer.py::test_semantic_blame PASSED
tests/test_blast_radius.py::test_blast_radius_for_symbol PASSED
tests/test_blast_radius.py::test_blast_radius_for_file PASSED
tests/test_blast_radius.py::test_blast_radius_isolated_symbol PASSED
tests/test_git_ops.py::test_git_repo_detection PASSED
tests/test_git_ops.py::test_working_tree_clean PASSED
tests/test_git_ops.py::test_working_tree_dirty_detection PASSED
tests/test_git_ops.py::test_file_commits_history PASSED
tests/test_git_ops.py::test_churn_hotspots PASSED
tests/test_mcp_server.py::test_mcp_initialize PASSED
tests/test_mcp_server.py::test_mcp_tools_list PASSED
tests/test_mcp_server.py::test_mcp_call_blast_radius PASSED
tests/test_mcp_server.py::test_mcp_call_working_tree_status PASSED
tests/test_mcp_server.py::test_mcp_call_unknown_tool PASSED
============================= 16 passed in 21.79s =============================
```
---
## 6. Architecture & Directory Structure
```
gitarchaeologist-mcp/
├── pyproject.toml # Modern package spec & dependencies
├── README.md # Architectural documentation
├── SKILL.md # AI Agent instruction specification
├── LICENSE # Apache 2.0 open-source license
├── gitarchaeologist/
│ ├── __init__.py # Package exports
│ ├── cli.py # Standalone CLI entrypoint
│ ├── core/
│ │ ├── __init__.py
│ │ ├── git_ops.py # Low-latency native git wrapper
│ │ ├── ast_analyzer.py # AST symbol extraction & blast radius
│ │ └── models.py # Pydantic schemas for reports & metrics
│ └── mcp/
│ ├── __init__.py
│ ├── protocol.py # MCP protocol schemas
│ └── server.py # JSON-RPC 2.0 stdio MCP server
└── tests/
├── conftest.py # Mock Git repo fixtures
├── test_git_ops.py # Git operations verification
├── test_ast_analyzer.py # AST symbol & caller tests
├── test_blast_radius.py # Blast radius risk score tests
└── test_mcp_server.py # JSON-RPC stdio protocol tests
```
---
## 7. License
Licensed under the Apache License, Version 2.0.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues