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.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
E2B
Using MCP to run code via e2b.
