LeetCode MCP Server
@jinzcdev
About LeetCode MCP Server
An MCP server enabling automated access to LeetCode's problems, solutions, and public data with optional authentication for user-specific features, supporting leetcode.com & leetcode.cn sites.
Config
Add this server to your MCP-compatible client using the configuration below.
{
"mcpServers": {
"leetcode-mcp-server": {
"command": "npx",
"args": [
"-y",
"@smithery/cli",
"install",
"@jinzcdev/leetcode-mcp-server",
"--client",
"claude"
]
}
}
}Tools
No tools detected
Fetch the live tool list by running this server in a temporary sandbox using the button above.
Overview
What is LeetCode MCP Server?
The LeetCode MCP Server is a Model Context Protocol server that integrates with LeetCode APIs, providing automated access to problems, contests, solutions, and user data. It supports both LeetCode Global (leetcode.com) and LeetCode China (leetcode.cn) platforms.
How to use LeetCode MCP Server?
Install the server globally via npm install @jinzcdev/leetcode-mcp-server -g or run directly with npx -y @jinzcdev/leetcode-mcp-server. Optionally provide a LeetCode session cookie (--session <COOKIE>) for authenticated features. Configure the server as an MCP client (e.g., VS Code) by setting the command, arguments, or environment variables LEETCODE_SITE and LEETCODE_SESSION.
Key features of LeetCode MCP Server
- Multi-site support for LeetCode Global and LeetCode China
- Retrieve problem descriptions, constraints, examples, and editorials
- Access user profiles, submission history, and contest rankings
- Authenticated access to private data: notes, progress, and submissions
- Advanced problem search by tags, difficulty, category, and keywords
- Run and submit code with polling until completion
Use cases of LeetCode MCP Server
- Automate daily challenge retrieval and problem analysis
- Search and filter problems for targeted practice sessions
- Analyze submission results (AC/WA) and track solving progress
- Manage personal notes on problems (LeetCode China only)
- Integrate LeetCode data into AI‑powered coding assistants
FAQ from LeetCode MCP Server
What are the prerequisites for running LeetCode MCP Server?
Node.js v20.x or above is required. A LeetCode session cookie is optional and only needed for authenticated API access.
Do I need a LeetCode session cookie?
No, most tools work without authentication. However, tools for private data (e.g., notes, submission history, code running/submission) require a valid session cookie.
Which LeetCode platforms are supported?
Both LeetCode Global (leetcode.com) and LeetCode China (leetcode.cn) are supported. Specify the site with the --site argument or LEETCODE_SITE environment variable.
How do I configure the server in VS Code?
Add a JSON configuration to your User Settings under mcp.servers.leetcode, setting the command to npx, args to ["-y", "@jinzcdev/leetcode-mcp-server"], and optionally specifying LEETCODE_SITE and LEETCODE_SESSION in the env or as additional args.
What takes priority if I specify both environment variables and command-line arguments?
Command-line arguments take precedence over environment variables when both are provided for the same setting (site or session).
Frequently asked questions
What are the prerequisites for running LeetCode MCP Server?
Node.js v20.x or above is required. A LeetCode session cookie is optional and only needed for authenticated API access.
Do I need a LeetCode session cookie?
No, most tools work without authentication. However, tools for private data (e.g., notes, submission history, code running/submission) require a valid session cookie.
Which LeetCode platforms are supported?
Both LeetCode Global (leetcode.com) and LeetCode China (leetcode.cn) are supported. Specify the site with the `--site` argument or `LEETCODE_SITE` environment variable.
How do I configure the server in VS Code?
Add a JSON configuration to your User Settings under `mcp.servers.leetcode`, setting the command to `npx`, args to `["-y", "@jinzcdev/leetcode-mcp-server"]`, and optionally specifying `LEETCODE_SITE` and `LEETCODE_SESSION` in the `env` or as additional args.
What takes priority if I specify both environment variables and command-line arguments?
Command-line arguments take precedence over environment variables when both are provided for the same setting (site or session).
Basic information
More Other MCP servers
Nginx UI
0xJackyYet another WebUI for Nginx
MCP Registry
modelcontextprotocolA community driven registry service for Model Context Protocol (MCP) servers.

Sequential Thinking
modelcontextprotocolModel Context Protocol Servers
Blender
ahujasidOpen-source MCP to use Blender with any LLM
Inbox Zero AI MCP
elie222The world's best AI personal assistant for email. Open source app to help you reach inbox zero fast.
Comments