Skip to main content
Glama

🚀 DevAssist MCP Server

一个面向 GitHub 与竞技编程的生产级 Python MCP 服务器

Python MCP Render License Docker


🌐 实时云部署:DevAssist MCP Server 已部署并在 Render.com 上实时运行!

  • 基础 URL 与健康检查: https://devassist-mcp-server.onrender.com/

  • SSE 端点: https://devassist-mcp-server.onrender.com/sse

你可以将 Claude Desktop、Cursor 或 VS Code 客户端直接连接到托管的 Render 服务器,无需在本地运行代码;也可以选择在自己的机器上本地运行。


📖 概述与项目描述

DevAssist MCP Server 是一个生产级、异步的 模型上下文协议(MCP)服务器,旨在将 AI 助手——如 Claude Desktop、Cursor 和 VS Code Copilot——与实时开发者工作流、GitHub 仓库智能和竞技编程分析连接起来。

🎯 目的与核心能力

现代 AI 编程代理通常缺乏对外部开发者平台和竞技编程指标的直接访问。DevAssist MCP 通过标准 MCP 协议接口(STDIO 和 Server-Sent Events / SSE)提供两个专用工具来解决这一问题:

  1. 🐙 github_assistant:提供全面的 GitHub 集成,包括用户资料查询、仓库元数据、提交历史、代码语言构成明细、活跃的拉取请求、Issue 跟踪、贡献者指标以及发布说明。

  2. 🏆 cp_assistant:与 Codeforces 集成,用于获取用户比赛评分、提交表现历史、基于主题的准确率跟踪、算法薄弱点识别,以及基于评分等级和薄弱标签的个性化练习题目推荐。

