GitHub Analytics MCP Server
Provides tools for inspecting GitHub repository analytics, including repository metadata, recent commits, contributors, open issues, commit activity, repository comparison, and GitHub API rate-limit status.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@GitHub Analytics MCP ServerCompare pallets/flask and django/django. Which repo is more active?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
GitHub Analytics MCP Server
A production-grade Model Context Protocol (MCP) 2.x server for GitHub analytics.
This project goes beyond a basic MCP tutorial and demonstrates how to build an MCP server with the engineering patterns you actually need for real-world use:
Async HTTP
Connection pooling
Explicit timeouts
TTL caching
GitHub rate-limit awareness
Retry with exponential backoff
Structured logging
Input validation
Parallel API requests
Clean MCP lifecycle management
Real end-to-end MCP protocol testing
Built as part of the Production AI Engineering series on Agentic Data Lab.
π₯ YouTube: Agentic Data Lab
What Does This MCP Server Do?
The server exposes GitHub repository analytics as MCP tools.
An MCP-compatible AI client can use it to:
inspect repository metadata
retrieve recent commits
analyze contributors
inspect open issues
analyze commit activity
compare two repositories
inspect GitHub API rate limits
Example:
User:
Compare pallets/flask and django/django.
Which repository looks more active?The AI client can call:
compare_reposand retrieve live GitHub data through this MCP server.
Architecture
βββββββββββββββββββββββ
β MCP Client / AI β
β Claude / MCP Client β
ββββββββββββ¬βββββββββββ
β
β MCP stdio
βΌ
βββββββββββββββββββββββ
β GitHub Analytics β
β MCP Server β
ββββββββββββ¬βββββββββββ
β
βββββββββββ΄ββββββββββ
β β
βΌ βΌ
Input Validation TTL Cache
β
βββββββββββ΄ββββββββββ
β β
CACHE HIT CACHE MISS
β β
β βΌ
β Async HTTP Client
β β
β Retry + Backoff
β β
β βΌ
β GitHub REST API
β β
βββββββββββββββββββββ
β
βΌ
Structured MCP Result7 Production Patterns Implemented
1. Async HTTP + Connection Pooling
The server uses:
httpx.AsyncClientinstead of synchronous HTTP requests.
The HTTP client is created once during the MCP server lifecycle and reused across tool calls.
This provides:
non-blocking I/O
connection reuse
better concurrency
explicit timeout control
The server configures separate timeouts for:
connect
read
write
poolRelated MCP server: ship-it-mcp
2. TTL Caching
AI clients may call the same MCP tool several times during one conversation.
Instead of hitting GitHub every time, the server caches responses in memory.
Example:
First request
MCP Client
β
βΌ
MCP Server
β
βΌ
GitHub API
β
βΌ
CacheSecond request:
MCP Client
β
βΌ
MCP Server
β
βΌ
CACHE HITNo additional GitHub request is required.
Different tools use different TTLs depending on how quickly their data changes.
Tool | Cache TTL |
| 5 minutes |
| 2 minutes |
| 10 minutes |
| 2 minutes |
| 30 minutes |
| 5 minutes |
| 30 seconds |
3. GitHub Rate-Limit Awareness
GitHub exposes rate-limit information through response headers.
The server tracks:
X-RateLimit-Limit
X-RateLimit-Used
X-RateLimit-Remaining
X-RateLimit-Reset
Retry-AfterThe server can detect when GitHub is actually rate limiting requests and return a useful MCP tool error instead of exposing a raw exception.
4. Retry + Exponential Backoff
Transient network failures and upstream 5xx responses are retried automatically.
Retry sequence:
Attempt 1
β
βββ failure
β
βΌ
wait 1s
Attempt 2
β
βββ failure
β
βΌ
wait 2s
Attempt 3
β
βββ final resultThe backoff formula is:
2 ** (attempt - 1)The server does not blindly retry normal 4xx client errors.
5. Structured Logging
MCP stdio uses stdout for protocol communication.
Operational logs are therefore written separately through Python logging.
Example:
2026-08-27T14:14:03 | INFO | Starting GitHub Analytics MCP server
2026-08-27T14:14:04 | INFO | GET /repos/facebook/react β 200
2026-08-27T14:14:04 | INFO | CACHE HIT /repos/facebook/reactThis makes it easy to inspect:
API requests
HTTP status
latency
retry attempts
cache hits
validation failures
rate-limit warnings
6. Input Validation
Repository owner and repository names are validated before any network request is made.
Valid names may contain:
letters
numbers
.
-
_For example:
face../../bookis rejected locally before it can become part of a GitHub API request.
7. Parallel API Requests
The compare_repos MCP tool needs information from two independent repositories.
Instead of fetching them sequentially:
repo_a = await get_repo_a()
repo_b = await get_repo_b()the server runs both requests concurrently:
repo_a, repo_b = await asyncio.gather(
get_repo_a(),
get_repo_b(),
)Conceptually:
Sequential
Repo A ββββββββββββββββΊ Done
Repo B ββββββββββββββββΊ Done
Parallel
Repo A ββββββββββββββββΊ Done
Repo B ββββββββββββββββββββΊ DoneThis reduces elapsed wait time when requests are independent.
Available MCP Tools
The server currently exposes 7 MCP tools.
get_repo_overview
Returns:
stars
forks
open issues
watchers
language
topics
license
last push date
homepage
repository size
Example:
get_repo_overview(
owner="facebook",
repo="react"
)list_recent_commits
Returns recent repository commits.
Example:
list_recent_commits(
owner="vuejs",
repo="core",
limit=5
)get_contributors
Returns top repository contributors.
Example:
get_contributors(
owner="django",
repo="django",
limit=10
)list_open_issues
Returns open GitHub issues while excluding pull requests.
Example:
list_open_issues(
owner="pallets",
repo="flask",
limit=10
)get_commit_activity
Returns repository commit activity including:
total commits
average commits per week
peak activity
recent weekly activity
compare_repos
Compares two repositories side by side.
Example:
compare_repos(
owner1="pallets",
repo1="flask",
owner2="django",
repo2="django"
)Returned fields include:
stars
forks
open issues
language
last pushget_rate_limit_status
Returns GitHub API rate-limit information plus local MCP server counters.
Example:
{
"limit": 60,
"used": 4,
"remaining": 56,
"resets_in_seconds": 3599,
"server_outbound_http_requests": 4,
"server_cache_hits": 1
}Actual values depend on your current GitHub API usage.
Project Structure
mcp-github-analytics/
β
βββ server.py
β βββ Main MCP server and GitHub tools
β
βββ demo_mcp.py
β βββ Real end-to-end MCP client demo
β
βββ requirements.txt
β βββ Python dependencies
β
βββ .env.example
β βββ Environment variable template
β
βββ .gitignoreSetup
1. Clone the Repository
git clone https://github.com/sweta2503/mcp-github-analytics.gitMove into the project:
cd mcp-github-analytics2. Create a Virtual Environment
python -m venv .venvmacOS / Linux
source .venv/bin/activateWindows
.venv\Scripts\activate3. Install Dependencies
pip install -r requirements.txtThe project uses:
mcp[cli]==2.1.1
httpx==0.28.1
python-dotenv==1.2.3GitHub Token Setup
A GitHub token is optional when working only with public repositories, but it is recommended.
Copy the example environment file:
cp .env.example .envAdd your GitHub token:
GITHUB_TOKEN=your_github_token_hereDo not commit your real .env file or token.
Run the Real MCP Demo
Run:
python demo_mcp.pyThis is a real MCP end-to-end test.
demo_mcp.py does not simply import the functions from server.py.
Instead it:
1. Starts server.py as an MCP subprocess
2. Connects using MCP stdio
3. Negotiates the MCP protocol
4. Discovers the MCP tools
5. Calls the tools through MCP
6. Receives structured MCP responsesYou should see output similar to:
MCP CONNECTED β discover the real server tools
Negotiated protocol: ...
Tools discovered (7):
get_repo_overview
list_recent_commits
get_contributors
list_open_issues
get_commit_activity
compare_repos
get_rate_limit_statusTest the Cache
The demo calls:
get_repo_overview(facebook/react)twice.
The first call hits GitHub.
The second should show:
CACHE HITand return significantly faster.
Test Parallel Repository Comparison
The demo also runs:
compare_repos(
pallets/flask,
django/django
)Both upstream GitHub requests are fired concurrently through:
asyncio.gather(...)Capture Demo Output and Server Logs
You can capture the MCP client output and server logs separately:
python demo_mcp.py > demo_output.txt 2> server.logThis creates:
demo_output.txtfor MCP client responses and:
server.logfor server-side logs.
The server log contains useful information such as:
GET /repos/facebook/react β 200
CACHE HIT /repos/facebook/react
GET /repos/pallets/flask β 200
GET /repos/django/django β 200Run the Server Directly
You can start the MCP server itself with:
python server.pyThe server runs over MCP stdio.
Normally an MCP-compatible client launches this process automatically.
Connect the Server to Claude Desktop
You do not need to keep a machine-specific claude_desktop_config.json inside this repository.
Instead, add the server to your local Claude Desktop configuration.
Example:
{
"mcpServers": {
"github-analytics": {
"command": "/ABSOLUTE/PATH/TO/mcp-github-analytics/.venv/bin/python",
"args": [
"/ABSOLUTE/PATH/TO/mcp-github-analytics/server.py"
],
"env": {
"GITHUB_TOKEN": "YOUR_GITHUB_TOKEN"
}
}
}
}Replace:
/ABSOLUTE/PATH/TO/mcp-github-analyticswith the actual project location on your computer.
Never commit your real GitHub token.
After restarting Claude Desktop, the GitHub analytics tools should become available to Claude.
Example prompt:
Compare pallets/flask and django/django.
Which repository appears more active?
Use the GitHub MCP tools and explain which data you used.End-to-End Request Flow
User
β
βΌ
Claude / MCP Client
β
β MCP tool call
βΌ
GitHub Analytics MCP Server
β
βββ Validate input
β
βββ Check TTL cache
β
βββ Cache hit βββββββββββββββΊ Return result
β
βββ Cache miss
β
βΌ
Async HTTP
β
Retry / Backoff
β
βΌ
GitHub REST API
β
βΌ
Response
β
βΌ
TTL Cache
β
βΌ
Structured MCP Response
β
βΌ
AI / MCP ClientLocal vs Distributed Production MCP
This project intentionally uses an in-memory TTL cache because it is designed as a clear local/stdio MCP example.
For a multi-instance remote MCP deployment, you would typically replace process-local state with infrastructure such as:
Redis
PostgreSQL
distributed rate limiting
centralized observability
authentication
tracingThe patterns demonstrated in this repository are the building blocks for that next stage.
Watch the Full Build
I explain the architecture, code, caching, retry logic, validation, parallel requests and real MCP demo on my YouTube channel:
π₯ Agentic Data Lab
https://www.youtube.com/@agenticdatalab
On the channel I cover:
Production AI Engineering
MCP
AI Agents
LangGraph
RAG
AI evaluations
Agent observability
AI system design
Data Engineering + AI
Production benchmarks and experiments
If you're interested in building AI systems that go beyond tutorial demos, consider subscribing.
π YouTube: Agentic Data Lab
Contributing
Issues, improvements and pull requests are welcome.
If you extend the MCP server with another useful GitHub analytics tool, feel free to open a PR.
Support the Project
If this repository helped you:
β Star the repository
π΄ Fork it and build your own MCP tools
βΆοΈ Subscribe to Agentic Data Lab
More production AI engineering projects are coming.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Code intelligence for LLMs. Analyze, search, and retrieve code from any public git repository.
Access the GitHub API, enabling file operations, repository management, search functionality, andβ¦
Connect AI assistants to GitHub - manage repos, issues, PRs, and workflows through natural language.
Manage repositories, users, releases, and automate GitHub workflows
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables Large Language Models to analyze GitHub repositories in real-time, providing tools for retrieving repository information, analyzing issues, accessing documentation, and visualizing activity.
- FlicenseNot gradedqualityCmaintenanceEnables to interact with GitHub repositories directly from Claude, supporting actions like viewing repos, checking status, committing and pushing changes, and managing pull requests.
- FlicenseAqualityDmaintenanceEnables Claude to access and manage GitHub repositories dynamically at runtime, including private repos, with tools for browsing files, searching code, and viewing commits, pull requests, and issues.111
- AlicenseNot gradedqualityDmaintenanceEnables Claude to analyze GitHub repositories with tools for health scoring, contributor analysis, issue tracking, code search, and more.MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/sweta2503/mcp-github-analytics'
If you have feedback or need assistance with the MCP directory API, please join our Discord server