GitHub Analytics MCP Server
GitHub Analytics MCP Server
GitHub 분석을 위한 프로덕션 수준의 Model Context Protocol (MCP) 2.x 서버입니다.
이 프로젝트는 기본적인 MCP 튜토리얼을 넘어, 실제 운영 환경에서 정말로 필요한 엔지니어링 패턴으로 MCP 서버를 구축하는 방법을 보여줍니다:
비동기 HTTP
연결 풀링
명시적 타임아웃
TTL 캐싱
GitHub rate limit 인식
지수 백오프 재시도
구조화된 로깅
입력 검증
병렬 API 요청
깔끔한 MCP 라이프사이클 관리
실제 엔드투엔드 MCP 프로토콜 테스트
Agentic Data Lab의 Production AI Engineering 시리즈의 일부로 제작되었습니다.
🎥 YouTube: Agentic Data Lab
이 MCP 서버는 무엇을 하나요?
이 서버는 GitHub 저장소 분석 기능을 MCP 도구로 제공합니다.
MCP 호환 AI 클라이언트는 다음 작업에 이 서버를 사용할 수 있습니다:
저장소 메타데이터 확인
최근 커밋 가저오기
기여자 분석
열린 이슈 확인
커밋 활동 분석
두 저장소 비고
GitHub API rate limit 확인
예:
User:
Compare pallets/flask and django/django.
Which repository looks more active?AI 클라이언트는 다음을 호출할 수 있습니다:
compare_repos그리고 이 MCP 서버를 통해 실시간 GitHub 데이터를 가져옵니다.
아키텍처
┌─────────────────────┐
│ 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 Result구현된 7가지 프로덕션 패턴
1. 비동기 HTTP + 연결 풀링
서버는 다음을 사용합니다:
httpx.AsyncClient동기식 HTTP 요청 대신에 사용합니다.
HTTP 클라이언트는 MCP 서버 라이프사이클 동안 한 번 생성되어 도구 호출 간에 재사용됩니다.
이를 통해 제공되는 이점:
논블로킹 I/O
연결 재사용
더 나은 동시성
명시적 타임아웃 제어
서버는 다음 항목에 대해 별도로 타임아웃을 설정합니다:
connect
read
write
poolRelated MCP server: ship-it-mcp
2. TTL 캐싱
AI 클라이언트는 한 대화 중에 동일한 MCP 도구를 여러 번 호출할 수 있습니다.
서버는 매번 GitHub에 요청하는 대신 응답을 메모리에 캐시합니다.
예:
First request
MCP Client
│
▼
MCP Server
│
▼
GitHub API
│
▼
Cache두 번째 요청:
MCP Client
│
▼
MCP Server
│
▼
CACHE HIT추가 GitHub 요청이 필요 없습니다.
각 도구는 데이터가 변경되는 주기에 따라 서로 다른 TTL을 사용합니다.
도구 | 캐시 TTL |
| 5분 |
| 2분 |
| 10분 |
| 2분 |
| 30분 |
| 5분 |
| 30초 |
3. GitHub ratte limit 인지
GitHub는 응답 헤더를 통해 rate limit 정보를 노출합니다.
서버는 다음을 추적합니다:
X-RateLimit-Limit
X-RateLimit-Used
X-RateLimit-Remaining
X-RateLimit-Reset
Retry-After서버는 GitHub가 실졔로 요청에 rate limit을 적용하고 있을 때를 감지하여, 원시 예외를 노출하는 대신 유용한 MCP 도구 오류를 반환할 수 있습니다.
4. 재시도 + 지수 백오프
일시적인 네트워크 오류와 업스트림 5xx 응답은 자동으로 재시도됩니다.
재시도 순서:
Attempt 1
│
└── failure
│
▼
wait 1s
Attempt 2
│
└── failure
│
▼
wait 2s
Attempt 3
│
└── final result백오프 공식은 다음과 같습니다:
2 ** (attempt - 1)서버는 일반적인 4xx 클라이언트 오류를 무작정 재시도하지 않습니다.
5. 구조화된 로깅
MCP stdio는 프로토콜 통신에 stdout을 사용합니다.
따라서 운영 로그는 Python 로깅을 통해 별도로 기록됩니다.
예:
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/react이를 통해 다음 항목을 쉽게 확인할 수 있습니다:
API 요청
HTTP 상태
지연 시간
재시도 횟수
캐시 적중
검증 실패
rate limit 경고
6. 입력 검증
저장소 소유자와 저장소 이름은 네트워크 요청을 보내기 전에 검증됩니다.
유효한 이름은 다음을 포함할 수 있습니다:
letters
numbers
.
-
_예를 들어:
face../../book이 값은 GitHub API 요청의 일부가 되기 전에 로컬에서 거부됩니다.
7. 병렬 API 요청
compare_repos MCP 도구는 서로 독립적인 두 저장소의 정보가 필요합니다.
순차적으로 가져오는 대신:
repo_a = await get_repo_a()
repo_b = await get_repo_b()서버는 두 요청을 동시에 실행합니다:
repo_a, repo_b = await asyncio.gather(
get_repo_a(),
get_repo_b(),
)개념적으로:
Sequential
Repo A ───────────────► Done
Repo B ───────────────► Done
Parallel
Repo A ───────────────► Done
Repo B ───────────────────► Done이렇게 하면 요청이 독립적일 때 대기 시간이 줄어듭니다.
사용 가능한 MCP 도구
서버는 현재 7개의 MCP 도구를 제공합니다.
get_repo_overview
반환 항목:
스타 수
포크 수
열린 이슈
워처 수
언어
토픽
라이선스
마지막 시 날짜
홈페이지
저장소 크기
예:
get_repo_overview(
owner="facebook",
repo="react"
)list_recent_commits
저장소의 최근 커밋을 반환합니다.
예:
list_recent_commits(
owner="vuejs",
repo="core",
limit=5
)get_contributors
저장소의 주요 기여자들을 반환합니다.
예:
get_contributors(
owner="django",
repo="django",
limit=10
)list_open_issues
풀 리퀘스트를 제외한 열린 GitHub 이슈를 반환합니다.
예:
list_open_issues(
owner="pallets",
repo="flask",
limit=10
)get_commit_activity
저장소의 커밋 활동을 반환하며 다음을 포함합니다:
총 커밋 수
주당 평균 커밋 수
최대 활동
최근 주간 활동
compare_repos
두 저장소를 나란히 비교합니다.
예:
compare_repos(
owner1="pallets",
repo1="flask",
owner2="django",
repo2="django"
)반환되는 필드에는 다음이 포함됩니다:
stars
forks
open issues
language
last pushget_rate_limit_status
GitHub API rate limit 정보와 로컬 MCP 서버 카운터를 반환합니다.
예:
{
"limit": 60,
"used": 4,
"remaining": 56,
"resets_in_seconds": 3599,
"server_outbound_http_requests": 4,
"server_cache_hits": 1
}실제 값은 현재 GitHub API 사용량에 따라 달라집니다.
프로젝트 구조
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
│
└── .gitignore설정
1. 저장소 클론
git clone https://github.com/sweta2503/mcp-github-analytics.git프로젝트 디렉터리로 이동합니다:
cd mcp-github-analytics2. 가상 환경 생성
python -m venv .venvmacOS / Linux
source .venv/bin/activateWindows
.venv\Scripts\activate3. 의존성 설치
pip install -r requirements.txt프로젝트에서 사용하는 것:
mcp[cli]==2.1.1
httpx==0.28.1
python-dotenv==1.2.3GitHub 토큰 설정
GitHub 토큰은 공개 저장소만 사용하는 경우 선택 사항이지만, 사용을 권장합니다.
예제 환경 파일을 복사합니다:
cp .env.example .envGitHub 토큰을 추가합니다:
GITHUB_TOKEN=your_github_token_here실제 .env 파일이나 토큰을 커밋하지 마세요.
실제 MCP 데모 실행
실행:
python demo_mcp.py이것은 실제 MCP 엔드투엔드 테스트입니다.
demo_mcp.py는 server.py의 함수를 단순히 임포트하지 않습니다.
대신 다음을 수행합니다:
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 responses다음과 유사한 출력이 표시됩니다:
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_status캐시 테스트
데모는 다음을 호출합니다:
get_repo_overview(facebook/react)두 번.
첫 번째 호출은 GitHub에 실제 요청을 보냅니다.
두 번째 호출에는 다음이 표시됩니다:
CACHE HIT그리고 훨씬 더 빠르게 반환됩니다.
병렬 저장소 비교 테스트
데모는 또한 다음을 실행합니다:
compare_repos(
pallets/flask,
django/django
)두 업스트림 GitHub 요청은 다음을 통해 동시에 실행됩니다:
asyncio.gather(...)데모 출력 및 서버 로그 캡처
MCP 클라이언트 출력과 서버 로그를 각각 캡처할 수 있습니다:
python demo_mcp.py > demo_output.txt 2> server.log이렇게 하면 다음이 생성됩니다:
demo_output.txtMCP 클라이언트 응답용이며:
server.log서버 측 로그용입니다.
서버 로그에는 다음과 같은 유용한 정보가 포함됩니다:
GET /repos/facebook/react → 200
CACHE HIT /repos/facebook/react
GET /repos/pallets/flask → 200
GET /repos/django/django → 200서버 직접 실행
MCP 서버 자체는 다음 명령으로 시작할 수 있습니다:
python server.py서버는 MCP stdio를 통해 실행됩니다.
일반적으로 MCP 호환 클라이언트가 이 프로세스를 자동으로 실행합니다.
서버를 Claude Desktop에 연결
이 저장소 안에 머신별 claude_desktop_config.json을 유지할 필요는 없습니다.
대신 서버를 로컬 Claude Desktop 설정에 추가하세요.
예:
{
"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"
}
}
}
}다음 항목을 교체하세요:
/ABSOLUTE/PATH/TO/mcp-github-analytics컴퓨터에 있는 실제 프로젝트 위치로 교체합니다.
실제 GitHub 토큰을 절대 커밋하지 마세요.
Claude Desktop을 다시 시작하면 GitHub 분석 도구를 Claude에서 사용할 수 있습니다.
예시 프롬프트:
Compare pallets/flask and django/django.
Which repository appears more active?
Use the GitHub MCP tools and explain which data you used.엔드투엔드 요청 흐름
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 Client로컬 vs 분산 프로덕션 MCP
이 저장소는 명확한 로컬/stdio MCP 예제로 설계되었기 때문에 의도적으로 인메모리 TTL 캐시를 사용합니다.
다중 인스턴스 원격 MCP 배포의 경우 일반적으로 프로세스 로컬 상태를 다음과 같은 인프라로 대체합니다:
Redis
PostgreSQL
distributed rate limiting
centralized observability
authentication
tracing이 저장소에서 보여준 패턴은 다음 단계를 위한 구성 요소입니다.
전체 빌드 보기
제 YouTube 채널에서 아키텍처, 코드, 캐싱, 재시도 로직, 검증, 병렬 요청, 실제 MCP 데모를 설명합니다:
🎥 Agentic Data Lab
https://www.youtube.com/@agenticdatalab
채널에서 다루는 주제:
Production AI Engineering
MCP
AI 에이전트
LangGraph
RAG
AI 평가
에이전트 관찰 가능성
AI 시스템 설계
데이터 엔지니어링 + AI
프로덕션 벤치마크와 실험
튜토리얼 데모를 넘어서는 AI 시스템 구축에 관심이 있다면 구독을 고려해 보세요.
👉 YouTube: Agentic Data Lab
기여
이슈, 개선 사항, 풀 리퀘스트를 환영합니다.
유용한 GitHub 분석 도구를 추가로 MCP 서버에 확장했다면 PR을 열어 주세요.
프로젝트 지원
이 저장소가 도움이 되었다면:
⭐ 저장소에 스타를 남겨 주세요
🍴 포크해서 나만의 MCP 도구를 만들어 보세요
▶️ Agentic Data Lab 구독하기
더 많은 프로덕션 AI 엔지니어링 프로젝트가 곧 공개됩니다.
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