Skip to main content
Glama
prabhattripathi9351

leetcode-github-assistant

🤖 LeetCode GitHub MCP Assistant

個人のLeetCode解答リポジトリを、Claude Desktop内で直接クエリ可能なAIツールに変えます。

GitHub Repo → Metadata Index → MCP Server → Claude Desktop (自然言語クエリ)

Python 3.x | MCP SDK | GitHub REST API | LeetCode GraphQL API | MIT License


🧠 これは何か?

このプロジェクトは、解決済みのLeetCode問題を保存した個人のGitHubリポジトリを、Model Context Protocol (MCP) を使ってClaude Desktopに直接接続します。GitHubを手動で閲覧して「解いたすべての配列問題」を探したり、特定の解答ファイルを探し回ったりする代わりに、Claude Desktopに平易な言葉で質問するだけで、リポジトリから取得したライブデータを使って回答してくれます。

手動でファイルを探す代わりに、会話を通じてDSA/LeetCodeの練習を検索・復習できるようにするための個人用生産性ツールとして構築されました。

以下の情報を表示します:

  • トピック(array、dynamic-programming、graphなど)ごとにタグ付けされた、解いたすべての問題

  • 各問題の難易度(easy/medium/hard)。LeetCode自体から取得

  • 完全な解答コード。必要に応じてGitHubからライブで取得


Related MCP server: Company Docs MCP Server

✨ 機能

機能

説明

🔍 トピックベースの検索

任意のトピック(例:「array」「dynamic-programming」)を指定すると、一致するすべての解決済み問題とその難易度を取得

📄 ライブコード取得

問題名またはスラッグで任意の問題の完全な解答コードをGitHubから直接取得

🏷️ 自動タグ付け

難易度とトピックのタグはLeetCode独自のGraphQL APIから自動取得 — 手動タグ付けは不要

高速並列インデックス

マルチスレッドを使用して、すべての問題のメタデータを1件ずつではなく並行して取得

🔌 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"
└─────────────────────────┘

Architecture Diagram

MCP Explained

🛠️ 技術スタック

カテゴリ

技術

言語

Python 3.x

MCPサーバー

mcp SDK (mcp.server.Server、stdioトランスポート)

データソース

GitHub REST API、LeetCode GraphQL API

並行処理

concurrent.futures.ThreadPoolExecutor

HTTPクライアント

requests

クライアント

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ツール)

ツール

入力

説明

search_by_topic

topic: string (例:"array")

そのトピックでタグ付けされたすべての解決済み問題を難易度付きで返す

get_solution_code

problem_name: string (例:"0877-stone-game.py" または "stone-game")

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.txt

2. リポジトリ名を設定

build_index_github.py を開いて設定:

GITHUB_REPO = "your-username/your-leetcode-repo"

3. インデックスを構築

python build_index_github.py

これにより、すべての問題の難易度とトピックタグを含む index.json が作成されます。

4. Claude Desktopに接続

Claude Desktopを開く → Settings → Developer → Edit Config を選択し、以下を追加:

{
  "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を再起動

完全に終了(ウィンドウを閉じるだけでなく、タスクマネージャーで「タスクの終了」)してから再度開きます。Settings → Developer を確認 — サーバーのステータスが running と表示されるはずです。

6. 質問する

"array topic ke problems batao"
"show me the code for two-sum"

🗺️ ロードマップのアイデア

  • 難易度ベースのフィルタリングツールを追加(例:「難しい問題をすべて表示」)

  • 練習用の「ランダム問題提案」ツールを追加

  • リポジトリに新しいコミットがプッシュされたときにインデックスを自動同期(webhookまたはスケジュール再構築)

  • GitHub個人アクセストークンによるプライベートリポジトリのサポート

  • LeetCode GraphQL呼び出しにリトライ/キャッシュロジックを追加してインデックス時間を短縮


🤝 コントリビューション

これは個人の学習プロジェクトですが、Issueや提案は歓迎します — PRやIssueを自由に開いてください。


個人のLeetCode練習を会話型にするために構築されました — GitHubフォルダを掘り返す代わりに、ただ質問してください。

F
license - not found
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

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

View all related MCP servers

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.

View all MCP Connectors

Latest Blog Posts

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