Skip to main content
Glama

Git Intelligence MCP Server

Git の履歴を実用的なリポジトリインサイトに変換する、軽量な Model Context Protocol (MCP) サーバー。

概要

Git Intelligence MCP は、AI アシスタントが自然言語のリクエストを通じて Git リポジトリの履歴を分析できるようにするローカル MCP サーバーです。

Git コマンドを手動で実行してコミット履歴を解釈する代わりに、MCP 互換クライアントは専用ツールを呼び出して以下を発見できます:

  • 頻繁に変更されるファイル

  • コントリビューターの所有パターン

  • 時間経過に伴うコードの変更量 (チャーン)

このプロジェクトは意図的に軽量に設計されており、公式の MCP Python SDKGitPython を使用して単一の Python ファイルで実装されています。


Related MCP server: GitIntel

Git Intelligence を使う理由

Git の履歴には有用なエンジニアリングシグナルが含まれていますが、手動で抽出するのは繰り返しの多い作業になりがちです。

Git Intelligence を使えば、次のような質問ができます:

「どのファイルが最も頻繁に変更されましたか?」

server.py には何人の開発者が携わっていますか?」

「2026年1月以降、どれだけのコードが変更されましたか?」

MCP サーバーはこれらの自然言語リクエストを構造化されたツール呼び出しに変換し、リポジトリの Git 履歴を分析します。

Natural Language
       │
       ▼
   MCP Client
       │
       ▼
Git Intelligence MCP
       │
   ┌───┼────────┐
   ▼   ▼        ▼
Hotspots  Bus Factor  Churn
   │   │        │
   └───┼────────┘
       ▼
 Git Repository
       │
       ▼
 Repository Insights

機能

機能

説明

ホットスポット分析

最も頻繁に変更されたファイルを特定します

バスファクター分析

ファイルごとの異なるコントリビューター数を数えます

コードチャーン分析

指定日以降に追加・削除された行数を計算します

自然言語アクセス

AI クライアントが Git 分析ツールを呼び出せるようにします

ローカルリポジトリ対応

クローンした Git リポジトリで直接動作します

軽量アーキテクチャ

データベースや外部サービスは不要です

MCP Inspector 対応

ローカルでのツールテストとデバッグが容易です

VS Code 対応

MCP クライアントとして VS Code に直接接続できます


利用可能な MCP ツール

1. hotspots

リポジトリのコミット履歴全体で最も頻繁に変更されたファイルを特定します。

引数

引数

デフォルト

説明

repo_path

string

必須

ローカル Git リポジトリのパス

top_n

integer

10

返すファイルの数

プロンプトの例

Use Git Intelligence to find the top 5 hotspot files in this repository.

ツール呼び出しの例

hotspots(
    repo_path="E:/projects/my-repo",
    top_n=5
)

結果の例

42 commits — server.py
27 commits — README.md
18 commits — config.py
12 commits — utils.py
9 commits — tests/test_server.py

頻繁に変更されるファイルは、追加のレビューやテストが必要な領域を特定するための有用なシグナルとなります。


2. bus_factor

特定のファイルを変更した異なるコントリビューターの数を判定します。

引数

引数

説明

repo_path

string

ローカル Git リポジトリのパス

file_path

string

分析するファイル

プロンプトの例

Use Git Intelligence to find how many developers have modified server.py.

ツール呼び出しの例

bus_factor(
    repo_path="E:/projects/my-repo",
    file_path="server.py"
)

結果の例

server.py: 3 distinct author(s) — Alice, Bob, Charlie

コントリビューター数が少ない場合は、特定のファイルに関する知識の集中が潜在的に存在することを示す可能性があります。


3. churn_since

指定された日付以降に追加および削除された行の合計数を計算します。

引数

引数

説明

repo_path

string

ローカル Git リポジトリのパス

since_date

string

YYYY-MM-DD 形式の開始日

プロンプトの例

Use Git Intelligence to calculate the code churn since 2026-01-01.

ツール呼び出しの例

