LeetCode MCP server
2026년 11월 12일 커밋AI 클라이언트가 세션 쿠키를 사용하여 LeetCode 문제, 솔루션, 콘테스트 및 사용자 데이터를 탐색하고 코드를 실행하거나 제출할 수 있게 합니다.
다른 이름 jinzcdev/leetcode-mcp-server
- 스타
- 158
- Tools
- 26
- 다운로드, 30일
- —
- 최신 버전
- —
- 마지막 커밋
- 2026년 11월 12일
- 라이선스
- MIT
LeetCode MCP란?
LeetCode은(는) MCP server입니다. AI 클라이언트가 세션 쿠키를 사용하여 LeetCode 문제, 솔루션, 콘테스트 및 사용자 데이터를 탐색하고 코드를 실행하거나 제출할 수 있게 합니다. 26개 도구를 제공합니다. 예: get_daily_challenge, get_problem, search_problems.
프로젝트 README에서 생성된 요약
LeetCode MCP server 정보
코딩 연습을 자동화하려는 개발자는 이 도구를 사용하여 AI 클라이언트를 통해 LeetCode와 직접 상호작용할 수 있습니다. 글로벌 플랫폼과 중국 기반 플랫폼 모두에서 문제 설명, 공식 에디토리얼 및 커뮤니티 솔루션에 접근할 수 있습니다. 세션 쿠키를 연결하면 개인 메모, 사용자 지정 문제 목록, 제출 기록과 같은 개인 데이터를 관리할 수 있습니다.
서버는 로컬 사용을 위한 표준 입출력 프로세스 또는 원격 통합을 위한 streamable HTTP 서버의 두 가지 모드로 작동합니다. 코드를 실행하거나 제출하는 특정 도구가 포함되어 있어 AI가 문제 제약 조건에 따라 솔루션을 테스트할 수 있습니다. 또한 사용자는 콘테스트 순위를 추적하고, 최근 통과한 제출 내역을 분석하며, 전반적인 문제 해결 진행 상황을 모니터링할 수 있습니다. 이 통합을 통해 채팅 인터페이스를 벗어나지 않고도 난이도나 태그별로 문제를 검색하고 일일 챌린지를 가져올 수 있습니다.
활용 사례
- 1자동 코드 테스트AI가 코드를 실행하고 제출하여 LeetCode 테스트 케이스를 통과하는지 확인할 수 있습니다.
- 2개인 맞춤형 학습 추적사용자는 AI에게 자신의 특정 문제 해결 진행 상황과 제출 기록을 가져오도록 요청할 수 있습니다.
- 3문제 탐색 및 조사개발자는 난이도나 카테고리와 같은 다양한 필터를 사용하여 특정 코딩 과제를 검색할 수 있습니다.
- 4학습 메모 관리이 도구를 통해 중국 플랫폼의 특정 문제에 첨부된 개인 메모를 생성하고 가져올 수 있습니다.
프로젝트의 README를 바탕으로 작성되었습니다. 모든 활용 사례는 해당 내용의 인용문과 대조하여 확인합니다.
LeetCode MCP 도구 26
README에서 감지됨get_daily_challengeget_problemsearch_problemsget_user_profileget_user_contest_rankingget_recent_submissionsget_recent_ac_submissionsget_user_statusget_problem_submission_reportget_problem_progressget_all_submissionsrun_code
| get_daily_challenge | — | |
| get_problem | — | |
| search_problems | — | |
| get_user_profile | — | |
| get_user_contest_ranking | — | |
| get_recent_submissions | — | |
| get_recent_ac_submissions | — | |
| get_user_status | — | |
| get_problem_submission_report | — | |
| get_problem_progress | — | |
| get_all_submissions | — | |
| run_code | — |
도구 26개 모두 보기도구 수 줄이기
submit_solutionsearch_notesget_notecreate_noteupdate_notelist_problem_listsget_problem_listcreate_problem_listupdate_problem_listadd_problems_to_listremove_problems_from_listreorder_problem_listlist_problem_solutionsget_problem_solution
| submit_solution | — | |
| search_notes | — | |
| get_note | — | |
| create_note | — | |
| update_note | — | |
| list_problem_lists | — | |
| get_problem_list | — | |
| create_problem_list | — | |
| update_problem_list | — | |
| add_problems_to_list | — | |
| remove_problems_from_list | — | |
| reorder_problem_list | — | |
| list_problem_solutions | — | |
| get_problem_solution | — |
구성
LEETCODE_SESSIONLEETCODE_SITE
| 이름 | 설명 | 유형 |
|---|---|---|
| LEETCODE_SESSION | — | |
| LEETCODE_SITE | — |
자동 검사
2026년 11월 12일에 실행됨전체 보고서 →아직 인증되지 않았습니다. 서버는 80점 이상의 점수, 심각한 결함 없음, 그리고 검사에 충분한 데이터를 갖추어야 합니다. 검사 방식 · 점수를 높이기 위해 수정할 항목
- 소스 저장소 연결 및 접근 가능통과
- 오픈 소스 라이선스 (OSI)통과
- 최근 1년 내 커밋 또는 릴리스통과
- 패키지 이름이 인기 패키지와 유사하지 않음검사되지 않음
- 원격 엔드포인트가 HTTPS 사용검사되지 않음
- 파괴적인 도구에 라벨 표시됨검사되지 않음
- 모델에 대한 숨겨진 지침 없음통과
- 패키지 및 해당 종속성에 중요한 보안 권고 없음검사되지 않음
README
GitHub에서 보기LeetCode MCP Server
The LeetCode MCP Server is a Model Context Protocol (MCP) server that provides seamless integration with LeetCode APIs, enabling advanced automation and intelligent interaction with LeetCode's programming problems, contests, solutions, and user data.
Features
- 🌐 Multi-site Support: Support both leetcode.com (Global) and leetcode.cn (China) platforms
- 🔌 Dual Transport Modes: Run as a stdio process (default) or as a Streamable HTTP server for web-based integrations
- 📊 Problem Data Retrieval: Obtain detailed problem descriptions, constraints, examples, official editorials, and user-submitted solutions
- 👤 User Data Access: Retrieve user profiles, submission history, and contest performance
- 🔒 Private Data Access: Create and query user notes, manage problem lists, track problem-solving progress, and analyze submission details (AC/WA analysis)
- 🔍 Advanced Search Capabilities: Filter problems by tags, difficulty levels, categories, and keywords
- 📅 Daily Challenge Access: Easily access daily challenge problems
Prerequisites
- Node.js (v20.x or above)
- (Optional) LeetCode session cookie for authenticated API access
Installation
# Install from npm
npm install @jinzcdev/leetcode-mcp-server -g
# Run with Global site configuration (stdio transport, default)
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>
# Run as a Streamable HTTP server
npx -y @jinzcdev/leetcode-mcp-server --transport http --port 3000 --site global
Alternatively, you can clone the repository and run it locally:
# Clone the repository
git clone https://github.com/jinzcdev/leetcode-mcp-server.git
# Navigate to the project directory
cd leetcode-mcp-server
# Build the project
npm install && npm run build
# Run the server (stdio transport)
node build/index.js --site global
# Or run as a Streamable HTTP server
node build/index.js --transport http --port 3000 --site global
Usage
The server supports two transport modes:
| Transport | Description |
|---|---|
stdio (default) |
Standard input/output transport for local MCP clients |
http |
Streamable HTTP transport for web-based integrations and remote access |
Command-Line Options
| Option | Alias | Default | Description |
|---|---|---|---|
--site |
-s |
global |
LeetCode API site: global (leetcode.com) or cn (leetcode.cn) |
--session |
-c |
— | LeetCode session cookie for authenticated requests |
--transport |
-t |
stdio |
Transport mode: stdio or http |
--port |
— | 3000 |
HTTP server port (Streamable HTTP only) |
--host |
— | 127.0.0.1 |
HTTP server host (Streamable HTTP only) |
--endpoint |
— | /mcp |
HTTP endpoint path (Streamable HTTP only) |
MCP Client Configuration (stdio)
Add the following server entry to your MCP client configuration file:
Option 1: Using Environment Variables
{
"mcpServers": {
"leetcode": {
"command": "npx",
"args": ["-y", "@jinzcdev/leetcode-mcp-server"],
"env": {
"LEETCODE_SITE": "global",
"LEETCODE_SESSION": "<YOUR_LEETCODE_SESSION_COOKIE>"
}
}
}
}
Option 2: Using Command Line Arguments
{
"mcpServers": {
"leetcode": {
"command": "npx",
"args": [
"-y",
"@jinzcdev/leetcode-mcp-server",
"--site",
"global",
"--session",
"<YOUR_LEETCODE_SESSION_COOKIE>"
]
}
}
}
For LeetCode China site, modify the --site parameter to cn.
[!NOTE]
The exact configuration file location and JSON structure may vary by MCP client. Some clients use an
mcp.serverswrapper or atypefield — refer to your client's documentation and adapt the example accordingly.
MCP Client Configuration (Streamable HTTP)
First, start the server in HTTP mode:
npx -y @jinzcdev/leetcode-mcp-server --transport http --port 3000 --site global
Then connect your MCP client to the running server:
{
"mcpServers": {
"leetcode": {
"type": "http",
"url": "http://127.0.0.1:3000/mcp"
}
}
}
To use authenticated endpoints, pass the session cookie when starting the server:
npx -y @jinzcdev/leetcode-mcp-server --transport http --port 3000 --site global --session <YOUR_LEETCODE_SESSION_COOKIE>
[!NOTE] Some MCP clients use
"type": "http"or"type": "streamableHttp"alongside theurlfield. Refer to your client's documentation for the exact HTTP transport configuration format.
[!TIP]
The server supports the following optional environment variables:
LEETCODE_SITE: LeetCode API endpoint (globalorcn, default:global)LEETCODE_SESSION: LeetCode session cookie for authenticated API access (default: empty)LEETCODE_TRANSPORT: Transport mode (stdioorhttp, default:stdio)LEETCODE_HTTP_PORT: HTTP server port when using Streamable HTTP (default:3000)LEETCODE_HTTP_HOST: HTTP server host when using Streamable HTTP (default:127.0.0.1)LEETCODE_HTTP_ENDPOINT: HTTP endpoint path when using Streamable HTTP (default:/mcp)Priority Note: Command-line arguments take precedence over environment variables when both are specified. For example:
- If
LEETCODE_SITE=cnis set but you runleetcode-mcp-server --site global, the server will useglobal.- If
LEETCODE_SESSIONexists but you provide--session "new_cookie", the command-line session value will be used.
Available Tools
Problems
| Tool | Global | CN | Auth Required | Description |
|---|---|---|---|---|
| get_daily_challenge | ✅ | ✅ | ❌ | Retrieves today's LeetCode Daily Challenge problem |
| get_problem | ✅ | ✅ | ❌ | Retrieves details for a specific LeetCode problem |
| search_problems | ✅ | ✅ | ❌ | Searches for LeetCode problems with multiple filter criteria |
Users
| Tool | Global | CN | Auth Required | Description |
|---|---|---|---|---|
| get_user_profile | ✅ | ✅ | ❌ | Retrieves profile information for a LeetCode user |
| get_user_contest_ranking | ✅ | ✅ | ❌ | Obtains contest ranking statistics for a user |
| get_recent_ac_submissions | ✅ | ✅ | ❌ | Retrieves a user's recent accepted submissions |
| get_recent_submissions | ✅ | ❌ | ❌ | Retrieves a user's recent submissions history |
| get_user_status | ✅ | ✅ | ✅ | Retrieves current user's current status |
| get_problem_submission_report | ✅ | ✅ | ✅ | Provides detailed submission analysis for a specific problem |
| get_problem_progress | ✅ | ✅ | ✅ | Retrieves current user's problem-solving progress |
| get_all_submissions | ✅ | ✅ | ✅ | Retrieves current user's submission history |
Submissions
| Tool | Global | CN | Auth Required | Description |
|---|---|---|---|---|
| run_code | ✅ | ✅ | ✅ | Runs code for a problem and polls /check/ until finished |
| submit_solution | ✅ | ✅ | ✅ | Submits code for a problem and polls /check/ until finished |
Notes
| Tool | Global | CN | Auth Required | Description |
|---|---|---|---|---|
| search_notes | ❌ | ✅ | ✅ | Searches for user notes with filtering options |
| get_note | ❌ | ✅ | ✅ | Retrieves notes for a specific problem by question ID |
| create_note | ❌ | ✅ | ✅ | Creates a new note for a specific problem |
| update_note | ❌ | ✅ | ✅ | Updates an existing note with new content |
Problem Lists
| Tool | Global | CN | Auth Required | Description |
|---|---|---|---|---|
| list_problem_lists | ✅ | ✅ | ✅ | Lists the current user's problem lists (favorites) |
| get_problem_list | ✅ | ✅ | ✅ | Retrieves a problem list's metadata and its questions |
| create_problem_list | ✅ | ✅ | ✅ | Creates a new problem list, optionally with initial problems |
| update_problem_list | ✅ | ✅ | ✅ | Renames a problem list, edits its description or visibility |
| add_problems_to_list | ✅ | ✅ | ✅ | Adds problems to a problem list by slug or problem number |
| remove_problems_from_list | ✅ | ✅ | ✅ | Removes problems from a problem list |
| reorder_problem_list | ✅ | ✅ | ✅ | Reorders the problems inside a problem list |
Solutions
| Tool | Global | CN | Auth Required | Description |
|---|---|---|---|---|
| list_problem_solutions | ✅ | ✅ | ❌ | Retrieves a list of community solutions for a specific problem |
| get_problem_solution | ✅ | ✅ | ❌ | Retrieves the complete content of a specific solution |
Tool Parameters
Problems
-
get_daily_challenge - Retrieves today's LeetCode Daily Challenge problem with complete details
- No parameters required
-
get_problem - Retrieves details about a specific LeetCode problem
titleSlug: The URL slug/identifier of the problem (string, required)
-
search_problems - Searches for LeetCode problems based on multiple filter criteria
category: Problem category filter (string, optional, default: "all-code-essentials")tags: List of topic tags to filter problems by (string[], optional)difficulty: Problem difficulty level filter (enum: "EASY", "MEDIUM", "HARD", optional)searchKeywords: Keywords to search in problem titles and descriptions (string, optional)limit: Maximum number of problems to return (number, optional, default: 10)offset: Number of problems to skip (number, optional)
Users
-
get_user_profile - Retrieves profile information about a LeetCode user
username: LeetCode username (string, required)
-
get_user_contest_ranking - Retrieves a user's contest ranking information
username: LeetCode username (string, required)attended: Whether to include only the contests the user has participated in (boolean, optional, default: true)
-
get_recent_submissions - Retrieves a user's recent submissions on LeetCode Global
username: LeetCode username (string, required)limit: Maximum number of submissions to return (number, optional, default: 10)
-
get_recent_ac_submissions - Retrieves a user's recent accepted submissions
username: LeetCode username (string, required)limit: Maximum number of submissions to return (number, optional, default: 10)
-
get_user_status - Retrieves the current user's status
- No parameters required
-
get_problem_submission_report - Retrieves detailed information about a specific submission
id: The numerical submission ID (number, required)
-
get_problem_progress - Retrieves the current user's problem-solving progress
offset: Number of questions to skip (number, optional, default: 0)limit: Maximum number of questions to return (number, optional, default: 100)questionStatus: Filter by question status (enum: "ATTEMPTED", "SOLVED", optional)difficulty: Filter by difficulty levels (string[], optional)
-
get_all_submissions - Retrieves paginated list of user's submissions
limit: Maximum number of submissions to return (number, default: 20)offset: Number of submissions to skip (number, default: 0)questionSlug: Optional problem identifier (string, optional)lang: Programming language filter (string, optional, CN only)status: Submission status filter (enum: "AC", "WA", optional, CN only)lastKey: Pagination token for retrieving next page (string, optional, CN only)
Submissions
-
run_code - Runs code for a specific problem and waits until finished (requires authentication)
titleSlug: The URL slug/identifier of the problem (string, required)lang: Programming language (string enum, required)typedCode: Source code to run (string, required)dataInput: Custom input to run (string, optional)timeoutMs: Polling timeout in milliseconds (number, optional, default: 120000)pollIntervalMs: Polling interval in milliseconds (number, optional, default: 1500)
-
submit_solution - Submits code for a specific problem and waits until finished (requires authentication)
titleSlug: The URL slug/identifier of the problem (string, required)lang: Programming language (string enum, required)typedCode: Source code to submit (string, required)timeoutMs: Polling timeout in milliseconds (number, optional, default: 120000)pollIntervalMs: Polling interval in milliseconds (number, optional, default: 1500)
Notes
-
search_notes - Searches for user notes on LeetCode China
keyword: Search term to filter notes (string, optional)limit: Maximum number of notes to return (number, optional, default: 10)skip: Number of notes to skip (number, optional, default: 0)orderBy: Sort order for returned notes (enum: "ASCENDING", "DESCENDING", optional, default: "DESCENDING")
-
get_note - Retrieves user notes for a specific LeetCode problem
questionId: The question ID of the LeetCode problem (string, required)limit: Maximum number of notes to return (number, optional, default: 10)skip: Number of notes to skip (number, optional, default: 0)
-
create_note - Creates a new note for a specific LeetCode problem
questionId: The question ID of the LeetCode problem (string, required)content: The content of the note, supports markdown format (string, required)summary: An optional short summary or title for the note (string, optional)
-
update_note - Updates an existing note with new content or summary
noteId: The ID of the note to update (string, required)content: The new content for the note, supports markdown format (string, required)summary: An optional new short summary or title for the note (string, optional)
Problem Lists
Problem lists are identified by their favoriteSlug, the path segment after /problem-list/ in the list URL.
-
list_problem_lists - Lists the current user's problem lists
includeCollected: Also return lists saved from other creators (boolean, optional, default: false)
-
get_problem_list - Retrieves a problem list's metadata and a page of its questions
favoriteSlug: The slug of the problem list (string, required)limit: Maximum number of questions to return (number, optional, default: 50)skip: Number of questions to skip (number, optional, default: 0)searchKeyword: Keyword to filter questions by title (string, optional)sortField: Sort field:CUSTOM(the order shown on the website),FRONTEND_ID,DIFFICULTY,AC_RATE,FREQUENCYorCONTEST_POINT(string, optional, default:CUSTOM)sortOrder:ASCENDINGorDESCENDING(string, optional, default:ASCENDING)
-
create_problem_list - Creates a new problem list
name: Display name of the list (string, required)description: Description of the list (string, optional, default: "")isPublic: Whether the list is publicly visible (boolean, optional, default: false)questionSlugs: Problem slugs to add right after creation (string[], optional)questionIds: Problem numbers to add right after creation, e.g.[1, 1143]; numbers that cannot be resolved are returned inunresolved((string | number)[], optional)
-
update_problem_list - Renames a problem list, changes its description or toggles its visibility (at least one optional field is required)
favoriteSlug: The slug of the problem list (string, required)name: New display name (string, optional)description: New description (string, optional)isPublic: New visibility (boolean, optional)
-
add_problems_to_list - Adds problems to a problem list (at least one of
questionSlugs/questionIdsis required; problems are appended in the given order, slugs first)favoriteSlug: The slug of the problem list (string, required)questionSlugs: Problem slugs to add, e.g.["two-sum"](string[], optional)questionIds: Problem numbers to add, e.g.[1, 1143]or["LCP 82"]; numbers that cannot be resolved are returned inunresolved((string | number)[], optional)
-
remove_problems_from_list - Removes problems from a problem list
favoriteSlug: The slug of the problem list (string, required)questionSlugs: Problem slugs to remove (string[], required)
-
reorder_problem_list - Reorders the problems inside a problem list (exactly one of
sortField/questionSlugsis required; one problem is moved per request)favoriteSlug: The slug of the problem list (string, required)sortField: Sort the whole list byFRONTEND_ID,DIFFICULTY,AC_RATE,FREQUENCYorCONTEST_POINT(string, optional)sortOrder:ASCENDINGorDESCENDING(string, optional, default:ASCENDING)questionSlugs: Problem slugs to move to the top, in this order; the remaining problems keep their relative order (string[], optional)
Solutions
-
list_problem_solutions - Retrieves a list of community solutions for a specific problem
questionSlug: The URL slug/identifier of the problem (string, required)limit: Maximum number of solutions to return (number, optional, default: 10)skip: Number of solutions to skip (number, optional)userInput: Search term to filter solutions (string, optional)tagSlugs: Array of tag identifiers to filter solutions (string[], optional, default: [])orderBy: Sorting criteria for the returned solutions- Global: enum: "HOT", "MOST_RECENT", "MOST_VOTES", optional, default: "HOT"
- CN: enum: "DEFAULT", "MOST_UPVOTE", "HOT", "NEWEST_TO_OLDEST", "OLDEST_TO_NEWEST", optional, default: "DEFAULT"
-
get_problem_solution - Retrieves the complete content of a specific solution
topicId: Unique topic ID of the solution (string, required, Global only)slug: Unique slug/identifier of the solution (string, required, CN only)
Available Resources
| Resource Name | Global | CN | Auth Required | Description |
|---|---|---|---|---|
| problem-categories | ✅ | ✅ | ❌ | A list of all problem classification categories |
| problem-tags | ✅ | ✅ | ❌ | A detailed collection of algorithmic and data structure tags |
| problem-langs | ✅ | ✅ | ❌ | A complete list of all supported programming languages |
| problem-detail | ✅ | ✅ | ❌ | Provides details about a specific problem |
| problem-solution | ✅ | ✅ | ❌ | Provides the complete content of a specific solution |
Resource URIs
-
problem-categories - A list of all problem classification categories
- URI:
categories://problems/all
- URI:
-
problem-tags - A detailed collection of algorithmic and data structure tags
- URI:
tags://problems/all
- URI:
-
problem-langs - A complete list of all programming languages supported by LeetCode
- URI:
langs://problems/all
- URI:
-
problem-detail - Provides details about a specific LeetCode problem
- URI:
problem://{titleSlug} - Parameters:
titleSlug: Problem identifier as it appears in the LeetCode URL
- URI:
-
problem-solution - Provides the complete content of a specific solution
- Global URI:
solution://{topicId}- Parameters:
topicId: Unique topic ID of the solution
- Parameters:
- CN URI:
solution://{slug}- Parameters:
slug: Unique slug/identifier of the solution
- Parameters:
- Global URI:
Authentication
User-specific data access requires LeetCode session authentication:
- Log in to LeetCode (Global or China site)
- Extract
LEETCODE_SESSIONcookie from browser developer tools - Configure server with
--sessionflag orLEETCODE_SESSIONenvironment variable
Response Format
All tools return JSON-formatted responses with the following structure:
{
"content": [
{
"type": "text",
"text": "JSON_DATA_STRING"
}
]
}
The JSON_DATA_STRING contains either the requested data or an error message for failed requests.
License
This project is licensed under the MIT License.
LeetCode MCP 질문
LeetCode MCP는 어떤 도구를 제공하나요?
26개 도구를 제공합니다. 예: get_daily_challenge, get_problem, search_problems, get_user_profile, get_user_contest_ranking.
LeetCode MCP server를 사용하려면 인증이 필요한가요?
아니요, 대부분의 문제 및 공개 사용자 도구는 인증 없이 작동합니다. 메모, 문제 목록, 진행 상황 및 코드 제출과 같은 개인 데이터에 접근하려면 LeetCode 세션 쿠키가 필요합니다.
이 서버는 어떤 LeetCode 사이트를 지원하나요?
글로벌 leetcode.com 사이트와 중국 leetcode.cn 사이트를 모두 지원하며, --site 옵션을 통해 선택할 수 있습니다.
세션 쿠키를 사용하여 LeetCode MCP server를 실행하려면 어떻게 해야 하나요?
서버를 시작할 때 --session 플래그로 쿠키를 전달하거나 LEETCODE_SESSION 환경 변수를 설정하십시오.
서버에서 코드 솔루션을 실행하거나 제출할 수 있나요?
네, 인증을 통해 코드를 실행하고 문제에 대한 솔루션을 제출할 수 있으며, 결과가 나올 때까지 폴링을 수행합니다.
태그나 난이도별로 LeetCode 문제를 검색할 수 있나요?
네, search_problems 도구를 사용하여 태그, 난이도, 카테고리 및 키워드로 문제를 필터링할 수 있습니다.