# whyblame

> whyblame is an open-source MCP server for developer tools. Traces why a line of code exists past reformats to the commit and ticket behind it. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, API, VS Code, Self-hosted, Linux, macOS, Windows
- **Repository:** https://github.com/anikketsingh/provenance-aware-code-intelligence
- **MCP Registry name:** io.github.Anikketsingh/whyblame
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-11-27

## About

Plain git blame points at the last commit that touched a line, which is often a reformat or rename. whyblame follows that line back through cosmetic changes to the commit that actually set its behaviour, then attaches the linked tickets and pull requests that explain it.

It runs locally as a Python package with a terminal interface, a small web UI and an MCP server over stdio or Streamable HTTP. Its check command flags guards such as raise, assert, lock and timeout code that a change removes or weakens, and a GitHub Action can post those warnings on pull requests without blocking merges.

It suits developers who inherit unfamiliar code and coding agents that might delete a check whose purpose they cannot see. Reading git history needs no API key; the explain_line tool only appears when a Gemini key is configured.

## Features

- **Cosmetic change skipping:** Follows a line past formatting, quoting, wrapping, renames and moves to find the change that gave it its behaviour.
- **Linked ticket lookup:** Attaches tickets and pull requests to a line, and searches for earlier related discussions when none is linked.
- **Guard removal check:** Lists protective code such as raises, asserts, locks and timeouts that a change removes or weakens, with the commit that added it.
- **GitHub Action warnings:** Runs the guard check on pull requests and posts warnings on changed lines without blocking the merge.
- **Agent tools over MCP:** Exposes read-only tools for line history, range history, change checks and discussion search to AI coding clients.
- **Local web UI and search:** Browse traced history in a local web interface and run full-text search over fetched tickets and pull requests.

## Good for

- Finding out why a defensive check exists before removing it during a refactor
- Giving an AI coding agent history context before it edits protected code
- Reviewing a branch for removed guards before merging
- Tracing an inherited line back to the ticket that motivated it

## Install

### Claude Code: Add with the CLI (Terminal)

```sh
claude mcp add whyblame --env GEMINI_API_KEY='<GEMINI_API_KEY>' -- uvx whyblame
```

Add --scope user to use it in every project, or --scope project to share it in .mcp.json.

### Claude Code: Or share it with your project (.mcp.json)

```json
{
  "mcpServers": {
    "whyblame": {
      "command": "uvx",
      "args": [
        "whyblame"
      ],
      "env": {
        "GEMINI_API_KEY": "<GEMINI_API_KEY>"
      }
    }
  }
}
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "whyblame": {
      "command": "uvx",
      "args": [
        "whyblame"
      ],
      "env": {
        "GEMINI_API_KEY": "<GEMINI_API_KEY>"
      }
    }
  }
}
```

Settings → Developer → Edit Config, then quit and reopen Claude Desktop.

### Cursor (~/.cursor/mcp.json)

```json
{
  "mcpServers": {
    "whyblame": {
      "command": "uvx",
      "args": [
        "whyblame"
      ],
      "env": {
        "GEMINI_API_KEY": "<GEMINI_API_KEY>"
      }
    }
  }
}
```

Use .cursor/mcp.json in a project to share it with the project.

### VS Code (~/.copilot/mcp-config.json)

```json
{
  "mcpServers": {
    "whyblame": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "whyblame"
      ],
      "env": {
        "GEMINI_API_KEY": "<GEMINI_API_KEY>"
      }
    }
  }
}
```

Or put the same entry in .mcp.json at your workspace root to share it.

### Codex: Add with the CLI (Terminal)

```sh
codex mcp add whyblame --env GEMINI_API_KEY='<GEMINI_API_KEY>' -- uvx whyblame
```

### Codex: Or add to config.toml (~/.codex/config.toml)

```toml
[mcp_servers.whyblame]
command = "uvx"
args = ["whyblame"]
env = { GEMINI_API_KEY = "<GEMINI_API_KEY>" }
```

### Gemini CLI and Antigravity: Gemini CLI (~/.gemini/settings.json)

```json
{
  "mcpServers": {
    "whyblame": {
      "command": "uvx",
      "args": [
        "whyblame"
      ],
      "env": {
        "GEMINI_API_KEY": "<GEMINI_API_KEY>"
      }
    }
  }
}
```

Or run: gemini mcp add -s user -e GEMINI_API_KEY='<GEMINI_API_KEY>' whyblame uvx -- whyblame

### Gemini CLI and Antigravity: Antigravity (~/.gemini/config/mcp_config.json)

```json
{
  "mcpServers": {
    "whyblame": {
      "command": "uvx",
      "args": [
        "whyblame"
      ],
      "env": {
        "GEMINI_API_KEY": "<GEMINI_API_KEY>"
      }
    }
  }
}
```

Use .agents/mcp_config.json to add it to one workspace only.

### Devin Desktop (~/.config/devin/mcp_config.json)

```json
{
  "mcpServers": {
    "whyblame": {
      "command": "uvx",
      "args": [
        "whyblame"
      ],
      "env": {
        "GEMINI_API_KEY": "<GEMINI_API_KEY>"
      }
    }
  }
}
```

