Git Analytics MCP Server

Git Analytics MCP Server

Provides comprehensive Git repository insights including author statistics, branch health, and code churn analysis. It enables users to perform data-driven assessments of their codebase and track development patterns through the Model Context Protocol.

Category
Visit Server

README

Git Analytics MCP Server

๐Ÿš€ A comprehensive Model Context Protocol (MCP) server that provides detailed Git repository analytics and insights. Perfect for developers who want to understand their codebase better through data-driven insights.

๐Ÿ“Š Features

Repository Analytics

  • Comprehensive Stats: Total commits, authors, branches, and code changes
  • Author Analysis: Contributor rankings, commit patterns, and activity periods
  • Branch Intelligence: Branch health, ahead/behind status, and activity metrics
  • File Insights: Most modified files, author contributions per file
  • Temporal Analysis: Commit frequency, code churn over time
  • Visual Reports: Beautifully formatted terminal output with colors and emojis

Available Tools

  1. get_repository_overview - Executive summary with key metrics and top contributors
  2. get_repository_stats - Detailed repository statistics
  3. get_author_stats - Complete contributor analysis
  4. get_branch_stats - Branch health and comparison metrics
  5. get_file_stats - File modification patterns and hotspots
  6. get_commit_history - Detailed commit timeline with filters
  7. get_commit_frequency - Daily commit patterns over time
  8. get_code_churn - Lines added/removed analysis

๐Ÿ›  Installation

Prerequisites

  • Node.js 18+
  • npm or yarn
  • Git repository to analyze

Quick Setup

# Clone or create the project
cd ~/git-analytics-mcp-server

# Install dependencies
npm install

# Build the project
npm run build

# Test the server (optional)
npm test

Development Mode

# Run in development with auto-reload
npm run dev

๐Ÿš€ Usage

As MCP Server

Add to your MCP client configuration:

{
  "mcpServers": {
    "git-analytics": {
      "command": "node",
      "args": ["/path/to/git-analytics-mcp-server/dist/index.js"]
    }
  }
}

Direct CLI Usage

# Install globally
npm install -g .

# Use anywhere
git-analytics-mcp

๐Ÿ“ˆ Example Analytics

Repository Overview

๐Ÿ“Š REPOSITORY SUMMARY REPORT
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
Repository Statistics:
  โ€ข Total Commits: 1,247
  โ€ข Total Authors: 12
  โ€ข Active Branches: 8
  โ€ข Code Changes: +45,678 -12,345
  โ€ข Repository Age: 2023-01-15 to 2024-06-15

Top Contributors:
  ๐Ÿฅ‡ John Doe - 456 commits
  ๐Ÿฅˆ Jane Smith - 234 commits
  ๐Ÿฅ‰ Bob Wilson - 189 commits
  ๐Ÿ… Alice Brown - 145 commits
  ๐Ÿ… Mike Johnson - 123 commits

Recent Activity:
  โ€ข a1b2c3d4 Add new authentication module (John Doe)
  โ€ข e5f6g7h8 Fix critical security vulnerability (Jane Smith)
  โ€ข i9j0k1l2 Update documentation and examples (Bob Wilson)

Author Analysis

[
  {
    "name": "John Doe",
    "email": "john@example.com",
    "commits": 456,
    "insertions": 12340,
    "deletions": 3456,
    "firstCommit": "2023-01-15T10:30:00Z",
    "lastCommit": "2024-06-15T14:22:00Z"
  }
]

Code Churn Analysis

[
  {
    "date": "2024-06-01",
    "insertions": 234,
    "deletions": 45,
    "net": 189
  },
  {
    "date": "2024-06-02",
    "insertions": 156,
    "deletions": 89,
    "net": 67
  }
]

๐Ÿ”ง Configuration

Tool Parameters

Most tools accept these common parameters:

  • path (string): Repository path (default: current directory)
  • days (number): Time range for analysis (default: 30)
  • limit (number): Maximum results to return (default: 50)

Environment Variables

# Set default repository path
export GIT_ANALYTICS_DEFAULT_PATH="/path/to/repo"

# Enable debug logging
export GIT_ANALYTICS_DEBUG=true

๐Ÿงช Testing

# Run all tests
npm test

# Run with coverage
npm run test:coverage

# Test specific functionality
npm run test -- --grep "author stats"

Test Repository Setup

# Create test repository
mkdir test-repo && cd test-repo
git init
echo "# Test" > README.md
git add . && git commit -m "Initial commit"

# Test the server
node dist/index.js

๐Ÿ“Š Use Cases

Development Team Analytics

  • Code Review Insights: Identify files that need more attention
  • Team Productivity: Track commit patterns and contribution metrics
  • Technical Debt: Find files with high churn rates
  • Onboarding: Understand codebase structure and key contributors

Project Management

  • Release Planning: Analyze recent development velocity
  • Resource Allocation: Identify knowledge silos and areas needing support
  • Quality Metrics: Track code stability through churn analysis
  • Timeline Analysis: Understand development patterns and cycles

Repository Health

  • Branch Management: Identify stale or problematic branches
  • File Hotspots: Find files that may need refactoring
  • Contributor Onboarding: Welcome new team members with context
  • Historical Analysis: Learn from past development patterns

๐Ÿ›  Advanced Features

Custom Analytics

Extend the server with custom analytics:

// Add to git-analytics.ts
async getCustomMetric(): Promise<CustomMetric> {
  // Your custom analysis logic
}

Integration Examples

# Use with GitHub CLI
gh repo list | xargs -I {} git-analytics-mcp --path {}

# Batch analysis
find ~/projects -name ".git" -type d | \
  xargs -I {} dirname {} | \
  xargs -I {} git-analytics-mcp --path {}

๐Ÿ› Troubleshooting

Common Issues

"Invalid Git repository"

  • Ensure you're in a Git repository or provide correct path
  • Check Git installation: git --version

"Permission denied"

  • Verify read access to repository
  • Check file permissions on .git directory

"No commits found"

  • Repository may be empty or newly initialized
  • Try with a repository that has commits

Debug Mode

# Enable verbose logging
DEBUG=git-analytics:* npm start

# Check server connectivity
echo '{}' | node dist/index.js

๐Ÿค Contributing

  1. Fork the repository
  2. Create feature branch: git checkout -b feature/amazing-feature
  3. Commit changes: git commit -m 'Add amazing feature'
  4. Push to branch: git push origin feature/amazing-feature
  5. Open Pull Request

Development Setup

# Install dev dependencies
npm install

# Run in watch mode
npm run dev

# Lint code
npm run lint

# Format code
npm run format

๐Ÿ“„ License

MIT License - see LICENSE file for details.

๐ŸŒŸ Acknowledgments


Happy Analyzing! ๐Ÿ“Šโœจ

For questions, issues, or feature requests, please open an issue on GitHub.

MCP-Server

MCP-Server

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured