LeetCode MCP Server
LeetCode MCP サーバー
LeetCode MCP サーバーは、LeetCode API とのシームレスな統合を提供するモデル コンテキスト プロトコル (MCP)サーバーであり、LeetCode のプログラミング問題、コンテスト、ソリューション、およびユーザー データとの高度な自動化とインテリジェントな対話を可能にします。
特徴
🌐マルチサイトサポート:leetcode.com(グローバル)とleetcode.cn(中国)の両方のプラットフォームをサポート
📊問題データの取得:詳細な問題の説明、制約、例、公式の論説、ユーザーが投稿した解決策を取得します。
👤ユーザーデータアクセス:ユーザープロフィール、提出履歴、コンテストパフォーマンスを取得します
🔒プライベートデータアクセス:ユーザーノートの作成とクエリ、問題解決の進捗状況の追跡、提出内容の分析(AC/WA分析)
🔍高度な検索機能: タグ、難易度、カテゴリ、キーワードで問題をフィルタリング
📅デイリーチャレンジアクセス:デイリーチャレンジ問題に簡単にアクセスできます
Related MCP server: mcp-server-leetcode
前提条件
Node.js ランタイム環境
(オプション) 認証された API アクセス用の LeetCode セッション Cookie
インストール
Smithery経由でインストール
Smithery経由で Claude Desktop 用の leetcode-mcp-server を自動的にインストールするには:
npx -y @smithery/cli install @jinzcdev/leetcode-mcp-server --client claude手動インストール
# Install from npm
npm install @jinzcdev/leetcode-mcp-server -g
# Or run with Global site configuration
npx -y @jinzcdev/leetcode-mcp-server --site global
# Run with authentication (for accessing private data)
npx -y @jinzcdev/leetcode-mcp-server --site global --session <YOUR_LEETCODE_SESSION_COOKIE>あるいは、リポジトリをクローンしてローカルで実行することもできます。
# Clone the repository
git clone https://github.com/jinzcdev/leetcode-mcp-server.git
# Navigate to the project directory
cd leetcode-mcp-server
# Build and run the server
npm run build && node build/index.js --site global使用法
Visual Studio Code 統合
ユーザー設定(JSON)ファイルに以下のJSON設定を追加します。Ctrl Ctrl/Cmd + Shift + Pを押してPreferences: Open User Settings (JSON)を検索し、アクセスしてください。
オプション1: 環境変数を使用する
{
"mcp": {
"servers": {
"leetcode": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@jinzcdev/leetcode-mcp-server"],
"env": {
"LEETCODE_SITE": "global",
"LEETCODE_SESSION": "<YOUR_LEETCODE_SESSION_COOKIE>"
}
}
}
}
}オプション2: コマンドライン引数の使用
{
"mcp": {
"servers": {
"leetcode": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@jinzcdev/leetcode-mcp-server",
"--site",
"global",
"--session",
"<YOUR_LEETCODE_SESSION_COOKIE>"
]
}
}
}
}LeetCode China サイトの場合は、 --siteパラメータをcnに変更します。
[!ヒント]
サーバーは次の環境変数をサポートしています。
LEETCODE_SITE: LeetCode APIエンドポイント('global'または'cn')
LEETCODE_SESSION: 認証された API アクセス用の LeetCode セッション Cookie優先度に関する注意: コマンドライン引数と環境変数の両方が指定されている場合、コマンドライン引数が環境変数よりも優先されます。例:
LEETCODE_SITE=cnが設定されているが、leetcode-mcp-server --site globalを実行すると、サーバーはglobalを使用します。
LEETCODE_SESSIONが存在するが、--session "new_cookie"を指定すると、コマンドラインセッション値が使用されます。
利用可能なツール
問題
道具 | グローバル | CN | 認証が必要です | 説明 |
毎日のチャレンジ | ✅ | ✅ | ❌ | 今日のLeetCodeデイリーチャレンジ問題を取得します |
問題を取得する | ✅ | ✅ | ❌ | 特定の LeetCode 問題の詳細を取得します |
検索の問題 | ✅ | ✅ | ❌ | 複数のフィルター条件でLeetCodeの問題を検索します |
ユーザー
道具 | グローバル | CN | 認証が必要です | 説明 |
ユーザープロファイルを取得する | ✅ | ✅ | ❌ | LeetCodeユーザーのプロフィール情報を取得します |
get_user_contest_ranking | ✅ | ✅ | ❌ | ユーザーのコンテストランキング統計を取得します |
最近のACサブミッションを取得する | ✅ | ✅ | ❌ | ユーザーの最近承認された提出物を取得します |
最近の投稿を取得する | ✅ | ❌ | ❌ | ユーザーの最近の投稿履歴を取得します |
get_user_status | ✅ | ✅ | ✅ | 現在のユーザーの現在のステータスを取得します |
問題報告を取得する | ✅ | ✅ | ✅ | 特定の問題に対する詳細な提出分析を提供します |
問題の進行状況を取得する | ✅ | ✅ | ✅ | 現在のユーザーの問題解決の進捗状況を取得します |
すべての提出物を取得する | ✅ | ✅ | ✅ | 現在のユーザーの送信履歴を取得します |
注記
道具 | グローバル | CN | 認証が必要です | 説明 |
検索ノート | ❌ | ✅ | ✅ | フィルタリングオプションを使用してユーザーノートを検索します |
メモを取得する | ❌ | ✅ | ✅ | 質問IDで特定の問題のメモを取得します |
ノートを作成 | ❌ | ✅ | ✅ | 特定の問題に対する新しいメモを作成します |
更新ノート | ❌ | ✅ | ✅ | 既存のメモを新しいコンテンツで更新します |
ソリューション
道具 | グローバル | CN | 認証が必要です | 説明 |
問題解決策のリスト | ✅ | ✅ | ❌ | 特定の問題に対するコミュニティソリューションのリストを取得します |
問題の解決策を取得する | ✅ | ✅ | ❌ | 特定のソリューションの完全なコンテンツを取得します |
ツールパラメータ
問題
get_daily_challenge - 今日の LeetCode デイリーチャレンジの問題を完全な詳細とともに取得します
パラメータは必要ありません
get_problem - 特定の LeetCode 問題の詳細を取得します
titleSlug: 問題のURLスラッグ/識別子(文字列、必須)
search_problems - 複数のフィルター条件に基づいて LeetCode の問題を検索します
category: 問題カテゴリフィルター (文字列、オプション、デフォルト: "all-code-essentials")tags: 問題をフィルタリングするためのトピックタグのリスト(文字列[]、オプション)difficulty: 問題の難易度フィルター (列挙型: "EASY", "MEDIUM", "HARD"、オプション)searchKeywords: 問題のタイトルと説明で検索するキーワード(文字列、オプション)limit: 返される問題の最大数(数値、オプション、デフォルト: 10)offset: スキップする問題の数(数値、オプション)
ユーザー
get_user_profile - LeetCodeユーザーのプロフィール情報を取得します
username: LeetCode ユーザー名 (文字列、必須)
get_user_contest_ranking - ユーザーのコンテストランキング情報を取得します
username: LeetCode ユーザー名 (文字列、必須)attended: ユーザーが参加したコンテストのみを含めるかどうか(ブール値、オプション、デフォルト: true)
get_recent_submissions - LeetCode Global におけるユーザーの最近の投稿を取得します
username: LeetCode ユーザー名 (文字列、必須)limit: 返される送信の最大数(数値、オプション、デフォルト: 10)
get_recent_ac_submissions - ユーザーの最近承認された提出物を取得します
username: LeetCode ユーザー名 (文字列、必須)limit: 返される送信の最大数(数値、オプション、デフォルト: 10)
get_user_status - 現在のユーザーのステータスを取得します
パラメータは必要ありません
get_problem_submission_report - 特定の提出に関する詳細情報を取得します
id: 数値の提出ID(数値、必須)
get_problem_progress - 現在のユーザーの問題解決の進捗状況を取得します
offset: スキップする質問の数(数値、オプション、デフォルト: 0)limit: 返される質問の最大数(数値、オプション、デフォルト: 100)questionStatus: 質問のステータスでフィルタリングします(列挙型: "ATTEMPTED"、"SOLVED"、オプション)difficulty: 難易度レベルでフィルタリングする(文字列[]、オプション)
get_all_submissions - ユーザーの投稿のページ区切りリストを取得します
limit: 返される送信の最大数(数値、デフォルト: 20)offset: スキップする送信数(数値、デフォルト: 0)questionSlug: オプションの問題識別子(文字列、オプション)lang: プログラミング言語フィルター(文字列、オプション、CNのみ)status: 送信ステータスフィルター (列挙型: "AC", "WA"、オプション、CN のみ)lastKey: 次のページを取得するためのページネーショントークン(文字列、オプション、CNのみ)
注記
search_notes - LeetCode China のユーザーノートを検索します
keyword: ノートをフィルタリングするための検索語(文字列、オプション)limit: 返されるノートの最大数(数値、オプション、デフォルト: 10)skip: スキップする音符の数(数値、オプション、デフォルト: 0)orderBy: 返されるメモの並べ替え順序 (列挙型: "ASCENDING"、"DESCENDING"、オプション、デフォルト: "DESCENDING")
get_note - 特定の LeetCode 問題に関するユーザーメモを取得します
questionId: LeetCode問題の質問ID(文字列、必須)limit: 返されるノートの最大数(数値、オプション、デフォルト: 10)skip: スキップする音符の数(数値、オプション、デフォルト: 0)
create_note - 特定の LeetCode 問題に対する新しいメモを作成します
questionId: LeetCode問題の質問ID(文字列、必須)content: ノートの内容。マークダウン形式をサポートします(文字列、必須)summary: メモの短い要約またはタイトル(文字列、オプション)
update_note - 既存のノートを新しいコンテンツまたは要約で更新します
noteId: 更新するノートのID(文字列、必須)content: ノートの新しいコンテンツ。マークダウン形式をサポートします(文字列、必須)summary: ノートの新しい短い要約またはタイトル(文字列、オプション)
ソリューション
list_problem_solutions - 特定の問題に対するコミュニティソリューションのリストを取得します
questionSlug: 問題のURLスラッグ/識別子(文字列、必須)limit: 返されるソリューションの最大数(数値、オプション、デフォルト: 10)skip: スキップするソリューションの数(数値、オプション)userInput: ソリューションをフィルタリングするための検索語句(文字列、オプション)tagSlugs: ソリューションをフィルタリングするためのタグ識別子の配列(文字列[]、オプション、デフォルト: [])orderBy: 返されるソリューションの並べ替え基準グローバル: 列挙型: "HOT"、"MOST_RECENT"、"MOST_VOTES"、オプション、デフォルト: "HOT"
CN: 列挙型: "DEFAULT"、"MOST_UPVOTE"、"HOT"、"NEWEST_TO_OLDEST"、"OLDEST_TO_NEWEST"、オプション、デフォルト: "DEFAULT"
get_problem_solution - 特定のソリューションの完全なコンテンツを取得します
topicId: ソリューションの一意のトピックID(文字列、必須、グローバルのみ)slug: ソリューションの一意のスラッグ/識別子(文字列、必須、CNのみ)
利用可能なリソース
リソース名 | グローバル | CN | 認証が必要です | 説明 |
問題カテゴリ | ✅ | ✅ | ❌ | すべての問題分類カテゴリのリスト |
問題タグ | ✅ | ✅ | ❌ | アルゴリズムとデータ構造のタグの詳細なコレクション |
問題言語 | ✅ | ✅ | ❌ | サポートされているすべてのプログラミング言語の完全なリスト |
問題の詳細 | ✅ | ✅ | ❌ | 特定の問題に関する詳細を提供します |
問題解決 | ✅ | ✅ | ❌ | 特定のソリューションの完全なコンテンツを提供します |
リソースURI
問題カテゴリ- すべての問題分類カテゴリのリスト
URI:
categories://problems/all
問題タグ- アルゴリズムとデータ構造のタグの詳細なコレクション
URI:
tags://problems/all
problem-langs - LeetCode でサポートされているすべてのプログラミング言語の完全なリスト
URI:
langs://problems/all
問題の詳細- 特定の LeetCode 問題に関する詳細を提供します
URI:
problem://{titleSlug}パラメータ:
titleSlug: LeetCode URL に表示される問題識別子
問題-解決策- 特定の解決策の完全な内容を提供します
グローバルURI:
solution://{topicId}パラメータ:
topicId: ソリューションの一意のトピックID
CN URI:
solution://{slug}パラメータ:
slug: ソリューションの一意のスラッグ/識別子
認証
ユーザー固有のデータ アクセスには、LeetCode セッション認証が必要です。
ブラウザ開発者ツールから
LEETCODE_SESSIONCookieを抽出する--sessionフラグまたはLEETCODE_SESSION環境変数を使用してサーバーを構成する
応答フォーマット
すべてのツールは、次の構造の JSON 形式の応答を返します。
{
"content": [
{
"type": "text",
"text": "JSON_DATA_STRING"
}
]
}JSON_DATA_STRINGには、要求されたデータまたは失敗した要求のエラー メッセージのいずれかが含まれます。
ライセンス
このプロジェクトは MIT ライセンスに基づいてライセンスされています。
Available Tools
9 toolsget_daily_challengeA
Retrieves today's Daily Challenge problem with full description (read-only, no auth). Returns problem details for the current date as JSON. Use get_problem when you know a specific titleSlug; use search_problems to discover problems by filters.
Inputs: no named parameters.
get_problemA
Retrieves a single LeetCode problem by titleSlug (read-only, no auth). Returns description, examples, constraints, and metadata as JSON. Use search_problems to find problems by keyword/tag/difficulty; use get_daily_challenge for today's featured problem.
Inputs: titleSlug (required).
get_problem_solutionA
Retrieves full content of a community solution article (read-only, no auth). Requires topicId from list_problem_solutions. Returns article text, author, and metadata as JSON. Use list_problem_solutions first to discover solutions and obtain topicId.
Inputs: topicId (required).
get_recent_ac_submissionsA
Retrieves a user's recent accepted (AC) submissions (read-only, no auth). Available on both Global and CN. Use get_recent_submissions (Global only) to include failed attempts, or get_all_submissions (auth, current user) for full paginated history.
Inputs: username (required), limit.
get_recent_submissionsA
Retrieves a user's recent submission history on LeetCode Global (read-only, no auth). Includes both accepted and failed submissions. Global only—not available on CN. Use get_recent_ac_submissions for accepted-only results, or get_all_submissions (auth, current user) for paginated full history with filters.
Inputs: username (required), limit.
get_user_contest_rankingA
Retrieves a user's contest ranking and participation history (read-only, no auth). Returns overall rating, ranking, and per-contest performance as JSON. Use get_user_profile for general stats and ranking; use this specifically for contest performance data.
Inputs: username (required), attended.
get_user_profileA
Retrieves any user's public profile by username (read-only, no auth). Returns ranking, avatar, bio, submission stats, and platform-specific progress. Use this to look up other users or public stats. Use get_user_status (requires auth) instead to verify the current session user's login state—not for looking up arbitrary users.
Inputs: username (required).
list_problem_solutionsA
Lists community solution articles for a problem (read-only, no auth). Returns metadata only (topicId)—not full content. Use get_problem_solution with the returned topicId to read the full article. Do not call this when you already have a topicId and need the solution text.
Inputs: questionSlug (required), skip, limit, orderBy, +2 more.
search_problemsA
Searches LeetCode problems by category, tags, difficulty, and keywords (read-only, no auth). Supports pagination via limit/offset. Returns matching problem list as JSON. Use get_problem when you already know the titleSlug; use this to browse or discover problems.
Inputs: tags, limit, offset, category, +2 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Most tools target clearly distinct resources, and descriptions actively cross-reference alternatives (e.g. search_problems vs get_problem, get_problem vs get_daily_challenge). The only real overlap is get_recent_submissions vs get_recent_ac_submissions, which differ narrowly (failed attempts, Global-only), though the descriptions do disambiguate them.
Every tool follows a consistent snake_case verb_noun pattern (get_, search_, list_). No mixing of conventions, and names map cleanly to their actions and resources.
Nine tools is well-scoped for a read-only LeetCode data client, with each tool covering a distinct resource. No filler or redundant tools bloat the surface.
The read-only domain is mostly covered (problems, solutions, users, submissions, contest ranking), but descriptions reference tools that do not exist in the set—get_user_status and get_all_submissions—creating dead ends. There is also no submission/write capability, so any workflow requiring those referenced operations will fail.
Maintenance
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
A Model Context Protocol server for Wix AI tools
Model Context Protocol server for the Apideck Unified API. Connect any MCP-compatible agent framework to 100+ accounting systems, HRIS platforms, file storage providers, and more through one integration. More information https://www.apideck.com/mcp-server
Model Context Protocol server for Studex tools, notifications, and profile integrations
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceServer that enhances the capabilities of the Cline coding agent. It provides intelligent code suggestions, reduces hallucinations, and documents the knowledge base by leveraging your project's documentation and detecting the technologies used in your codebase.14MIT
- AlicenseCqualityDmaintenanceA Model Context Protocol (MCP) server for LeetCode that enables AI assistants to access LeetCode problems, user information, and contest data.728 npm45MIT
- FlicenseAqualityDmaintenanceAn MCP server that provides tools to interact with the LeetCode API, enabling problem fetching, code template generation, and solution execution/submission.71-
- AlicenseNot gradedqualityDmaintenanceA feature-rich LeetCode MCP server that enables problem search, user data retrieval, code execution, and notes management for both leetcode.com and leetcode.cn.MIT