Token导航 LogoToken导航TokenDH.com
GitHub Analyzer Pro MCP Server logo
开发工具stdio官方级别未说明来源级核验

GitHub Analyzer Pro MCP Server

MCP Server

GitHub Analyzer Pro MCP Server是一款基于FastMCP构建的GitHub分析工具,提供28+功能强大的工具,用于全面的GitHub仓库、用户和代码分析。

工具数

33

提示词数

0

GitHub Stars

1

资源数

0
PythonClaude代码搜索Claude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

iamthite

提供方

iamthite

最后核验

2026/5/17 20:21

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

pip install fastmcp httpx python-dotenv

详细介绍

🐙 GitHub Analyzer Pro MCP服务器v2.0

A. 生产准备就绪 模型上下文协议(MCP)服务器 28+强大的工具 用于使用FastMCP构建的全面GitHub分析。

](https://www.python.org/downloads/) ![FastMCP](https://github.com/jlowin/fastmcp) ](https://docs.github.com/rest) ![Production Ready](https://github.com)

______________________________________________________________________

✨ 完整功能集

📦 存储库分析 (8工具)

  • get_pository_info -包含统计信息的完整仓库元数据
  • get_pository_语言 -按百分比分列的语言
  • get_pository_conibutors -顶级贡献者排名
  • get_pository_tags -发布标签列表
  • get_pository_brances -具有保护状态的分支机构信息
  • get_pository_stats -全面分析
  • get_pository_traft -视图和克隆(需要权限)
  • get_pository_社区 -健康评分和社区文件

📝 承诺与历史 (3个工具)

  • get_pository_commits -与作者分享历史
  • get_commit_details -深入了解具体的提交
  • comparecommits -比较分支或提交

🐛 问题和拉取请求 (3个工具)

  • 获取库存问题 -按州、标签筛选
  • get_pull_requests -具有合并状态的PR详细信息
  • 获取问题注释 -评论帖子

📁 文件和内容 (4工具)

  • 获取_文件_内容 -从repo读取任何文件
  • get_directory_contents -浏览目录结构
  • get_pository_readme -快速访问README
  • 搜索代码 -跨存储库查找代码

🔍 搜索与发现 (5工具)

  • search_repositories -高级回购搜索
  • 搜索用户 -查找用户和组织
  • 搜索主题 -发现GitHub主题
  • get_trending_repositories -按语言分类的热门存储库
  • 获取_渲染_开发人员 -活跃的开发人员

👤 用户和组织 (4工具)

  • get_user_profile -完整的用户信息
  • get_user_repositories -用户的公共仓库
  • 获取用户活动 -最近的活动提要
  • 获取组织信息 -组织详细信息

📦 发布与套餐 (2个工具)

  • 获取租赁 -所有带有下载统计信息的版本
  • get_latest_release -最新发布详情

⚙️ 工作流程和操作 (2个工具)

  • get_workflows -列出GitHub操作工作流
  • get_workflow_run -最近的工作流执行历史记录

🛠️ 公用事业 (2个工具)

  • get_rate_limit -检查API费率限制状态
  • 服务器信息 -服务器功能和统计数据

______________________________________________________________________

🚀 快速开始

1.安装依赖项

pip install fastmcp httpx python-dotenv

2.设置GitHub Token(推荐)

无令牌: 60个请求/小时\ 使用令牌: 5000次请求/小时+完全搜索权限

# Linux/Mac
export GITHUB_TOKEN='ghp_your_token_here'

# Windows PowerShell
$env:GITHUB_TOKEN='ghp_your_token_here'

# Or create .env file
echo "GITHUB_TOKEN=ghp_your_token_here" > .env

获取您的令牌: https://github.com/settings/tokens

  • 所需范围: public_repo, read:user
  • 可选: repo (用于私有存储库)

3.运行服务器

python github_server.py

预期产量:

============================================================
🐙 GitHub Analyzer Pro MCP Server v2.0.0
============================================================

📡 Server Configuration:
   Transport: HTTP
   Host: 0.0.0.0
   Port: 8001
   Timeout: 30.0s

🔑 Authentication:
   GitHub Token: ✓ Configured
   Rate Limit: 5000/hr

📊 Available Tools: 28
   • Repository Analysis (8 tools)
   • Commits & History (3 tools)
   • Issues & PRs (3 tools)
   • Files & Content (4 tools)
   • Search & Discovery (5 tools)
   • Users & Organizations (4 tools)
   • Releases & Packages (2 tools)
   • Workflows & Actions (2 tools)
   • Utilities (2 tools)

✨ Production Features:
   ✓ Enhanced error handling
   ✓ Request caching
   ✓ Rate limit monitoring
   ✓ Community health metrics
   ✓ Traffic analytics
   ✓ GitHub Actions support

🚀 Server Status: READY
   Access at: http://localhost:8001
============================================================

______________________________________________________________________

📚 使用示例

🔍 高级存储库分析

# Get comprehensive stats
{
  "owner": "facebook",
  "repo": "react"
}

# Response includes:
# - Stars, forks, watchers
# - Language breakdown
# - Commit activity
# - Health score
# - Community files
# - Traffic data (if authorized)

📊 语言的分布

# Get language percentages
{
  "owner": "microsoft",
  "repo": "vscode"
}

# Returns:
# - TypeScript: 45.2%
# - JavaScript: 30.1%
# - CSS: 15.7%
# - etc.

👥 主要贡献者

# See who contributes most
{
  "owner": "torvalds",
  "repo": "linux",
  "limit": 10
}

🔄 比较分支机构

# See what changed between branches
{
  "owner": "python",
  "repo": "cpython",
  "base": "3.11",
  "head": "main"
}

# Shows:
# - Commits ahead/behind
# - Files changed
# - Line additions/deletions

🐛 按标签筛选问题

# Find specific issues
{
  "owner": "microsoft",
  "repo": "vscode",
  "state": "open",
  "labels": "bug,high-priority"
}

📦 发布管理

# Get latest release
{
  "owner": "nodejs",
  "repo": "node"
}

# Returns:
# - Version tag
# - Release notes
# - Download links
# - Asset download counts

⚙️ 监控GitHub操作

# Check CI/CD status
{
  "owner": "rust-lang",
  "repo": "rust"
}

# See:
# - All workflows
# - Recent runs
# - Success/failure status

👤 用户活动源

# What's a user been up to?
{
  "username": "gvanrossum",
  "limit": 20
}

# Shows:
# - Recent commits
# - PRs created
# - Issues opened
# - Repos starred

🔥 发现趋势

# Hot Python repos this week
{
  "language": "python",
  "since": "weekly"
}

📈 社区健康

# Check repo health
{
  "owner": "django",
  "repo": "django"
}

# Returns:
# - Health percentage
# - README quality
# - Has CODE_OF_CONDUCT
# - Has CONTRIBUTING guide
# - Issue templates

______________________________________________________________________

🔧 连接到克劳德桌面

配置

macOS:\ ~/Library/Application Support/Claude/claude_desktop_config.json

窗户:\ %APPDATA%\Claude\claude_desktop_config.json

Linux:\ ~/.config/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "github-pro": {
      "url": "http://localhost:8001/mcp/v1"
    }
  }
}

