# HasanJahidul/git-insight-mcp [Health: Active]

**Category:** 🔄 Version Control  
**Repository:** https://github.com/HasanJahidul/git-insight-mcp  
**GitHub Stars:** 2  
**npm Downloads (last month):** 40  
**Views:** 3  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/hasanjahidul-git-insight-mcp

## Description
Semantic git queries beyond git log: who-touched (blame grouped by author with primary owner), introducing-PR, co-change suggestions, branch hygiene (ahead/behind/stale), recent-work standup, and full commit context. Local git plus optional GitHub API for PR and issue linkage.

## Tools
Capabilities this server exposes over MCP:

- **who_touched** — Read-only. Code ownership for a file via `git blame`, aggregated by author. Returns each author's line count, commit count, and most recent commit date, plus the `primary_owner` (most lines). Pass `line_start`/`line_end` to scope to one region (e.g. a single function). Errors if `cwd` is not a git repo or `file` is untracked. Cost scales with file size; instant for typical files.
- **introducing_pr** — Read-only. Find the pull request that introduced a line or a commit. First resolves the line to a commit via `git blame`, then reads the local merge-commit message; if that has no PR reference and `GH_TOKEN`/`GITHUB_TOKEN` is set, falls back to the GitHub REST API. Without a token the local path still works; `pr` is `null` when nothing can be resolved (e.g. rebase-merged with no PR ref). Provide either `commit`, or both `file` and `line`. May make one outbound GitHub API call (subject to the 5000/h authed rate limit).
- **co_change** — Read-only. Files that historically change together with the input file — answers "if I edit X, what else should I check?". Mines up to `window` recent commits that touch `file`, counts how often each other file appears alongside it, and returns those above `threshold`, with the co-occurrence count and ratio (count / commits-touching-file), capped at `limit`. Pure local log mining; no network. Cost is O(window × files-per-commit) — keep `window` ≤ a few thousand on large repos.
- **branch_hygiene** — Read-only. Inventory of branches with ahead/behind counts versus the default branch, last commit date and author, merged status, and a `stale` flag (no commits in `stale_days` days). Use it to find unmerged, abandoned branches. The default branch itself is excluded from the list. Pure local git; no network. Returns `{ count, branches, default_branch_excluded }`.
- **recent_work** — Read-only. Standup / changelog helper: one author's commits in a time window with files touched and insertion/deletion totals. Defaults to the repo's `user.name` and the last 7 days. Pure local git; no network. Returns `{ author, since, commit_count, commits[] }` where each commit has subject, date, files, insertions, deletions.
- **commit_context** — Read-only. Everything about one commit in a single call: subject, body, changed files with per-file insertions/deletions, totals, the linked PR (parsed from the merge message, or via the GitHub API when `GH_TOKEN`/`GITHUB_TOKEN` is set), and issue numbers referenced in the message (`Fixes #N`, `Closes #N`). Errors if the SHA does not resolve in `cwd`. May make one outbound GitHub API call for PR enrichment.

## Claude Desktop Quick Installation
Install path inferred — verify against the README before running it. Uses `npx` (confidence: medium):

```json
"mcpServers": {
  "git-insight-mcp": {
    "command": "npx",
    "args": ["-y","git-insight-mcp"]
  }
}
```

## Documentation

## What HasanJahidul/git-insight-mcp MCP server does

HasanJahidul/git-insight-mcp MCP server gives an MCP-compatible client structured answers about repository history and branch state. Its queries operate on local Git data and cover authorship, commit relationships, branch hygiene, recent activity, and files that tend to change together.

The server is intended for questions such as who last worked on a region of a file, which commit introduced a line, which branches are stale or unmerged, and what a contributor changed during a time window. With a GitHub token, it can also associate commits with pull requests and related issues. Without that token, the local Git features remain available.

## How it works

The project runs as a local stdio MCP server. An MCP client starts the `git-insight-mcp` executable, and the server reads the repository’s local history to answer tool requests. It is not limited to the most recent few commits: several tools derive results from blame data, commit windows, branch comparisons, and commit metadata.

For introducing pull requests, the server first examines merge-message information and can fall back to the GitHub API. GitHub access is limited to GitHub repositories; GitLab and Bitbucket are not supported. Pull-request results are not cached in the current version, so API rate limits apply. An authenticated GitHub API limit is documented as 5,000 requests per hour.

## Setup and configuration

Install the package globally with npm:

```bash
npm install -g git-insight-mcp
```

A Claude Code configuration can start it with:

```bash
claude mcp add --scope user git-insight -- git-insight-mcp
```

Other MCP-compatible clients can launch the same executable as a stdio server. Set `GH_TOKEN` when pull-request or issue lookups are needed. The token is optional for local Git queries.

The repository can also be built from source by cloning it, running `npm install`, running `npm run build`, and invoking the resulting CLI under `dist/cli.js`.

## Tools and capabilities

- `who_touched` groups blame results by author and reports line counts, related commits, last-touch dates, and a primary owner. It accepts an optional line range.
- `introducing_pr` looks for the pull request associated with a line or commit, using merge messages before consulting GitHub.
- `co_change` finds files most frequently changed alongside a selected file.
- `branch_hygiene` reports ahead and behind counts, the last commit, merged state, and whether branches are stale.
- `recent_work` summarizes an author’s commits, files, and insertions or deletions over a selected period.
- `commit_context` returns commit subject and body, changed files, pull-request information, and related issues.

The command-line interface also exposes sanity-check commands such as `who-touched`, `co-change`, `branches`, `recent`, `commit`, and `intro-pr`.

## Limitations and notes

`co_change` can be expensive because its work scales with the commit window and the number of files per commit; the default history window is capped at 1,000 commits. Function-level ownership is approximated using line ranges rather than an AST, and renames are not tracked yet.

GitHub linkage requires the optional token and is subject to API limits. The current release supports GitHub only for remote repository metadata. HasanJahidul/git-insight-mcp MCP server is licensed under MIT.

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