churn_since(
    repo_path="E:/projects/my-repo",
    since_date="2026-01-01"
)

結果の例

Since 2026-01-01: +842 / -391 lines

これにより、特定の期間に追加・削除されたコードの量を簡単に把握できます。


ワークフローの例

MCP 互換クライアントに接続すると、自然言語でリポジトリを操作できます。

リポジトリのホットスポットを探す

Use Git Intelligence to find the top 5 most frequently changed files.

hotspots()

Repository history

Top 5 hotspot files

ファイルの所有権を調査する

How many different developers have worked on server.py?

bus_factor()

Distinct contributors

開発アクティビティを分析する

How many lines have been added and removed since 2026-06-01?

churn_since()

Code churn statistics

MCP クライアント互換性

このサーバーは stdio トランスポート を使用するため、ローカルの MCP 互換クライアントに適しています。

以下でテスト済みです:

  • MCP Inspector — ローカル開発とツールテスト

  • VS Code — MCP クライアント統合

アーキテクチャはシンプルなままです:

┌───────────────────┐
│   MCP Client      │
│                   │
│ MCP Inspector     │
│ VS Code           │
└─────────┬─────────┘
          │
        stdio
          │
          ▼
┌───────────────────┐
│ Git Intelligence  │
│    MCP Server     │
├───────────────────┤
│ hotspots()        │
│ bus_factor()      │
│ churn_since()     │
└─────────┬─────────┘
          │
          ▼
┌───────────────────┐
│  Local Git Repo   │
└───────────────────┘

技術スタック

  • Python 3.10+

  • MCP Python SDK

  • FastMCP

  • GitPython

  • Git

  • stdio トランスポート

このサーバーはデコレータベースの FastMCP API を使用して、Python 関数を MCP ツールとして公開します。


プロジェクト構造

このプロジェクトは意図的に実装を最小限に保っています:

git-intel-mcp/
│
├── .vscode/
│   └── mcp.json
│
├── assets/
│
├── server.py
├── requirements.txt
├── README.md
└── .gitignore

なぜ単一の server.py なのか?

このプロジェクトは、大規模な本番アプリケーションではなく、MCP 学習に焦点を当てた実装として設計されています。

コア実装を 1 つのファイルにまとめることで、MCP アーキテクチャを理解しやすくしています:

Define Tool
    ↓
@mcp.tool()
    ↓
MCP Tool Schema
    ↓
MCP Client
    ↓
Tool Call
    ↓
GitPython
    ↓
Git Repository
    ↓
Result

機能が拡張されるにつれて、ツールを専用モジュールに分割できます。


インストール

1. リポジトリをクローンする

git clone https://github.com/s-zaid-13/git-intel-mcp.git
cd git-intel-mcp

2. 仮想環境を作成する

Windows

python -m venv venv
venv\Scripts\activate

macOS / Linux

python -m venv venv
source venv/bin/activate

3. 依存関係をインストールする

pip install -r requirements.txt

要件

mcp[cli]<2.0.0
gitpython

ローカルで実行する

以下のコマンドで MCP サーバーを起動します:

python server.py

サーバーは stdio トランスポート を使用するため、従来の Web サーバーは起動しません。

MCP 互換クライアントが接続を確立するのを待ちます。


MCP Inspector でテストする

MCP Inspector は、MCP サーバーをローカルでテストするための対話型環境を提供します。

以下を実行します:

mcp dev server.py

次に:

  1. サーバーに接続する

  2. 利用可能なツールを確認する

  3. 生成されたスキーマを確認する

  4. 引数を指定する

  5. ツールを実行する

  6. 返された結果を検証する

以下のツールが利用可能であるはずです:

hotspots
bus_factor
churn_since

VS Code に接続する

MCP サーバーは VS Code に直接接続することもできます。

以下を作成します:

.vscode/mcp.json

Windows の設定例:

{
  "servers": {
    "gitIntelligence": {
      "type": "stdio",
      "command": "E:\\Spiral Lab\\git-intel-mcp\\venv\\Scripts\\python.exe",
      "args": [
        "E:\\Spiral Lab\\git-intel-mcp\\server.py"
      ],
      "cwd": "E:\\Spiral Lab\\git-intel-mcp"
    }
  }
}

接続後、VS Code で以下の MCP ツールを検出できるはずです:

gitIntelligence
├── hotspots
├── bus_factor
└── churn_since

リクエストの例:

Use Git Intelligence to find the top 5 hotspot files in this repository.

仕組み

サーバーは FastMCP を使用して構築されています。

ツールは MCP SDK のデコレータを使用して公開されます:

@mcp.tool()
def hotspots(repo_path: str, top_n: int = 10) -> str:
    ...

FastMCP は関数シグネチャとドキュメントを使用して、MCP クライアントが検出できるツール定義を生成します。

全体のフローは次のとおりです:

Python Function
      │
      ▼
@mcp.tool()
      │
      ▼
MCP Tool Definition
      │
      ▼
MCP Client
      │
      ▼
Tool Call
      │
      ▼
GitPython
      │
      ▼
Git History
      │
      ▼
Analysis Result

実証される MCP の概念

ツール

サーバーは 3 つの呼び出し可能な MCP ツールを公開します:

hotspots
bus_factor
churn_since

これにより、AI クライアントはリポジトリ分析を実行できます。

クライアント・サーバーアーキテクチャ

MCP クライアントは、Git 分析が内部でどのように実装されているかを知る必要はありません。

知る必要があるのは次のことだけです:

  • どのツールが利用可能か

  • どのような引数を受け付けるか

  • どのような結果を返すか

MCP Client
     │
     │ MCP
     ▼
MCP Server
     │
     ▼
Git Repository

stdio トランスポート

ローカルサーバーは stdio を使用して通信します。これは、ローカルで実行される MCP サーバーや開発用クライアントに適しています。


制限事項

この実装は意図的にスコープを小さく保っています。

  • ローカルの Git リポジトリのみをサポートします。

  • 大規模なリポジトリでは処理に追加の時間がかかる場合があります。

  • チャーンは変更の量を測定するものであり、コードの品質を測定するものではありません。

これらの制限により、完全なリポジトリ分析プラットフォームを構築するのではなく、MCP の理解に焦点を当てたプロジェクトとなっています。


学習成果

このプロジェクトは、Python で MCP サーバーを構築する基本を実証しています:

  • 公式 Python SDK を使用した MCP サーバーの作成

  • FastMCP を使用したツールの定義

  • MCP ツールスキーマの理解

  • stdio トランスポートの使用

  • MCP サーバーを MCP クライアントに接続する

  • MCP Inspector を使用したツールのテスト

  • カスタム MCP と VS Code の統合

  • 公開共有用の MCP プロジェクトの準備

主なポイントはシンプルです:

MCP は、AI アプリケーションが外部ツールや機能を発見し、対話するための標準化された方法を提供します。


著者

Samama Zaid

Model Context Protocol with Python の学習と実装のための実践プロジェクトとして構築されました。

F
license - not found
Not graded
quality - not tested
C
maintenance

Maintenance

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

Related MCP Servers

  • F
    license
    A
    quality
    C
    maintenance
    An MCP server that transforms repositories into queryable knowledge by combining static code analysis with git history tracking. It allows users to investigate codebase structure, identify fragile files based on churn, and receive risk assessments through natural language queries.
    7
  • A
    license
    A
    quality
    B
    maintenance
    A local Git intelligence MCP server that provides deep repository analytics including hotspots, temporal coupling, knowledge maps, churn analysis, and risk scoring for AI agents.
    12
    12
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    A local Git intelligence MCP server that provides deep repository analytics including hotspots, churn, knowledge maps, and risk scoring, all computed from commit history without data leaving your machine.
    12
    MIT

View all related MCP servers

Related MCP Connectors

  • A MCP server built for developers enabling Git based project management with project and personal…

  • An MCP server that gives your AI access to the source code and docs of all public github repos

  • MCP server for static security analysis of Android source code

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/s-zaid-13/git-intel-mcp'

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