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. - ๐ Multi-site Support: Supportโ both leetcode.com (Global) and leetcode.cn (China) platforms - ๐ Problem Data Retrieval: Obtain detailed problem d
Add this skill
npx mdskills install jinzcdev/leetcode-mcp-serverComprehensive LeetCode API integration with excellent tool coverage, clear documentation, and well-organized setup instructions
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.
To install leetcode-mcp-server for Claude Desktop automatically via Smithery:
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
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
node build/index.js --site global
Add the following JSON configuration to your User Settings (JSON) file. Access this by pressing Ctrl/Cmd + Shift + P and searching for Preferences: Open User Settings (JSON).
{
"mcp": {
"servers": {
"leetcode": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@jinzcdev/leetcode-mcp-server"],
"env": {
"LEETCODE_SITE": "global",
"LEETCODE_SESSION": ""
}
}
}
}
}
{
"mcp": {
"servers": {
"leetcode": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@jinzcdev/leetcode-mcp-server",
"--site",
"global",
"--session",
""
]
}
}
}
}
For LeetCode China site, modify the --site parameter to cn.
Tip:
The server supports the following optional environment variables:
LEETCODE_SITE: LeetCode API endpoint ('global' or 'cn', default: 'global')LEETCODE_SESSION: LeetCode session cookie for authenticated API access (default: empty)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.
| 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 |
| 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 |
| 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 |
| 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 |
get_daily_challenge - Retrieves today's LeetCode Daily Challenge problem with complete details
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)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
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)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)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
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)| 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 |
problem-categories - A list of all problem classification categories
categories://problems/allproblem-tags - A detailed collection of algorithmic and data structure tags
tags://problems/allproblem-langs - A complete list of all programming languages supported by LeetCode
langs://problems/allproblem-detail - Provides details about a specific LeetCode problem
problem://{titleSlug}titleSlug: Problem identifier as it appears in the LeetCode URLproblem-solution - Provides the complete content of a specific solution
solution://{topicId}
topicId: Unique topic ID of the solutionsolution://{slug}
slug: Unique slug/identifier of the solutionUser-specific data access requires LeetCode session authentication:
LEETCODE_SESSION cookie from browser developer tools--session flag or LEETCODE_SESSION environment variableAll 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.
This project is licensed under the MIT License.
Install via CLI
npx mdskills install jinzcdev/leetcode-mcp-serverLeetCode MCP Server is a free, open-source AI agent skill. 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. - ๐ Multi-site Support: Supportโ both leetcode.com (Global) and leetcode.cn (China) platforms - ๐ Problem Data Retrieval: Obtain detailed problem d
Install LeetCode MCP Server with a single command:
npx mdskills install jinzcdev/leetcode-mcp-serverThis downloads the skill files into your project and your AI agent picks them up automatically.
LeetCode MCP Server works with Claude Code, Claude Desktop, Cursor, Vscode Copilot, Windsurf, Continue Dev, Gemini Cli, Amp, Roo Code, Goose. Skills use the open SKILL.md format which is compatible with any AI coding agent that reads markdown instructions.