# whygit

> whygit is a free MCP server for developer tools. Read-only Git explainer: what state a repo is in, what an error means and the exact fix. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Free
- **Platforms:** CLI, macOS, Windows, Linux
- **Repository:** https://github.com/srikarmk/whygit
- **MCP Registry name:** io.github.Srikarmk/whygit
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-11-23

## About

whygit is built for people meeting Git for the first time. It inspects a repository, tells you in plain English what state it is in and which commands to run, and also explains an error message you paste in. It only reads: every Git call goes through a single function that accepts only read-only subcommands, it sets `GIT_OPTIONAL_LOCKS=0`, never runs `git fetch`, and masks credentials in remote URLs. The test suite snapshots the `.git` directory before and after to check nothing changes.

It recognises many situations: merge conflicts, a stopped rebase, detached HEAD, diverged branches, nested repositories, files over GitHub's 100 MB limit, likely secrets such as `.env` or `*.pem`, missing `user.name`, a stale `index.lock` and dubious ownership. Error coverage includes rejected pushes, unrelated histories, GitHub login failures and publickey denials. Commands that can lose work are flagged, with a safer option listed first.

The MCP mode, `whygit mcp`, offers three tools: diagnose_repo, explain_git_error and explain_state. It also works as a plain CLI with `--json`, and needs Python 3.10 or newer and Git.

## Features

- **Repo diagnosis:** Lists problems most urgent first with explanation and fix.
- **Error explanation:** Explains pasted Git errors using repo state when available.
- **State summary:** Reports branch, upstream, ahead and behind, and changes.
- **Read-only guarantee:** Refuses any Git subcommand that could modify the repo.
- **Safe fix suggestions:** Marks destructive commands and lists safer ones first.
- **CLI and MCP modes:** Works from the terminal or inside an assistant.

## Good for

- Find out why a rebase is stuck
- Understand a rejected push
- Catch a large file or secret before pushing
- Give an assistant a reliable diagnosis instead of guesses

## Install

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

```sh
claude mcp add whygit -- uvx whygit
```

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": {
    "whygit": {
      "command": "uvx",
      "args": [
        "whygit"
      ]
    }
  }
}
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "whygit": {
      "command": "uvx",
      "args": [
        "whygit"
      ]
    }
  }
}
```

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

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

```json
{
  "mcpServers": {
    "whygit": {
      "command": "uvx",
      "args": [
        "whygit"
      ]
    }
  }
}
```

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

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

```json
{
  "mcpServers": {
    "whygit": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "whygit"
      ]
    }
  }
}
```

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 whygit -- uvx whygit
```

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

```toml
[mcp_servers.whygit]
command = "uvx"
args = ["whygit"]
```

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

```json
{
  "mcpServers": {
    "whygit": {
      "command": "uvx",
      "args": [
        "whygit"
      ]
    }
  }
}
```

Or run: gemini mcp add -s user whygit uvx -- whygit

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

```json
{
  "mcpServers": {
    "whygit": {
      "command": "uvx",
      "args": [
        "whygit"
      ]
    }
  }
}
```

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

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

```json
{
  "mcpServers": {
    "whygit": {
      "command": "uvx",
      "args": [
        "whygit"
      ]
    }
  }
}
```

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": {
    "whygit": {
      "command": "uvx",
      "args": [
        "whygit"
      ]
    }
  }
}
```

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

### Zed (Zed settings.json)

```json
{
  "context_servers": {
    "whygit": {
      "command": "uvx",
      "args": [
        "whygit"
      ]
    }
  }
}
```

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": {
    "whygit": {
      "command": "uvx",
      "args": [
        "whygit"
      ]
    }
  }
}
```

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

```json
{
  "mcpServers": {
    "whygit": {
      "command": "uvx",
      "args": [
        "whygit"
      ]
    }
  }
}
```

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

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

```json
{
  "mcpServers": {
    "whygit": {
      "command": "uvx",
      "args": [
        "whygit"
      ]
    }
  }
}
```

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": {
    "whygit": {
      "command": "uvx",
      "args": [
        "whygit"
      ]
    }
  }
}
```

## Tools

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

- `diagnose_repo`: Find every problem in a repository, most urgent first, with explanation and fix
- `explain_git_error` (name suggests: reads): Explain a Git error message and the fix, using repository state if a path is given
- `explain_state` (name suggests: reads): Neutral summary of branch, upstream, remotes, changes and operations in progress

## FAQ

### Will whygit change my repository?

No. It only runs read-only Git commands and never runs the fixes it suggests.

### What does whygit need?

Python 3.10 or newer and Git, on macOS, Windows or Linux.

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

Run claude mcp add --scope user whygit -- uvx whygit mcp.

### Does whygit print my credentials?

No. Remote URLs with tokens are masked in every output.

### Is whygit free?

Yes. whygit is free to use.

### What are the best alternatives to whygit?

The closest alternatives to whygit are REA, Context7, Chrome DevTools MCP, Codebase Memory and GitHub.

## Where this comes from

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

## Alternatives

- [REA](https://ai-powered.com/mcp/rea): REA is an open-source MCP server for developer tools.
- [Context7](https://ai-powered.com/mcp/context7): Context7 is a freemium MCP server for developer tools.
- [Chrome DevTools MCP](https://ai-powered.com/mcp/chrome-devtools-mcp-2): Chrome DevTools MCP is an open-source MCP server for browser automation.
- [Codebase Memory](https://ai-powered.com/mcp/codebase-memory): Codebase Memory is an open-source MCP server for knowledge and memory.
- [GitHub](https://ai-powered.com/mcp/github): GitHub is an open-source MCP server for developer tools.
- [Serena MCP: the IDE for your agent](https://ai-powered.com/mcp/serena-mcp-the-ide-for-your-agent): Serena MCP: the IDE for your agent is an open-source MCP server for developer tools.
- [XERJ](https://ai-powered.com/mcp/xerj): XERJ is an open-source MCP server for knowledge and memory.
- [awesome-mcp-servers](https://ai-powered.com/mcp/awesome-mcp-servers-2): awesome-mcp-servers is an open-source MCP server for developer tools.

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