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: LeetCode 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"
└─────────────────────────┘
🛠️ 技術スタック
カテゴリ | 技術 |
言語 | 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を開く → 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フォルダを掘り返す代わりに、ただ質問してください。
This server cannot be deployed
Maintenance
Related MCP Connectors
Ask any GitHub repository a question. Get source-backed answers.
Code intelligence for LLMs. Analyze, search, and retrieve code from any public git repository.
A cited wiki of your GitHub repo: search, read pages, find symbols and ask, with line citations.
Search Luogu problems, fetch statements, explore problem sets and get practice recommendations.
Related MCP Servers
- AlicenseAqualityAmaintenanceEnables interactive LeetCode practice with AI-guided authentication, problem solving, solution submission, and learning mode.2447 npm12MIT
- FlicenseNot gradedqualityDmaintenanceEnables Claude to search and retrieve LeetCode problems, user profiles, and statistics through natural language.-
- AlicenseAqualityCmaintenanceEnables integration with LeetCode APIs to retrieve problems, contests, solutions, and user data, support daily challenges and advanced searches, and perform authenticated actions such as running or submitting code and managing notes.997 npmMIT
- FlicenseNot gradedqualityAmaintenanceEnables automated access to LeetCode problems, solutions, contests, and public or authenticated user data across leetcode.com and leetcode.cn, including problem search, profile and submission retrieval, code execution, and note management.-
