leetcode-github-assistant
Enables querying a personal GitHub repository of solved LeetCode problems via natural language, including topic-based search and live retrieval of solution code with difficulty and tags.
README
🤖 LeetCode GitHub MCP Assistant
Turn your personal LeetCode solutions repo into a queryable AI tool — right inside Claude Desktop.
GitHub Repo → Metadata Index → MCP Server → Claude Desktop (natural language queries)
Python 3.x | MCP SDK | GitHub REST API | LeetCode GraphQL API | MIT License
🧠 What is this?
This project connects a personal GitHub repository of solved LeetCode problems directly to Claude Desktop using the Model Context Protocol (MCP). Instead of manually browsing GitHub to find "all array problems I've solved" or hunting for one specific solution file, you can just ask Claude Desktop in plain language — and it answers using live data pulled straight from your repo.
Built as a personal productivity tool to make DSA/LeetCode practice searchable and reviewable through conversation, instead of manual file digging.
It surfaces:
- Every solved problem tagged by topic (array, dynamic-programming, graph, etc.)
- Each problem's difficulty (easy/medium/hard), pulled from LeetCode itself
- The full solution code, fetched live from GitHub on demand
✨ Features
| Capability | Description |
|---|---|
| 🔍 Topic-based search | Ask for any topic (e.g. "array", "dynamic-programming") and get every matching solved problem with its difficulty |
| 📄 Live code retrieval | Fetch the complete solution code for any problem by name or slug, straight from GitHub |
| 🏷️ Auto-tagging | Difficulty and topic tags are pulled automatically from LeetCode's own GraphQL API — no manual tagging needed |
| ⚡ Fast parallel indexing | Uses multithreading to fetch metadata for every problem concurrently instead of one-by-one |
| 🔌 Native Claude Desktop integration | Runs as a local MCP server — no browser tab switching, no copy-pasting links |
🏗️ Architecture & Pipeline
┌─────────────────────────┐
│ GitHub Repo │ → your solved LeetCode .py/.cpp/.java files
│ Daily_leet_code │
└────────────┬─────────────┘
│ GitHub REST API (recursive file listing)
▼
┌─────────────────────────┐
│ build_index_github.py │ → extracts slug from filename
│ (Indexer) │ → queries LeetCode GraphQL for
└────────────┬─────────────┘ difficulty + topic tags (parallel)
│ writes
▼
┌─────────────────────────┐
│ index.json │ → local structured metadata store
└────────────┬─────────────┘
│ loaded at startup
▼
┌─────────────────────────┐
│ mcp_server.py │ → exposes 2 tools over stdio:
│ (MCP Server) │ search_by_topic, get_solution_code
└────────────┬─────────────┘
│ MCP / JSON-RPC over stdio
▼
┌─────────────────────────┐
│ Claude Desktop │ → "array topic ke problems batao"
│ (spawns server locally) │ → "0877-stone-game ka code dikhao"
└─────────────────────────┘

🛠️ Tech Stack
| Category | Technology |
|---|---|
| Language | Python 3.x |
| MCP Server | mcp SDK (mcp.server.Server, stdio transport) |
| Data Source | GitHub REST API, LeetCode GraphQL API |
| Concurrency | concurrent.futures.ThreadPoolExecutor |
| HTTP Client | requests |
| Client | Claude Desktop (local MCP server config) |
📁 Project Structure
Leetcode_mcp_server/
├── build_index_github.py # Indexer: scans GitHub repo, builds index.json
├── mcp_server.py # MCP server: exposes search_by_topic & get_solution_code
├── index.json # Auto-generated metadata index (gitignored)
├── requirements.txt # Python dependencies
└── .gitignore
🔌 Tool Reference (MCP Tools)
| Tool | Input | Description |
|---|---|---|
search_by_topic |
topic: string (e.g. "array") |
Returns all solved problems tagged with that topic, with difficulty |
get_solution_code |
problem_name: string (e.g. "0877-stone-game.py" or "stone-game") |
Fetches and returns the full solution code live from GitHub |
🚀 Getting Started
Prerequisites
- Python 3.10+
- A GitHub repo of your own solved LeetCode problems (public, or add a token for private repos)
- Claude Desktop installed
1. Clone & install dependencies
git clone https://github.com/<your-username>/<this-repo>.git
cd <this-repo>
pip install -r requirements.txt
2. Configure your repo name
Open build_index_github.py and set:
GITHUB_REPO = "your-username/your-leetcode-repo"
3. Build the index
python build_index_github.py
This creates index.json with every problem's difficulty and topic tags.
4. Connect to Claude Desktop
Open Claude Desktop → Settings → Developer → Edit Config, and add:
{
"mcpServers": {
"leetcode-github-assistant": {
"command": "python",
"args": ["/absolute/path/to/mcp_server.py"]
}
}
}
💡 On Windows, use double backslashes in the path (e.g.
"D:\\Leetcode_mcp_server\\mcp_server.py"), and usepython.exe's full path ifpythonisn't on your system PATH.
5. Restart Claude Desktop
Fully quit (End Task in Task Manager, not just close the window) and reopen. Check Settings → Developer — the server should show status running.
6. Ask away
"array topic ke problems batao"
"show me the code for two-sum"
🗺️ Roadmap Ideas
- [ ] Add difficulty-based filtering tool (e.g. "show me all hard problems")
- [ ] Add a "random problem suggestion" tool for practice
- [ ] Auto-sync index whenever new commits are pushed to the repo (webhook or scheduled rebuild)
- [ ] Support private repos via GitHub personal access token
- [ ] Add retry/caching logic for LeetCode GraphQL calls to reduce indexing time
🤝 Contributing
This is a personal learning project, but issues and suggestions are welcome — feel free to open a PR or an issue.
Built to make personal LeetCode practice conversational — instead of digging through GitHub folders, just ask.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。
