๐ DevAssist MCP Server
A production-ready Python MCP Server for GitHub & Competitive Programming
๐ Overview
DevAssist MCP is a Model Context Protocol (MCP) server that bridges the gap between AI assistants and developer resources. It exposes two powerful tools โ GitHub Assistant and Competitive Programming Assistant โ that any MCP-compatible AI agent (Claude Desktop, Cursor, VS Code Copilot) can use to fetch real-time data.
โจ Key Features
| Feature | Description |
|---|---|
| ๐ GitHub Integration | User profiles, repo info, commits, PRs, issues, statistics |
| ๐ Codeforces Integration | Profiles, contest history, rating tracking, submissions |
| ๐ง Weak Topic Analysis | AI-powered identification of competitive programming weak areas |
| ๐ก Smart Recommendations | Personalized problem suggestions based on skill gaps |
| โก Async Architecture | Non-blocking I/O with httpx for maximum performance |
| ๐ Production Ready | Logging, error handling, type safety, comprehensive tests |
๐๏ธ Architecture
graph TD
A["๐ค AI Agent<br/>(Claude / Cursor / VS Code)"] -->|MCP Protocol| B["โ๏ธ DevAssist MCP 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
๐ Prerequisites
- Python 3.12+
- GitHub Personal Access Token (Generate here) โ for higher API rate limits
- pip or uv package manager
๐ป Installation
Option 1: Using uv (Recommended)
# Clone the repository
git clone https://github.com/your-username/devassist-mcp.git
cd devassist-mcp
# Create virtual environment and install dependencies
uv venv
uv pip install -r requirements.txt
Option 2: Using pip
# Clone the repository
git clone https://github.com/your-username/devassist-mcp.git
cd devassist-mcp
# 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
โ๏ธ Configuration
Copy the environment template:
cp .env.example .envEdit
.envwith your settings:GITHUB_TOKEN=ghp_your_personal_access_token_here LOG_LEVEL=INFO
Note: The GitHub token is optional but recommended. Without it, you're limited to 60 API requests/hour. With a token, you get 5,000 requests/hour.
๐ Usage
Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"devassist-mcp": {
"command": "python",
"args": ["C:/path/to/devassist-mcp/server.py"],
"env": {
"GITHUB_TOKEN": "ghp_your_token_here"
}
}
}
}
Cursor
Add to your Cursor MCP settings (.cursor/mcp.json):
{
"mcpServers": {
"devassist-mcp": {
"command": "python",
"args": ["C:/path/to/devassist-mcp/server.py"],
"env": {
"GITHUB_TOKEN": "ghp_your_token_here"
}
}
}
}
VS Code (with Copilot)
Add to your VS Code settings:
{
"mcp": {
"servers": {
"devassist-mcp": {
"command": "python",
"args": ["C:/path/to/devassist-mcp/server.py"],
"env": {
"GITHUB_TOKEN": "ghp_your_token_here"
}
}
}
}
}
Running Standalone
python server.py
๐ ๏ธ Tool Documentation
Tool 1: github_assistant
| Action | Description | Requires repository |
|---|---|---|
get_user_profile |
Get GitHub user profile | โ |
get_user_repos |
List all public repositories owned by a user | โ |
get_user_activity |
Get recent user activity (commits, PRs, stars) | โ |
get_repo_info |
Get repository details | โ |
get_latest_commits |
Get recent commits | โ |
get_repo_stats |
Get repository statistics | โ |
get_repo_languages |
Detailed programming language percentage breakdown | โ |
get_repo_contributors |
Top code contributors to a repository | โ |
get_latest_release |
Latest release version & release notes | โ |
get_pull_requests |
Get pull requests | โ |
get_issues |
Get repository issues | โ |
Example โ Get User Profile:
"Show me the GitHub profile of octocat"
{
"login": "octocat",
"name": "The Octocat",
"public_repos": 42,
"followers": 20000,
"location": "San Francisco"
}
Example โ Get Repo Stats:
"What are the stats for octocat/Hello-World?"
{
"repository": "octocat/Hello-World",
"stars": 2500,
"forks": 450,
"language": "Python",
"open_issues": 12
}
Tool 2: cp_assistant
| Action | Description |
|---|---|
get_user_profile |
Get Codeforces rating and rank |
get_contest_history |
Past contest participation |
get_recent_submissions |
Recent problem submissions |
get_rating_history |
Rating changes over time |
analyze_weak_topics |
Identify weak problem areas |
recommend_problems |
Personalized problem suggestions |
Example โ Analyze Weak Topics:
"Analyze the weak topics for Codeforces user tourist"
[
{
"tag": "geometry",
"total_attempts": 15,
"successful": 5,
"failed": 10,
"success_rate": 33.3
}
]
Example โ Get Recommendations:
"Recommend practice problems for my Codeforces handle"
[
{
"name": "Theatre Square",
"rating": 1000,
"tags": ["math"],
"url": "https://codeforces.com/problemset/problem/1/A"
}
]
๐งช Testing
# 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
๐ Project Structure
devassist-mcp/
โโโ server.py # MCP server entry point
โโโ 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 # This file
โโโ 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)
๐ณ Deployment
Docker
# Build the image
docker build -t devassist-mcp .
# Run the container
docker run -e GITHUB_TOKEN=ghp_your_token devassist-mcp
Railway
- Connect your GitHub repository
- Set environment variable:
GITHUB_TOKEN - Deploy โ Railway auto-detects the Dockerfile
Render
- Create a new Background Worker
- Connect your repository
- Set build command:
pip install -r requirements.txt - Set start command:
python server.py - Add environment variable:
GITHUB_TOKEN
๐ฎ Future Enhancements
- ๐ก LeetCode integration
- ๐ CodeChef integration
- ๐ต Response caching with TTL
- ๐ข Request history tracking
- ๐ฃ WebSocket support for live updates
- โช Multi-language support
๐ค Contributing
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open a Pull Request
Code Quality
# Format code
black .
# Lint
ruff check .
# Type check
mypy .
๐ License
This project is licensed under the MIT License. See LICENSE for details.
Built with โค๏ธ using Python, FastMCP, and httpx