Skip to main content
Glama

git-context-mcp

すべての開発者が抱く疑問、**「なぜこのコードが存在するのか?」**に答えるMCPサーバー

git blameは誰がその行を書いたかを教えてくれます。これは、なぜ書かれたのかを教えてくれます。

ファイルと行範囲を指定すると、git-context-mcpはコミットを遡り、その変更を取り込んだプルリクエストを見つけ、PRの説明を読み、リンクされたすべてのGitHub Issueを抽出します。これらすべてを一度に、Claude内で直接行います。


デモ

You: Why does line 87 of src/auth/session.ts exist?

Claude (using blame_context):
  Commit `a3f9c12` by Sarah Chen on 2024-08-14
  Message: "fix: rotate session tokens on privilege escalation"

  PR #441 — "Security: fix session fixation vulnerability"
  Merged: 2024-08-15  |  Labels: security, critical

  PR Description:
  > After the pen test in sprint 22, we found that session tokens
  > weren't being rotated when a user's role changed. This allows
  > a stolen low-priv token to be used after the account is promoted.

  Linked Issue #389 — "Session token not rotated on role change" (closed)
  > Reported by @contractor-red: "I was able to reuse a captured
  > token after my account was upgraded to admin..."

git logを掘り返したり、GitHubを検索したり、Issueトラッカーと照らし合わせたりする必要はもうありません。Claudeがワンステップで解決します。


Related MCP server: Selvedge

ツール

ツール

機能

blame_context

ファイル + 行範囲 → コミット + PR説明 + リンクされたIssue

commit_story

コミットハッシュ → 完全なストーリー(メッセージ、差分統計、PR、Issue)

file_history

ファイル → 直近N件のコミット(それぞれPRとIssueの注釈付き)

search_commits

キーワード → PR/Issueのコンテキストを含む一致するコミット

file_contributors

ファイル → 貢献者ランキングテーブル(コミット数、所有行数、活動期間)


インストール

オプション1 — npx (インストール不要)

claude mcp add git-context -- npx git-context-mcp

オプション2 — グローバルインストール

npm install -g git-context-mcp
claude mcp add git-context -- git-context-mcp

オプション3 — 手動設定

~/.claude/claude_mcp_config.json に以下を追加します:

{
  "mcpServers": {
    "git-context": {
      "command": "npx",
      "args": ["git-context-mcp"]
    }
  }
}

その後、Claude Codeを再起動してください。


要件

  • Claude Code (またはMCP互換クライアント)

  • PATH上の git

  • gh CLI (インストール) + GitHub PR/Issue検索のための gh auth login

    • gh がなくても動作しますが、PR/Issueのコンテキストはスキップされます


使用例

インストール後、任意のgitリポジトリでClaudeに自然に話しかけてください:

"Why does line 42 of src/db/connection.ts exist?"
"What's the story behind commit d4a8f91?"
"Who owns the most of src/payments/stripe.ts?"
"When was the rate limiting added? Search commits for 'rate limit'"
"Show me the last 5 changes to src/api/auth.ts and why each was made"

仕組み

  1. blame_context が指定された行に対して git blame -p を実行し、コミットハッシュを見つけます

  2. 各コミットに対して git show を呼び出し、完全なメッセージと差分統計を取得します

  3. GitHub API (gh api /repos/:owner/:repo/commits/:hash/pulls) を叩いてPRを見つけます

  4. PR本文から #NNN/issues/NNN の参照を解析し、各Issueを取得します

  5. すべてが構造化されたMarkdownとして返され、Claudeが推論を行います

トークンは保存されません。GitHub自身のAPI以外(gh CLIと同じ)にはデータは送信されません。


コントリビューション

PRを歓迎します。サーバー全体は src/index.ts にあります。

git clone https://github.com/muhannad-hash/git-context-mcp
cd git-context-mcp
npm install
npm run dev   # watch mode

ライセンス

MIT

Install Server
A
license - permissive license
A
quality
D
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    A
    quality
    A
    maintenance
    Change tracking for AI-era codebases. AI agents call it to log structured change events (entity + diff + reasoning) before the session ends, then query history with diff, blame, history, changeset, and search. Captures the intent that would otherwise evaporate.
    8
    19
    MIT
  • A
    license
    -
    quality
    B
    maintenance
    Indexes commit history to create a queryable expert, providing insights into code evolution, developer intent, and hidden patterns beyond static code analysis.
    MIT

View all related MCP servers

Related MCP Connectors

  • Memory for coding agents: the decisions, the dead ends, and where the last session stopped.

  • Individual-analyst context layer: recall, remember, and reconcile your data and engineering context.

  • Independent static verification for exact immutable public GitHub commits.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/muhannad-hash/git-context-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server