On Windows the file is %APPDATA%\\devin\\mcp_config.json. Use .devin/mcp_config.json to share it with a project.

### Cline (cline_mcp_settings.json)

```json
{
  "mcpServers": {
    "whyblame": {
      "command": "uvx",
      "args": [
        "whyblame"
      ],
      "env": {
        "GEMINI_API_KEY": "<GEMINI_API_KEY>"
      }
    }
  }
}
```

Open it from the MCP Servers icon → Configure → Configure MCP Servers.

### Zed (Zed settings.json)

```json
{
  "context_servers": {
    "whyblame": {
      "command": "uvx",
      "args": [
        "whyblame"
      ],
      "env": {
        "GEMINI_API_KEY": "<GEMINI_API_KEY>"
      }
    }
  }
}
```

Open it with zed: open settings file. Merge context_servers into the settings you already have.

### JetBrains AI Assistant and Junie: AI Assistant (Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add)

```json
{
  "mcpServers": {
    "whyblame": {
      "command": "uvx",
      "args": [
        "whyblame"
      ],
      "env": {
        "GEMINI_API_KEY": "<GEMINI_API_KEY>"
      }
    }
  }
}
```

The AI Assistant docs only show command and args. If the env block is ignored, use Junie for this server.

### JetBrains AI Assistant and Junie: Junie (~/.junie/mcp/mcp.json)

```json
{
  "mcpServers": {
    "whyblame": {
      "command": "uvx",
      "args": [
        "whyblame"
      ],
      "env": {
        "GEMINI_API_KEY": "<GEMINI_API_KEY>"
      }
    }
  }
}
```

Use .junie/mcp/mcp.json to share it with a project.

### Kiro (~/.kiro/settings/mcp.json)

```json
{
  "mcpServers": {
    "whyblame": {
      "command": "uvx",
      "args": [
        "whyblame"
      ],
      "env": {
        "GEMINI_API_KEY": "<GEMINI_API_KEY>"
      }
    }
  }
}
```

Use .kiro/settings/mcp.json to add it to one workspace only.

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "whyblame": {
      "command": "uvx",
      "args": [
        "whyblame"
      ],
      "env": {
        "GEMINI_API_KEY": "<GEMINI_API_KEY>"
      }
    }
  }
}
```

## Tools

From the tool list in its README, going by the names, 3 of 5 tools read data; 2 names don't say. From the server's own tool labels and tool names; not verified by us.

- `why_line`: The commit that set this line's behaviour, the reformats it skipped, and linked tickets and pull requests
- `why_range`: The same history for a block, grouped by the commit that introduced each part
- `check_change` (name suggests: reads): Lists guards that edits removed or weakened, and why they were there
- `find_discussions` (name suggests: reads): Tickets and pull requests behind a line, or possibly related ones when none is linked
- `explain_line` (name suggests: reads): A short cited explanation of a line, offered only when a Gemini key is configured

## FAQ

### Does whyblame need an API key?

No. It reads local git history and runs on your machine. A Gemini key is optional and only enables the explain_line tool.

### Which AI clients can use whyblame?

The README lists Claude Code, Codex, Gemini CLI, VS Code, Cursor, LM Studio and Claude Desktop, and says any MCP client works, including with local models.

### Does the check block pull requests?

No. The GitHub Action warns on the changed line and never blocks.

### Where is the index stored?

Inside the repository's git directory at .git/provenance/, so nothing appears in the working tree.

### Is whyblame free?

Yes. whyblame is open source, so you can use and self-host it for free.

### How do I add whyblame to Claude Code?

Run this command in your terminal: claude mcp add whyblame --env GEMINI_API_KEY='<GEMINI_API_KEY>' -- uvx whyblame

### What are the best alternatives to whyblame?

The closest alternatives to whyblame are Git History, Git Insights, Carbon Forge, Git and Git Summary.

## Where this comes from

- Description: written from the project's README and its MCP Registry entry.
- Install steps: from the official MCP Registry entry.

## Alternatives

- [Git History](https://ai-powered.com/mcp/git-history): Git History is an open-source MCP server for developer tools.
- [Git Insights](https://ai-powered.com/mcp/git-insights): Git Insights is an open-source MCP server for developer tools.
- [Carbon Forge](https://ai-powered.com/mcp/carbon-forge): Carbon Forge is a freemium MCP server for developer tools.
- [Git](https://ai-powered.com/mcp/git): Git is an open-source MCP server for developer tools.
- [Git Summary](https://ai-powered.com/mcp/git-summary): Git Summary is an open-source MCP server for developer tools.
- [Git Why](https://ai-powered.com/mcp/git-why): Git Why is an open-source MCP server for developer tools.
- [whygit](https://ai-powered.com/mcp/whygit): whygit is a free MCP server for developer tools.
- [GitWhy — The Context Layer for Git](https://ai-powered.com/mcp/gitwhy-the-context-layer-for-git): GitWhy — The Context Layer for Git is an open-source MCP server for developer tools.

---
Source: https://ai-powered.com/mcp/whyblame