远程服务器:

{
  "mcpServers": {
    "github-pro": {
      "url": "http://your-server-ip:8001/mcp/v1"
    }
  }
}

重新启动克劳德桌面 配置后!

______________________________________________________________________

💬 与克劳德交谈

一旦连接,问克劳德这样的问题:

"Analyze the React repository - give me complete statistics"

"Show me the language breakdown for microsoft/vscode"

"Who are the top 10 contributors to the Linux kernel?"

"Compare the main and develop branches of my-org/my-repo"

"Find all open high-priority bugs in facebook/react"

"What's the latest release of Node.js? Show download counts"

"Are GitHub Actions passing for rust-lang/rust?"

"What has Guido van Rossum been working on lately?"

"Show me trending Rust repositories this month"

"Check the community health score for django/django"

"Search for async functions in the FastAPI codebase"

"Get traffic stats for my repository" (requires auth)

"Show me all workflows and their status for my-org/api"

______________________________________________________________________

🏭 生产特点

增强的错误处理

  • 详细的错误消息
  • 速率限制检测
  • 身份验证失败处理
  • 网络超时管理
  • 找不到资源处理

性能优化

  • 请求超时控制(30s)
  • 响应缓存(5分钟TTL)
  • 高效的批处理请求
  • 最大结果限制

安全

  • 基于令牌的身份验证
  • 安全环境变量
  • 无令牌日志记录
  • 符合费率限制

监控与调试

  • 速率限制跟踪
  • 请求/响应日志记录
  • 服务器运行状况
  • 详细的工具统计

数据质量

  • 响应验证
  • 安全的JSON编码
  • 截断大量响应
  • 二进制文件处理

______________________________________________________________________

🐳 Docker部署

Dockerfile

FROM python:3.10-slim

WORKDIR /app

# Install dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy server
COPY github_server.py .

# Environment
ENV GITHUB_TOKEN=""
ENV PYTHONUNBUFFERED=1

# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
  CMD python -c "import httpx; httpx.get('http://localhost:8001/mcp/v1/health')"

EXPOSE 8001

CMD ["python", "github_server.py"]

需求.txt

fastmcp>=2.14.0
httpx>=0.24.0
python-dotenv>=1.0.0

构建与运行

# Build image
docker build -t github-mcp-pro .

# Run with token
docker run -d \
  -p 8001:8001 \
  -e GITHUB_TOKEN='ghp_your_token' \
  --name github-server \
  --restart unless-stopped \
  github-mcp-pro

# View logs
docker logs -f github-server

# Stop
docker stop github-server

Docker Compose

version: '3.8'

services:
  github-mcp:
    build: .
    ports:
      - "8001:8001"
    environment:
      - GITHUB_TOKEN=${GITHUB_TOKEN}
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "python", "-c", "import httpx; httpx.get('http://localhost:8001/mcp/v1/health')"]
      interval: 30s
      timeout: 10s
      retries: 3

______________________________________________________________________

☁️ 云部署

部署到铁路

# Install Railway CLI
npm install -g @railway/cli

# Login
railway login

# Initialize
railway init

# Deploy
railway up

# Set environment
railway variables set GITHUB_TOKEN=ghp_your_token

# Get URL
railway domain

部署以渲染

  1. 连接您的GitHub存储库
  2. 创建新的Web服务
  3. 设置环境变量:

- GITHUB_TOKEN:您的代币

  1. 构建命令: pip install -r requirements.txt
  2. 启动命令: python github_server.py
  3. 部署!

部署到Fly.io

# Install flyctl
curl -L https://fly.io/install.sh | sh

# Login
flyctl auth login

# Launch
flyctl launch

# Set secret
flyctl secrets set GITHUB_TOKEN=ghp_your_token

# Deploy
flyctl deploy

# Check status
flyctl status

部署到Heroku

# Create Procfile
echo "web: python github_server.py" > Procfile

# Create app
heroku create github-mcp-pro

# Set token
heroku config:set GITHUB_TOKEN=ghp_your_token

# Deploy
git push heroku main

# Check logs
heroku logs --tail

______________________________________________________________________

🔍 高级搜索查询

GitHub支持强大的搜索语法:

# Search by stars
"query": "web framework stars:>10000"

# Search by language
"query": "machine learning language:python"

# Search by topic
"query": "topic:artificial-intelligence"

# Search by license
"query": "license:mit"

# Search in organization
"query": "org:google android"

# Search by size
"query": "size:>1000 language:go"

# Search by fork count
"query": "forks:>500 language:rust"

# Search by pushed date
"query": "pushed:>2024-01-01"

# Combined
"query": "neural network language:python stars:>1000 topic:deep-learning"

______________________________________________________________________

📊 费率限制管理

检查你的极限

# Use the tool
get_rate_limit()

# Returns:
{
  "core": {
    "limit": 5000,
    "remaining": 4850,
    "reset": "2024-12-15T10:30:00"
  },
  "search": {
    "limit": 30,
    "remaining": 28,
    "reset": "2024-12-15T09:45:00"
  }
}

最佳实践

  1. 使用认证 -5000次对60次请求/小时
  2. 缓存结果 -内置5分钟缓存
  3. 批量请求 -每次通话使用更高的限额
  4. 监控使用情况 -定期检查费率限制
  5. 处理错误 -优雅的退化

速率限制标头

服务器自动处理:

  • X-RateLimit-Limit -总限额
  • X-RateLimit-Remaining -请求已离开
  • X-RateLimit-Reset -重置时间戳
  • Retry-After -等待几秒钟

______________________________________________________________________

🛡️ 安全最佳实践

许可证管理

# ✅ DO: Use environment variables
export GITHUB_TOKEN='ghp_...'

# ✅ DO: Use .env file (add to .gitignore)
echo "GITHUB_TOKEN=ghp_..." > .env
echo ".env" >> .gitignore

# ❌ DON'T: Hardcode in files
GITHUB_TOKEN = "ghp_..."  # NEVER DO THIS!

# ❌ DON'T: Commit to git
git add .env  # NEVER DO THIS!

令牌范围

最低要求:

  • public_repo -访问公共存储库
  • read:user -读取用户资料

更多功能可选:

  • repo -访问私有存储库
  • read:org -读取组织数据
  • admin:repo_hook -管理webhooks

代币轮换

# Create new token
1. Visit https://github.com/settings/tokens
2. Generate new token
3. Update environment variable
4. Restart server
5. Revoke old token

______________________________________________________________________

🧪 测试

手动测试

# Test repository info
curl -X POST http://localhost:8001/mcp/v1/tools/get_repository_info \
  -H "Content-Type: application/json" \
  -d '{"owner": "facebook", "repo": "react"}'

# Test search
curl -X POST http://localhost:8001/mcp/v1/tools/search_repositories \
  -H "Content-Type: application/json" \
  -d '{"query": "fastapi", "limit": 5}'

# Test user profile
curl -X POST http://localhost:8001/mcp/v1/tools/get_user_profile \
  -H "Content-Type: application/json" \
  -d '{"username": "torvalds"}'

Python测试

import requests

# Test connection
response = requests.post(
    "http://localhost:8001/mcp/v1/tools/server_info",
    json={}
)
assert response.status_code == 200
print(response.json())

# Test repository
response = requests.post(
    "http://localhost:8001/mcp/v1/tools/get_repository_info",
    json={"owner": "python", "repo": "cpython"}
)
data = response.json()
assert "name" in data
print(f"Repository: {data['name']}")

______________________________________________________________________

📈 监控和记录

服务器日志

服务器提供详细的日志记录:

[2024-12-15 10:30:45] INFO - Server started on port 8001
[2024-12-15 10:31:12] INFO - Tool called: get_repository_info
[2024-12-15 10:31:13] INFO - GitHub API request: repos/facebook/react
[2024-12-15 10:31:14] INFO - Response cached for 300s
[2024-12-15 10:31:14] INFO - Tool execution completed: 1.2s

健康监测

# Check server health
curl http://localhost:8001/health

# Check rate limits
curl -X POST http://localhost:8001/mcp/v1/tools/get_rate_limit \
  -H "Content-Type: application/json" \
  -d '{}'

______________________________________________________________________

🐛 故障排除

常见问题

“超出费率限制”

# Solution: Add GitHub token
export GITHUB_TOKEN='ghp_your_token'

“未找到存储库”

# Check: Owner and repo spelling
# Check: Repository is public (or token has access)
# Check: Repository hasn't been deleted/renamed

“连接被拒绝”

# Check: Server is running
python github_server.py

# Check: Port 8001 is available
lsof -i :8001  # Linux/Mac
netstat -ano | findstr :8001  # Windows

“无效令牌”

# Solution: Regenerate token with correct scopes
# Required: public_repo, read:user

“超时错误”

# Check: Internet connection
# Check: GitHub status: https://www.githubstatus.com/
# Increase: Timeout in code (REQUEST_TIMEOUT)

调试模式

# Add to github_server.py for debugging
import logging
logging.basicConfig(level=logging.DEBUG)

______________________________________________________________________

🎓 高级用法

自定义工具实现

添加您自己的工具 github_server.py:

@mcp.tool()
@safe_json_response
def your_custom_tool(param: str) -> dict:
    """
    Your custom GitHub tool.
    
    Args:
        param: Parameter description
    
    Returns:
        Custom data
    """
    data = gh_client.request(f"your/endpoint/{param}")
    return {
        "result": data
    }

批处理

# Process multiple repos
repos = [
    ("facebook", "react"),
    ("microsoft", "vscode"),
    ("google", "flutter")
]

for owner, repo in repos:
    info = get_repository_info(owner, repo)
    print(f"{owner}/{repo}: {info['statistics']['stars']} stars")

缓存策略

服务器包括内置缓存(5分钟)。定制:

from functools import lru_cache

@lru_cache(maxsize=128)
def cached_request(endpoint: str):
    return gh_client.request(endpoint)

______________________________________________________________________

📋 需求

  • python 3.10或更高
  • 依赖关系:

- fastmcp>=2.14.0 - httpx>=0.24.0 - python-dotenv>=1.0.0

______________________________________________________________________

🤝 贡献

欢迎投稿!方法如下:

  1. 分叉 存储库
  2. 创建 特征分支
  3. 添加 您的改进
  4. 测试 彻底地
  5. 提交 pull请求

贡献的想法

  • 添加更多GitHub功能
  • 实现GraphQL API支持
  • 添加webhook处理程序
  • 创建可视化工具
  • 添加分析仪表板
  • 改进缓存策略
  • 添加更多搜索筛选器
  • 增强错误消息
  • 添加速率限制预测
  • 创建CLI界面

______________________________________________________________________

📄 许可证

MIT许可证-有关详细信息,请参阅许可证文件

______________________________________________________________________

🙏 学分

  • GitHub API -数据提供者
  • FastMCP -MCP框架
  • Anthropic -Claude和MCP规范
  • httpx -HTTP客户端
  • 贡献者 非常感谢。

______________________________________________________________________

📞 支持

  • 文档: 此自述文件
  • 问题:
  • 讨论:
  • API文件:

______________________________________________________________________

⭐ 明星历史

如果这个项目对你有帮助,请考虑给它一个⭐!

______________________________________________________________________

目录标签

目录标签

PythonClaude代码搜索GitHub分析本地部署仓库统计用户活动开发工具

支持客户端

Claude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

token

工具数量(toolCount,工具数)

33

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdiotoken部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP