Skip to main content
Glama
Git Insight MCP

Git Insight MCP

by HasanJahidul

git-insight-mcp

MCPを介したセマンティックなGitクエリ。git logを超えて、あらゆる行、ファイル、ブランチに関する「誰が」「何を」「いつ」「なぜ」に答えます。

demo

terminal-history-mcp および localhost-mcp と組み合わせて使用します。これらを合わせることで、「何を実行したか」「何が実行されているか」「何を変更したか」を把握できます。

なぜこれが必要か

開発者は常にこれらの質問をしますが、gitではうまく答えられません:

  • 「最後にこの関数を触ったのは誰?」 — git blameは行単位の情報しか提供せず、領域ごとの作成者は分かりません

  • 「この行を導入したPRはどれ?」 — 手動手順:blame → コミットSHA → GitHubで検索

  • 「常に一緒に変更されるファイルはどれ?」 — 標準機能にはありません

  • 「30日以上経過した未マージのブランチを表示」 — Bashのワンライナーを駆使する必要があります

  • 「先週は何に取り組んだか?」 — 手動でログを精査する必要があります

LLMエージェントが安全な編集を行うには、このコンテキストが必要です。現状ではgit log -n 5を実行するだけで、重要な情報のほとんどを見逃してしまいます。

Related MCP server: semamerge

インストール

npm install -g git-insight-mcp

Claude Codeに組み込む場合:

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

または、MCP互換のクライアントであれば何でも可能です。stdio MCPサーバーとして動作します。

PRやIssueの検索を行うには、GitHubトークンを設定してください:

export GH_TOKEN=ghp_...

トークンがない場合でも、ローカルGitツールは動作します。PRのリンク機能のみスキップされます。

ツール

ツール

目的

who_touched

作成者ごとにblameをグループ化。行数、コミット、最終更新日、主な所有者。行範囲の絞り込みも可能。

introducing_pr

行(またはコミット)を導入したPRを検索。マージメッセージを優先的に解析し、GitHub APIで補完します。

co_change

入力ファイルと一緒に変更されることが多いファイルを表示。

branch_hygiene

ブランチの先行/遅延、最終コミット、マージ状態、古いフラグを一覧表示。

recent_work

スタンドアップ支援:指定期間内の作成者のコミット、ファイル、追加/削除行数。

commit_context

コミットの完全なコンテキスト:件名、本文、ファイル、PR、関連Issue。

出力例 (who_touched)

{
  "file": "src/auth.ts",
  "total_lines": 124,
  "authors": [
    { "name": "alice", "email": "alice@x.com", "lines": 87, "commits": 12, "last_commit_date": "2026-04-12T10:33:01.000Z" },
    { "name": "bob", "email": "bob@x.com", "lines": 37, "commits": 4, "last_commit_date": "2026-01-03T18:14:55.000Z" }
  ],
  "primary_owner": "alice"
}

CLIでの使用(正常性チェック)

git-insight-mcp who-touched src/auth.ts
git-insight-mcp co-change src/auth.ts
git-insight-mcp branches
git-insight-mcp recent alice
git-insight-mcp commit a3e577e
git-insight-mcp intro-pr src/auth.ts:42
git-insight-mcp intro-pr a3e577e
git-insight-mcp                # MCP stdio server

ソースからビルド

git clone https://github.com/HasanJahidul/git-insight-mcp.git
cd git-insight-mcp
npm install
npm run build
node dist/cli.js branches

制限事項 (v0.1)

  • GitHubのみ対応(GitLab/Bitbucketは未対応)。

  • co_changeはO(ウィンドウサイズ × コミットごとのファイル数) — デフォルトで1000コミットに制限。

  • 関数レベルのblameは行範囲によるもので、AST(抽象構文木)ベースではありません。リネームはまだ追跡されません。

  • GH APIのレート制限が適用されます(認証済みで5000回/時)。このバージョンではPRの結果はキャッシュされません。

ライセンス

MIT

Available Tools

6 tools
branch_hygieneA
Read-onlyIdempotent

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 }.

Inputs: cwd, remote, stale_days. Returns: count, branches, default_branch_excluded

co_changeA
Read-onlyIdempotent

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.

Inputs: file (required), cwd, limit, window, +1 more. Returns: file, co_changed, total_commits_touching

commit_contextA
Read-onlyIdempotent

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.

Inputs: sha (required), cwd. Returns: pr, sha, body, date, +6 more

introducing_prA
Read-onlyIdempotent

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).

Inputs: cwd, file, line, commit. Returns: pr, author, commit, source, +2 more

recent_workA
Read-onlyIdempotent

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.

Inputs: cwd, limit, since, author. Returns: since, author, commits, commit_count

who_touchedA
Read-onlyIdempotent

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.

Inputs: file (required), cwd, function, line_end, +1 more. Returns: file, authors, total_lines, primary_owner

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.4/5.0

    Scored across 6 tools

    Disambiguation5/5

    Each tool targets a distinct git analysis task: branches, file co-change, commit details, PR introduction, recent work, and file ownership. No functional overlap is apparent.

    Naming Consistency4/5

    All names use lowercase snake_case and are descriptive compound nouns (e.g., branch_hygiene, who_touched). While not strictly verb_noun, the pattern is consistent and readable.

    Tool Count5/5

    Six tools is a well-scoped set for a git insight server, covering key analyses without being overwhelming or too sparse.

    Completeness3/5

    The set covers branch analysis, co-change, commit details, PR discovery, recent work, and blame. Missing common operations like branch diff or commit log filtering, but still functional for the intended domain.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Automatically extracts architectural decisions, patterns, and insights from Git commits to build a local, structured project memory. It exposes this living context to AI tools via MCP, allowing them to understand the historical reasoning and evolution behind your codebase.
      6
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      MCP server that detects semantic (non-textual) merge conflicts between Git branches using AST-level analysis. Catches incompatible changes that Git merges cleanly — signature changes, removed exports, parameter changes, interface breaks, and cross-file dependency conflicts.
      4
      41 npm
      MIT
    • A
      license
      A
      quality
      C
      maintenance
      Developers: Search your zsh, bash, or fish shell history from Claude Code, Cline, Cursor, Zed, or any MCP client using tools like search_history (full-text with timestamp/CWD/exit code), recent_in_dir, failed_commands, and command_chains for multi-step sequences. Reindex after new activity. Local-only SQLite FTS5 with secrets redacted before storage.
      7
      41 npm
      5
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Inspect, manage, and kill local dev servers via MCP. Stop guessing what's on :3000. Five tools: list servers with framework detection, inspect ports, find zombies, diagnose conflicts, safe-kill with dry-run default. Local, no cloud, no telemetry.
      5
      6 npm
      4
      MIT