无论是本地部署,还是通过其位于 Render.com 的实时云端点(https://devassist-mcp-server.onrender.com/sse)访问,DevAssist MCP 都能让 LLM 动态地基于实时开发者数据进行推理。

✨ 主要特性

功能

描述

🌐 云部署

在 Render.com 上实时托管,支持完整的 Server-Sent Events(SSE)

🐙 GitHub 集成

用户资料、仓库信息、提交、PR、Issue、统计信息

🏆 Codeforces 集成

用户资料、比赛历史、评分跟踪、提交记录

🧠 薄弱主题分析

通过 AI 识别竞技编程的薄弱领域

💡 智能推荐

根据技能差距提供个性化题目推荐

⚡ 异步架构

使用 httpx 进行非阻塞 I/O,以获得最佳性能

🔒 生产就绪

日志记录、错误处理、类型安全、全面测试

Related MCP server: GitBridge

🏗️ 架构

graph TD
    A["🤖 AI Agent<br/>(Claude / Cursor / VS Code)"] -->|MCP Protocol / SSE| B["🌐 Live Render MCP Server / Local Server"]
    B --> C["🐙 github_assistant"]
    B --> D["🏆 cp_assistant"]
    C --> E["GitHub Service Layer"]
    D --> F["Codeforces Service Layer"]
    E -->|httpx async| G["GitHub REST API v3"]
    F -->|httpx async| H["Codeforces API"]
    
    style A fill:#4A90D9,stroke:#2C5F99,color:#fff
    style B fill:#6C3483,stroke:#4A235A,color:#fff
    style C fill:#27AE60,stroke:#1E8449,color:#fff
    style D fill:#E67E22,stroke:#CA6F1E,color:#fff

🔌 连接到 Claude Desktop (claude_desktop_config.json)

要使用这个 MCP 服务器,请在 Claude Desktop 中打开或创建你的 `claude_desktop_config.json`` 文件。

📍 文件位置:

  • Windows: %APPDATA%\Claude\claude_desktop_config.json (例如:C:\Users\<username>\AppData\Roaming\Clade\claude_desktop_config.json)

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

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


选项 A:使用 Render 实时部署(推荐)

使用 mcp-remote 桥接器直接连接到 Render.com 上托管的服务器:

{
  "mcpServers": {
    "devassist-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://devassist-mcp-server.onrender.com/sse"
      ]
    }
  }
}

或者,如果你的 Claude Desktop 版本支持原生 SSE 配置:

{
  "mcpServers": {
    "devassist-mcp": {
      "url": "https://devassist-mcp-server.onrender.com/sse"
    }
  }
}

选项 B:在本地机器上运行

如果你更倾向于在自己的机器上本地运行 MCP 服务器:

{
  "mcpServers": {
    "devassist-mcp": {
      "command": "python",
      "args": ["C:/path/to/devassist-mcp/server.py"],
      "env": {
        "GITHUB_TOKEN": "ghp_your_token_here"
      }
    }
  }
}

注意: 请将 C:/path/to/devassist-mcp/server.py 替换为你机器上 server.py 的绝对路径。


💻 其他 IDE 配置

Cursor

添加到你的 Cursor MCP 设置(.cursor/mcp.json)中:

使用 Render 云端点:

{
  "mcpServers": {
    "devassist-mcp": {
      "url": "https://devassist-mcp-server.onrender.com/sse"
    }
  }
}

使用本地 Python 脚本:

{
  "mcpServers": {
    "devassist-mcp": {
      "command": "python",
      "args": ["C:/path/to/devassist-mcp/server.py"],
      "env": {
        "GITHUB_TOKEN": "ghp_your_token_here"
      }
    }
  }
}

VS Code(搭配 Copilot)

添加到你的 VS Code 设置中:

{
  "mcp": {
    "servers": {
      "devassist-mcp": {
        "command": "npx",
        "args": [
          "-y",
          "mcp-remote",
          "https://devassist-mcp-server.onrender.com/sse"
        ]
      }
    }
  }
}

📋 前置要求与本地设置

前置要求

  • Python 3.12+

  • GitHub 个人访问令牌(在此生成)— 用于获得更高的速率限制

  • pip 或 uv 包管理器

选项 1:使用 uv(推荐)

# Clone the repository
git clone https://github.com/Champion-2006/DevAssist-MCP-Server.git
cd DevAssist-MCP-Server

# Create virtual environment and install dependencies
uv venv
uv pip install -r requirements.txt

选项 2:使用 pip

# Clone the repository
git clone https://github.com/Champion-2006/DevAssist-MCP-Server.git
cd DevAssist-MCP-Server

# Create virtual environment
python -m venv venv

# Activate virtual environment
# Windows:
venv\Scripts\activate
# macOS/Linux:
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

⚙️ 本地配置

  1. 复制环境模板:

cp .env.example .env
  1. 使用你的设置编辑 .env:

GITHUB_TOKEN=ghp_your_personal_access_token_here
LOG_LEVEL=INFO
TRANSPORT=stdio
PORT=8000

注意: GitHub 令牌是可选的,但推荐配置。没有令牌时,请求限制为每小时 60 次 API 调用;使用令牌后,限制提升为每小时 5,000 次请求。


🚀 本地独立运行

STDIO 模式(默认)

python server.py

SSE 传输模式

python server.py --sse
# or
TRANSPORT=sse PORT=8000 python server.py

🛠️ 工具文档

工具 1:github_assistant

操作

描述

需要 repository

get_user_profile

获取 GitHub 用户资料

❌

get_user_repos

列出用户拥有的所有公开仓库

❌

get_user_activity

获取最近的用户动态(提交、PR、星标)

❌

get_repo_info

获取仓库详情

✅

get_latest_commits

获取最近的提交

✅

get_repo_stats

获取仓库统计信息

✅

get_repo_languages

详细的编程语言百分比构成

✅

get_repo_contributors

仓库的主要代码贡献者

✅

get_latest_release

最新发布版本与发布说明

✅

get_pull_requests

获取拉取请求

✅

get_issues

获取仓库的 Issue

✅

示例 — 获取用户资料:

"Show me the GitHub profile of octocat"
{
  "login": "octocat",
  "name": "The Octocat",
  "public_repos": 42,
  "followers": 20000,
  "location": "San Francisco"
}

示例 — 获取仓库统计信息:

"What are the stats for octocat/Hello-World?"
{
  "repository": "octocat/Hello-World",
  "stars": 2500,
  "forks": 450,
  "language": "Python",
  "open_issues": 12
}

工具 2:cp_assistant

操作

描述

get_user_profile

获取 Codeforces 评分与排名

get_contest_history

过往比赛参与情况

get_recent_submissions

最近的题目提交记录

get_rating_history

评分随时间的变化

analyze_weak_topics

识别薄弱题目领域

recommend_problems

个性化题目推荐

示例 — 分析薄弱主题:

"Analyze the weak topics for Codeforces user tourist"
[
  {
    "tag": "geometry",
    "total_attempts": 15,
    "successful": 5,
    "failed": 10,
    "success_rate": 33.3
  }
]

示例 — 获取推荐:

"Recommend practice problems for my Codeforces handle"
[
  {
    "name": "Theatre Square",
    "rating": 1000,
    "tags": ["math"],
    "url": "https://codeforces.com/problemset/problem/1/A"
  }
]

🧪 测试

# Run all tests
pytest tests/ -v

# Run with coverage
pytest tests/ -v --cov=. --cov-report=term-missing

# Run specific test file
pytest tests/test_github_service.py -v

# Run specific test
pytest tests/test_codeforces_service.py::test_analyze_weak_topics -v

📁 项目结构

devassist-mcp/
├── server.py                          # MCP server entry point (STDIO & SSE)
├── config.py                          # Pydantic settings
├── .env.example                       # Environment template
├── requirements.txt                   # Dependencies
├── pyproject.toml                     # Project metadata & tool configs
├── Dockerfile                         # Multi-stage Docker build
├── .dockerignore                      # Docker build exclusions
├── .gitignore                         # Git exclusions
├── README.md                          # Comprehensive documentation
├── tools/
│   ├── github.py                      # GitHub MCP tool
│   └── cp.py                          # Codeforces MCP tool
├── services/
│   ├── github_service.py              # GitHub API client
│   └── codeforces_service.py          # Codeforces API client
├── models/
│   ├── github_models.py               # GitHub Pydantic models
│   └── cp_models.py                   # Codeforces Pydantic models
├── utils/
│   ├── logger.py                      # Structured logging
│   └── exceptions.py                  # Custom exception hierarchy
├── tests/
│   ├── conftest.py                    # Shared test fixtures
│   ├── test_github_service.py         # GitHub service tests
│   ├── test_codeforces_service.py     # Codeforces service tests
│   ├── test_github_tool.py            # GitHub tool tests
│   └── test_cp_tool.py               # Codeforces tool tests
└── logs/                              # Log files (auto-created)

🐳 部署指南

Render 部署(实时生产)

本项目已作为 Web Service 在 Render.com 上实时部署,并以 SSE 传输模式运行:

  1. 服务类型: Web Service

  2. 构建命令: pip install -r requirements.txt

  3. 启动命令: python server.py --sse

  4. 环境变量:

    • TRANSPORT: sse

    • PORT: 10000(或 Render 默认值)

    • GITHUB_TOKEN: ghp_your_github_token

  5. 实时 URL: https://devassist-mcp-server.onrender.com


🤝 参与贡献

  1. Fork 该仓库

  2. 创建功能分支:git checkout -b feature/amazing-feature

  3. 提交更改:git commit -m 'Add amazing feature'

  4. 推送到分支:git push origin feature/amazing-feature

  5. 开启一个 Pull Request

代码质量

# Format code
black .

# Lint
ruff check .

# Type check
mypy .

使用 Python、FastMCP 和 httpx 以 ❤️ 构建

Related MCP Connectors

Related MCP Servers