GitHub Analytics MCP Server

Local setup required. This server has to be cloned and prepared on your machine before you register it in Claude Code.
1

Set the server up locally

Run this once to clone and prepare the server before adding it to Claude Code.

Run in terminal
make k8s-deploy
2

Register it in Claude Code

After the local setup is done, run this command to point Claude Code at the built server.

Run in terminal
claude mcp add -e "GITHUB_TOKEN=${GITHUB_TOKEN}" github-analytics -- python "<FULL_PATH_TO_GITHUB_ANALYTICS_MCP>/dist/index.js"

Replace <FULL_PATH_TO_GITHUB_ANALYTICS_MCP>/dist/index.js with the actual folder you prepared in step 1.

Required:GITHUB_TOKEN
README.md

Query, analyze, and visualize any public GitHub repository

GitHub Analytics MCP Server — Architecture Reference Project

Query, analyze, and visualize any public GitHub repository — from the command line, browser, or AI agent.


Overview

GitHub Analytics MCP Server is a production-ready microservice that turns the GitHub API into a simple, self-hosted analytics endpoint. Point it at any public repository and instantly get structured data on stars, forks, contributors, commit history, and language distribution.

It exposes two interfaces: a RESTful API (FastAPI with auto-generated Swagger docs) for direct HTTP access, and a Model Context Protocol (MCP) server that lets AI agents like Claude Desktop query GitHub data as a native tool.

The entire stack — API gateway, MCP server, container orchestration, infrastructure provisioning, and CI/CD — is included and deployable with a single command.

This project also serves as an architecture reference implementation: every layer is accompanied by design-decision documentation explaining why it is structured this way, not just what it does.

Features

  • 🔍 Query any public GitHub repository by owner/name
  • 📊 Repository statistics — stars, forks, issues, watchers
  • 👥 Contributor analysis — top contributors with commit counts
  • 📝 Commit history — recent commits with author and message details
  • 🌐 RESTful API with auto-generated OpenAPI/Swagger docs
  • 🤖 MCP Protocol support for AI agent integration (Claude Desktop, etc.)
  • 🐳 Production-ready with Docker multi-stage builds and Docker Compose
  • ☸️ Kubernetes deployment with Deployments, Services, Ingress, and HPA
  • 📈 Auto-scaling — Horizontal Pod Autoscaler (2–5 replicas, 70% CPU target)
  • 🔄 Full CI/CD pipeline — lint, test, build, and deploy via GitHub Actions
  • 🏗️ Infrastructure as Code — Terraform provisions the entire K8s stack

Why This Project?

Concern This Project Traditional Approach
Setup docker-compose up or make k8s-deploy Manual server provisioning
Scalability Auto-scaling with K8s HPA (2–5 replicas) Manual capacity planning
Infrastructure terraform apply — one command Multiple manual steps
High Availability Multi-replica with health checks Complex setup required
Monitoring Liveness & readiness probes built in Separate monitoring stack
Deployment Automated CI/CD on every push Manual release process
Portability Runs anywhere Docker/K8s runs Environment-dependent
API Docs Auto-generated OpenAPI (Swagger UI) Manual documentation

This is not just a tool — it is a reference implementation designed for studying architecture patterns. Every layer includes design-decision documentation explaining the reasoning behind its structure.

Architecture

graph TB
    subgraph "User Interface"
        A[Web Browser / CLI]
    end

    subgraph "API Layer"
        B[FastAPI GatewayPort 8080]
        C[MCP Serverstdio mode]
    end

    subgraph "Container Orchestration"
        D[Kubernetes Cluster]
        E[Docker Containers]
        F[Auto-scaling HPA]
    end

    subgraph "External Services"
        G[GitHub API]
    end

    subgraph "Infrastructure"
        H[Terraform IaC]
        I[CI/CD Pipeline]
    end

    A -->|HTTP/REST| B
    A -->|MCP Protocol| C
    B -->|GitHub Token| G
    C -->|GitHub Token| G
    B -.->|Deployed in| D
    C -.->|Deployed in| D
    D -->|Manages| E
    D -->|Auto-scales| F
    H -.->|Provisions| D
    I -.->|Deploys to| D

Design Philosophy

One domain, two interfaces, shared core

GitHubClient is the single business-logic layer. The MCP Server and FastAPI Gateway are both thin adapters — they translate between their respective protocols and the shared core. Neither contains business logic, and neither duplicates the other.

Why two interfaces: MCP serves AI agents over stdio; REST serves humans and programs over HTTP. Two protocols, two adapters, zero duplicated logic.

Error handling strategy

Custom exception hierarchy (RepositoryNotFoundError, AuthenticationError, RateLimitError) translates GitHub HTTP status codes into semantic domain errors. The MCP server converts these into user-friendly text messages; the FastAPI gateway converts them into the corresponding HTTP status codes (404/401/429/502). Callers never need to know how the GitHub API works internally.

Infrastructure: three layers for three use cases

  • Docker Compose — local development. One command (docker-compose up) starts everythi

Tools (3)

get_repository_statsRetrieve repository statistics including stars, forks, issues, and watchers.
get_top_contributorsAnalyze and list top contributors with their commit counts.
get_commit_historyFetch recent commit history with author and message details.

Environment Variables

GITHUB_TOKENrequiredPersonal access token for GitHub API authentication

Configuration

claude_desktop_config.json
{"mcpServers": {"github-analytics": {"command": "python", "args": ["path/to/server.py"], "env": {"GITHUB_TOKEN": "your_token_here"}}}}

Try it

Analyze the repository facebook/react and tell me the current number of stars and forks.
Who are the top 5 contributors to the microsoft/vscode repository based on commit count?
Show me the last 5 commits for the repository python/cpython and summarize the changes.
Compare the repository statistics for two different projects.

Frequently Asked Questions

What are the key features of GitHub Analytics?

Query any public GitHub repository by owner and name. Retrieve repository statistics including stars, forks, issues, and watchers. Analyze contributor activity with commit counts. Fetch recent commit history with author and message details. Support for both MCP protocol and RESTful API.

What can I use GitHub Analytics for?

Quickly gathering repository health metrics for project evaluation. Identifying key contributors in open source projects for collaboration. Monitoring recent development activity in specific repositories via AI agents. Integrating GitHub data into automated reporting workflows.

How do I install GitHub Analytics?

Install GitHub Analytics by running: docker-compose up

What MCP clients work with GitHub Analytics?

GitHub Analytics works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep GitHub Analytics docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare