git-intel-mcp

git-intel-mcp

A lightweight MCP server that analyzes Git repository history and provides insights through AI-compatible tools. It supports hotspot detection, contributor analysis, and code churn tracking.

Category
访问服务器

README

Git Intelligence MCP Server

A lightweight Model Context Protocol (MCP) server that turns Git history into actionable repository insights.

<p align="center"> <img src="https://img.shields.io/badge/Python-3.10%2B-3776AB?logo=python&logoColor=white" alt="Python"> <img src="https://img.shields.io/badge/MCP-Server-8A2BE2" alt="MCP Server"> <img src="https://img.shields.io/badge/GitPython-Supported-F05032?logo=git&logoColor=white" alt="GitPython"> <img src="https://img.shields.io/badge/Transport-stdio-4B5563" alt="stdio"> </p>

Overview

Git Intelligence MCP is a local MCP server that allows AI assistants to analyze Git repository history through natural-language requests.

Instead of manually running Git commands and interpreting commit history, an MCP-compatible client can call dedicated tools to discover:

  • Frequently changed files
  • Contributor ownership patterns
  • Code churn over time

The project is intentionally lightweight and implemented in a single Python file using the official MCP Python SDK and GitPython.


Why Git Intelligence?

Git history contains useful engineering signals, but extracting them manually can be repetitive.

With Git Intelligence, you can ask questions such as:

"Which files have changed the most?"

"How many developers have worked on server.py?"

"How much code has changed since January 2026?"

The MCP server translates these natural-language requests into structured tool calls and analyzes the repository's Git history.

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

Features

Feature Description
Hotspot Analysis Finds files changed most frequently
Bus Factor Analysis Counts distinct contributors for a file
Code Churn Analysis Calculates lines added and removed since a date
Natural-Language Access Allows AI clients to invoke Git analysis tools
Local Repository Support Works directly with cloned Git repositories
Lightweight Architecture No database or external service required
MCP Inspector Support Easy local tool testing and debugging
VS Code Support Can be connected directly to VS Code as an MCP client

Available MCP Tools

1. hotspots

Identifies the files that have been changed most frequently throughout the repository's commit history.

Arguments

Argument Type Default Description
repo_path string Required Path to the local Git repository
top_n integer 10 Number of files to return

Example prompt

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

Example tool call

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

Example result

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

A frequently modified file can be a useful signal for identifying areas that may deserve additional review or testing.


2. bus_factor

Determines how many distinct contributors have modified a specific file.

Arguments

Argument Type Description
repo_path string Path to the local Git repository
file_path string File to analyze

Example prompt

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

Example tool call

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

Example result

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

A low contributor count can indicate potential knowledge concentration around a particular file.


3. churn_since

Calculates the total number of lines added and removed since a specified date.

Arguments

Argument Type Description
repo_path string Path to the local Git repository
since_date string Start date in YYYY-MM-DD format

Example prompt

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

Example tool call

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

Example result

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

This provides a simple view of how much code has been added and removed during a given period.


Example Workflow

Once connected to an MCP-compatible client, you can interact with the repository using natural language.

Find repository hotspots

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

↓

hotspots()

↓

Repository history

↓

Top 5 hotspot files

Investigate file ownership

How many different developers have worked on server.py?

↓

bus_factor()

↓

Distinct contributors

Analyze development activity

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

↓

churn_since()

↓

Code churn statistics

MCP Client Compatibility

The server uses stdio transport, making it suitable for local MCP-compatible clients.

It has been tested with:

  • MCP Inspector — local development and tool testing
  • VS Code — MCP client integration

The architecture remains simple:

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

Demo

MCP Inspector

The MCP server was tested locally using MCP Inspector to verify tool discovery and execution.

MCP Inspector

VS Code Integration

The server was also connected to VS Code as an MCP client and its tools were successfully discovered.

VS Code MCP Integration


Tech Stack

  • Python 3.10+
  • MCP Python SDK
  • FastMCP
  • GitPython
  • Git
  • stdio transport

The server uses the decorator-based FastMCP API to expose Python functions as MCP tools.


Project Structure

The project intentionally keeps the implementation minimal:

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

Why a single server.py?

This project is designed as a focused MCP learning implementation rather than a large production application.

Keeping the core implementation in one file makes the MCP architecture easy to understand:

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

As the functionality grows, the tools can be separated into dedicated modules.


Installation

1. Clone the repository

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

2. Create a virtual environment

Windows

python -m venv venv
venv\Scripts\activate

macOS / Linux

python -m venv venv
source venv/bin/activate

3. Install dependencies

pip install -r requirements.txt

Requirements

mcp[cli]<2.0.0
gitpython

Run Locally

Start the MCP server with:

python server.py

The server uses stdio transport, so it does not start a traditional web server.

It waits for an MCP-compatible client to establish a connection.


Test with MCP Inspector

MCP Inspector provides an interactive environment for testing MCP servers locally.

Run:

mcp dev server.py

Then:

  1. Connect to the server
  2. Inspect the available tools
  3. Review their generated schemas
  4. Provide arguments
  5. Execute the tools
  6. Verify the returned results

The following tools should be available:

hotspots
bus_factor
churn_since

Connect to VS Code

The MCP server can also be connected directly to VS Code.

Create:

.vscode/mcp.json

Example configuration for 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"
    }
  }
}

After connecting, the following MCP tools should be discoverable in VS Code:

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

Example request:

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

How It Works

The server is built using FastMCP.

A tool is exposed using the MCP SDK decorator:

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

FastMCP uses the function signature and documentation to generate the tool definition that an MCP client can discover.

The complete flow is:

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

MCP Concepts Demonstrated

Tools

The server exposes three callable MCP tools:

hotspots
bus_factor
churn_since

These allow an AI client to perform repository analysis.

Client-Server Architecture

The MCP client does not need to know how the Git analysis is implemented internally.

It only needs to know:

  • Which tools are available
  • What arguments they accept
  • What results they return
MCP Client
     │
     │ MCP
     ▼
MCP Server
     │
     ▼
Git Repository

stdio Transport

The local server communicates using stdio, which is well suited for locally running MCP servers and development clients.


Limitations

This implementation intentionally keeps the scope small.

  • Only local Git repositories are supported.
  • Large repositories may require additional processing time.
  • Churn measures quantity of change, not code quality.

These limitations keep the project focused on understanding MCP rather than building a complete repository analytics platform.


Learning Outcome

This project demonstrates the fundamentals of building an MCP server with Python:

  • Creating an MCP server with the official Python SDK
  • Defining tools with FastMCP
  • Understanding MCP tool schemas
  • Using stdio transport
  • Connecting an MCP server to MCP clients
  • Testing tools with MCP Inspector
  • Integrating a custom MCP with VS Code
  • Preparing an MCP project for public sharing

The main takeaway is simple:

MCP provides a standardized way for AI applications to discover and interact with external tools and capabilities.


Author

Samama Zaid

Built as a hands-on project for learning and implementing the Model Context Protocol with Python.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选