leetcode-github-assistant

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.

Category
Visit Server

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"
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Architecture Diagram

MCP Explained

πŸ› οΈ 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 use python.exe's full path if python isn'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

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.

Official
Featured
TypeScript
Audiense Insights MCP Server

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.

Official
Featured
Local
TypeScript
Magic Component Platform (MCP)

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.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

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.

Official
Featured
TypeScript
Kagi MCP Server

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.

Official
Featured
Python
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

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.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured