# git-history [Health: Active]

**Category:** 🔄 Version Control  
**Repository:** https://github.com/tonyweckstrom1987/mcp-server-git-history  
**GitHub Stars:** 0  
**npm Downloads (last month):** 249  
**Views:** 10  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/git-history

## Description
Give AI agents Git history tools: commit search, file history, blame, contributors, ref diffs.

## Tools
Capabilities this server exposes over MCP:

- **search_commits** — Etsii Git-commiteja joiden commit-viesti sisältää annetun hakusanan (esim. bugin numero tai avainsana). Käytä tätä kun haluat selvittää MIKSI jokin muutos tehtiin.
- **get_recent_commits** — Hakee repositorion uusimmat commitit uusimmasta vanhimpaan. Käytä kun haluat yleiskuvan siitä, mitä projektissa on viime aikoina tehty.
- **get_commit_diff** — Hakee tietyn commitin koko diffin (kaikki tiedostomuutokset). Käytä kun haluat nähdä TARKALLEEN mitä muuttui.
- **get_file_history** — Hakee tiedoston muutoshistorian: milloin sitä on muokattu, kuka muokkasi ja mihin commit-viestiin muutos liittyi. Käytä kun haluat selvittää MILLOIN ja KUKA muokkasi tiettyä tiedostoa viimeksi.
- **blame_file** — Hakee tiedoston rivikohtaisen 'git blame' -tiedon: kuka ja missä commitissa kunkin rivin viimeksi kirjoitti. Käytä kun haluat selvittää KUKA kirjoitti tietyn rivin ja MISSÄ commitissa se tuli mukaan.
- **get_contributors** — Hakee yhteenvedon repositorion committaajista ja heidän commit-määristään (kuten 'git shortlog -sn'). Käytä kun haluat yleiskuvan siitä, KEITÄ projektissa on ollut mukana ja kuinka aktiivisia he ovat olleet.
- **get_diff_between_refs** — Hakee diffin kahden commitin, branchin tai tagin välillä, valinnaisesti rajattuna yhteen tiedostoon. Käytä kun haluat verrata kahta pistettä historiassa (esim. kahta branchia tai releasea), et vain yhtä commitia.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "git-history": {
    "command": "npx",
    "args": ["-y","mcp-server-git-history"],
    "env": {
      "GIT_REPO_PATH": ""
    }
  }
}
```

**Requires environment variables:** `GIT_REPO_PATH` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation

## What the git-history MCP server does

The git-history MCP server exposes Git history to MCP-compatible AI clients without allowing repository changes. It is designed for questions about code evolution, such as when a file was last modified, which commit introduced a change, or who authored particular lines.

The server works with a repository supplied at startup. It reads commit and author data through Git commands and returns structured results to the calling client. Because the service only reads repository data, it does not create commits, edit files, switch branches, or otherwise mutate the checkout.

## How it works

The process uses the Model Context Protocol over a stdio transport. Internally, Git operations are handled with the `simple-git` package, while tool inputs are validated with Zod. The documented runtime range is Node.js 18, 20, 22, or 24.

Start the package with `npx`, passing the repository path as an argument:

```bash
npx -y mcp-server-git-history /path/to/your/repo
```

The path can instead be supplied with `GIT_REPO_PATH`. If neither is provided, the server uses its startup directory. No API key is required: the server reads Git data locally and does not make AI requests itself.

## Setup and configuration

For Claude Desktop, add an MCP entry that runs `npx -y mcp-server-git-history` and passes the repository path in `args`, then restart the client. Cursor uses the same command and argument pattern in `.cursor/mcp.json` or the global Cursor MCP configuration. The README also names Windsurf as a supported client.

For local development, clone the repository, run `npm install`, and use `npm test`. The included manual test can start the server against another Git repository and exercise it through an MCP client and stdio transport.

## Tools and capabilities

The git-history MCP server provides these read-only tools:

- `search_commits(query, limit?)` searches commit messages for a term.
- `get_recent_commits(limit?)` returns the newest commits for a recent-change overview.
- `get_commit_diff(commitHash)` returns the complete diff for one commit.
- `get_file_history(filePath, limit?)` shows a file's change history, including author, date, and commit information.
- `blame_file(filePath, startLine?, endLine?)` identifies the commit and author associated with each selected line.
- `get_contributors(limit?)` summarizes contributors and their commit counts.
- `get_diff_between_refs(fromRef, toRef, filePath?)` compares two commits, branches, or tags, optionally for one file only.

Together, these operations support repository archaeology, targeted debugging, review of changes between refs, and attribution of existing code. Limits can reduce the number of returned commits or contributors, while line ranges and file paths narrow file-oriented queries.

## Limitations and notes

This is a history-reading service, not a general Git administration tool. Its documented operations use read-only commands such as `log`, `show`, `blame`, `shortlog`, and `diff`; there are no tools for writing to the repository. Results depend on the Git repository and refs available at the configured path. The client must be able to launch an MCP server over stdio, and the repository path must resolve to the intended checkout.

_Full upstream README: https://allmcps.com/mcp/git-history/readme_

