whyblame
Reads a repository's Git history to trace code lines and blocks back past cosmetic commits to the behavior-changing commit, and to identify protective code removed or weakened by edits.
Optionally fetches pull requests and issues via a read-only GITHUB_TOKEN, links merged pull requests to merge commits, and includes tickets and pull requests in provenance traces. Also runs as a GitHub Action to warn on pull requests that remove protective code.
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.
whyblame
git blame tells you who. whyblame tells you why.
PyPI · GitHub Marketplace · MCP registry (io.github.Anikketsingh/whyblame) · Release notes
git blame names the last commit that touched a line, and that is often a reformat, a rename or a move. whyblame traces the line back past those to the change that really gave it its behaviour, and attaches the ticket or pull request that explains it. It answers you in the terminal and a local web UI, and it answers AI coding agents over MCP, before they delete a check whose purpose they can't see.

Quickstart (about 30 seconds)
Needs Python 3.12+ and git. Run this inside any git repository:
uv tool install whyblame # or: pipx install whyblame, or: pip install whyblame
whyblame index # once per repo; later runs only add new commits
whyblame why . path/to/file.py 42 # the line's real historyThen give your AI agent the same answers:
whyblame initinit prints the exact command or config for Claude Code, Codex, Gemini CLI, VS Code, Cursor, LM Studio and Claude Desktop (with Claude Code it's claude mcp add whyblame -- whyblame mcp /absolute/path/to/repo). It also adds a short rule to AGENTS.md, CLAUDE.md, GEMINI.md and .cursor/rules/: check why_line before removing a guard. That rule is what makes smaller models actually call the tool. It sits between marker comments, so running init again changes nothing and your own text is never touched.
Any MCP client works with any tool-calling model, including local ones. The server runs on your machine, reads only git history, and needs no API key. It speaks stdio by default; whyblame mcp --http serves Streamable HTTP at http://127.0.0.1:8766/mcp for clients that take a URL. Every reply is plain JSON with a schema_version, stays under about 5,000 tokens (saying what was cut, if anything), and reports failures as a status, never a stack trace.
Related MCP server: coderadius
What the agent gets
Tool | What it answers |
| The commit that set this line's behaviour, the reformats it skipped to get there, and the linked tickets and pull requests |
| The same for a block, grouped by the commit that introduced each part |
| Before committing: which guards your edits removed or weakened, and why they were there |
| The tickets and pull requests behind the line. When none is linked, it searches for earlier ones, labelled "possibly unrelated". |
| A short explanation that cites that evidence, or "not enough evidence". Offered only when a Gemini key is configured. |
Safety:
Every tool is read-only.
Commit messages and ticket text come back in fields marked untrusted, because anyone can write a commit message, including one that tries to give your agent instructions.
Nothing is ever called "safe": finding no history only means none was found.
Protect pull requests
whyblame check lists the protective code a change removes or weakens: raise, assert, early-return checks, except and catch clauses, locks, timeouts. For each, it says which commit and ticket put the code there, and how strongly history backs it. Reformatting and moving code never trigger it.
whyblame check . # your uncommitted edits against HEAD
whyblame check . --base main --head HEAD # a branchThe same check runs on every pull request as a GitHub Action. It warns on the changed line and never blocks:

on: pull_request
permissions:
contents: read
jobs:
whyblame:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
- uses: Anikketsingh/Provenance-Aware-Code-Intelligence@v1Agents get the same check through the check_change MCP tool: call it after editing and before committing.
How it works
Classify. Every file change in history is parsed with tree-sitter. When the code's token stream is unchanged, the change was cosmetic (formatting, quotes, wrapping, renames, moves) and is recorded per file.
Skip.
git blamegets each file's own list of cosmetic commits through--ignore-revs-file, so git's well-tested line matching does the heavy lifting.Step. When a commit mixes a reformat with a real fix, the line is followed through that commit's diff, and the trace keeps walking back.
On a held-out test set of 60 lines from Django and Redis, this finds the right commit 83.5% of the time, against 69.2% for git's strongest settings (-w -M -C -C). It won on 20 lines and lost on 2 (McNemar p < 0.001).
How much difference it makes
Question | Without | With whyblame |
Right commit for a line (held-out, weighted) | 69.2% (git's best) | 83.5% |
Hidden ticket found in the top 10 (1,000 Django commits) | 56.9% (message keywords) | 60.7%; 39.6% even with the message hidden |
Abstains when the evidence is withheld | 10 of 10 | |
Claims backed by the evidence they cite | 51 of 53 | |
CI warning hits a guard that later had to be restored | 0.80% (base rate) | 2.7%, 3.3× the base rate |
Agent keeps the guard (16-case pilot, 32 paired runs) | 16 of 32 | 22 of 32, with as many tasks done (p = 0.031) |
Every number comes from eval/reproduce.py. The full results are in eval/results/summary.md, and the analysis, including where it doesn't help, is in reports/analysis.md. The labels are AI labels, as stated throughout.
More commands
whyblame index . --github # also fetch pull requests and issues (needs GITHUB_TOKEN)
whyblame explain . src/app.py 120 128 # a cited explanation of a block (needs GEMINI_API_KEY)
whyblame search . retry timeout # full-text search over fetched tickets and PRs
whyblame ui . # local web UI at http://127.0.0.1:8765With a read-only GITHUB_TOKEN, --github (or whyblame crawl-github .) links every merged pull request to its merge commit, so the trace shows the pull request that explains a change. Crawls resume where they stopped. For explain, put GEMINI_API_KEY=... in your environment or in a .env file. Replies are cached in the repo's index, so asking again is free and works offline.
The index lives inside your repo's git directory (.git/provenance/), so nothing appears in your working tree.
The research behind it
This is a B.Tech major project at Delhi Technological University, by Aniket Singh Kushwaha, Aarish and Aftab, guided by Prof. Shailender Kumar. The design is in plans/, and the full write-up is in reports/.
Development setup
uv sync
uv run pytest # Gemini is never called; `-m live` checks a real keyThe research corpus
The evaluation runs on pinned clones of four repos, addressed by name instead of path:
uv run provenance clone django && uv run provenance index django
uv run provenance fetch-tickets django --limit 300 # Trac tickets, 1 request a second
uv run provenance why django django/contrib/auth/hashers.py 114
uv run provenance ui # every indexed corpus repoprovenance and whyblame are the same command. Links like http://127.0.0.1:8765/#django:django/contrib/auth/hashers.py:114 open the UI at a line.
Reproducing the results
uv run python eval/reproduce.py # rescore everything that scores offline
uv run python eval/reproduce.py --full # also rerun the label-free checks, RQ2 and RQ4
uv run python eval/reproduce.py --footprint # also remeasure index time, RAM and latencyThis writes eval/results/summary.md, and every number in it comes from a saved run. The individual checks:
uv run python eval/ignore_list_eval.py django # compare with Django's hand-kept skip list
uv run python eval/ast_oracle.py django # check against Python's own parser
uv run python eval/method_gap.py # how often methods differ, plus a stress test
uv run python eval/score_gold.py --set test # RQ1: score every method on the held-out lines
uv run python eval/retrieval_bench.py # RQ2: find the hidden ticket
uv run python eval/explain_bench.py score # RQ3: explanations (saved Gemini replies)
uv run python eval/protect_bench.py --split test # RQ4: the CI check on held-out history
uv run python eval/agent_pilot.py score # RQ5: the agent pilot (saved transcripts)
uv run python eval/footprint.py # RQ6: cost on a laptopThe final report is built from these results by reports/final/build.py (Word and PDF).
The labelling rules are in eval/gold/RULES.md. The gold labels are AI labels: Claude labelled every line, and Gemini checked them blind. The rules file says exactly how.
Licence
Apache-2.0
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
Codebase intelligence for AI coding agents: graph, git history, docs, decisions, code health.
Codebase intelligence for AI agents — dead code, blast radius, ownership.
Code intelligence platform for AI agents. 20 tools for architecture, security & impact analysis.
Your coding agent asks the business logic of your repository and checks commits before they land
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to query project memory by linking code changes to the conversations that produced them, allowing retrieval of past decisions and constraints directly from the codebase.7 npmApache 2.0

coderadiusofficial
AlicenseNot gradedqualityCmaintenanceEnables AI agents to query architecture context, data contracts, and blast radius to prevent cross-repo architectural breakage before merging.22Apache 2.0- FlicenseNot gradedqualityDmaintenanceEnables tracing any line in a local git repository back to the commit that actually introduced it and the PR/review discussion behind it, overcoming git blame's misleading last-touch attribution.-
- AlicenseNot gradedqualityAmaintenanceEnables AI coding agents to access evidence-backed repository memory, code graph, project DNA, and deterministic change validation so they understand design decisions, past bugs, and invariants while working.1,722 npm17Functional Source , Version 1.1, ALv2 Future