leetcode-github-assistant
{"type": "text", "text": "🤖 LeetCode GitHub MCP 助手
将你的个人 LeetCode 题解仓库变成一个可查询的 AI 工具——就在 Claude Desktop 中。
GitHub 仓库 → 元数据索引 → MCP 服务器 → Claude Desktop(自然语言查询)
Python 3.x | MCP SDK | GitHub REST API | LeetCode GraphQL API | MIT 许可证
🧠 这是什么?
该项目使用**模型上下文协议(MCP)**将个人 GitHub 仓库中已解决的 LeetCode 题目直接连接到 Claude Desktop。无需手动浏览 GitHub 来查找“我解决过的所有数组问题”或寻找某个特定的解决方案文件,你只需用自然语言向 Claude Desktop 提问——它就会使用直接来自你仓库的实时数据进行回答。
作为个人生产力工具而构建,通过对话使 DSA/LeetCode 练习变得可搜索和可回顾,而不是手动翻找文件。
它提供:
每个已解决问题的主题标签(array、dynamic-programming、graph 等)
每个问题的难度(简单/中等/困难),直接从 LeetCode 获取
完整的解决方案代码,按需从 GitHub 实时获取
Related MCP server: Company Docs MCP Server
✨ 功能特性
功能 | 描述 |
🔍 基于主题的搜索 | 询问任何主题(例如“array”、“dynamic-programming”),即可获得所有匹配的已解决问题及其难度 |
📄 实时代码检索 | 按名称或 slug 直接从 GitHub 获取任何问题的完整解决方案代码 |
🏷️ 自动打标签 | 难度和主题标签自动从 LeetCode 自己的 GraphQL API 获取——无需手动打标签 |
⚡ 快速并行索引 | 使用多线程并发获取每个问题的元数据,而不是逐个获取 |
🔌 原生 Claude Desktop 集成 | 作为本地 MCP 服务器运行——无需切换浏览器标签页,无需复制粘贴链接 |
🏗️ 架构与流水线
┌─────────────────────────┐
│ 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"
└─────────────────────────┘
🛠️ 技术栈
类别 | 技术 |
语言 | Python 3.x |
MCP 服务器 |
|
数据源 | GitHub REST API、LeetCode GraphQL API |
并发 |
|
HTTP 客户端 |
|
客户端 | Claude Desktop(本地 MCP 服务器配置) |
📁 项目结构
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🔌 工具参考(MCP 工具)
工具 | 输入 | 描述 |
|
| 返回所有标记了该主题的已解决问题及其难度 |
|
| 从 GitHub 实时获取并返回完整的解决方案代码 |
🚀 快速开始
前提条件
Python 3.10+
一个包含你已解决 LeetCode 题目的 GitHub 仓库(公开,或为私有仓库添加令牌)
已安装 Claude Desktop
1. 克隆并安装依赖
git clone https://github.com/<your-username>/<this-repo>.git
cd <this-repo>
pip install -r requirements.txt2. 配置你的仓库名称
打开 build_index_github.py 并设置:
GITHUB_REPO = "your-username/your-leetcode-repo"3. 构建索引
python build_index_github.py这将创建包含每个问题难度和主题标签的 index.json。
4. 连接到 Claude Desktop
打开 Claude Desktop → 设置 → 开发者 → 编辑配置,然后添加:
{
"mcpServers": {
"leetcode-github-assistant": {
"command": "python",
"args": ["/absolute/path/to/mcp_server.py"]
}
}
}💡 在 Windows 上,请在路径中使用双反斜杠(例如
\"D:\\\\Leetcode_mcp_server\\\\mcp_server.py\"),如果python不在系统 PATH 中,请使用python.exe的完整路径。
5. 重启 Claude Desktop
完全退出(在任务管理器中结束任务,而不仅仅是关闭窗口)并重新打开。检查 设置 → 开发者——服务器应显示状态为 running。
6. 开始提问
"array topic ke problems batao"
"show me the code for two-sum"🗺️ 路线图构想
添加基于难度的筛选工具(例如“显示所有困难问题”)
添加“随机题目推荐”工具用于练习
每当有新提交推送到仓库时自动同步索引(webhook 或定时重建)
通过 GitHub 个人访问令牌支持私有仓库
为 LeetCode GraphQL 调用添加重试/缓存逻辑以减少索引时间
🤝 贡献
这是一个个人学习项目,但欢迎提出问题和建议——随时可以提交 PR 或 issue。
旨在让个人 LeetCode 练习变得对话化——与其翻遍 GitHub 文件夹,不如直接提问。"}
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 Servers
- AlicenseAqualityAmaintenanceEnables interactive LeetCode practice with AI-guided authentication, problem solving, solution submission, and learning mode.2417311MIT
- FlicenseNot gradedqualityDmaintenanceProvides read-only access to company GitHub repositories, enabling code search, file retrieval, documentation search, and repo browsing via natural language.
- FlicenseNot gradedqualityDmaintenanceEnables natural-language queries about public GitHub repositories, including issues, pull requests, repo metadata, and READMEs, via the GitHub API.
- FlicenseNot gradedqualityDmaintenanceEnables natural language queries to search GitHub for trending repositories by topic, summarize project READMEs, and compare multiple repos to uncover ecosystem patterns.2
Related MCP Connectors
Search Luogu problems, fetch statements, explore problem sets and get practice recommendations.
Connect AI assistants to your GitHub-hosted Obsidian vault to seamlessly access, search, and analy…
Code intelligence for coding agents: semantic, AST, graph, and full-text search. 279+ languages.
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/prabhattripathi9351/leetcode-mcp-assistant'
If you have feedback or need assistance with the MCP directory API, please join our Discord server
