LeetCode
๐ โ๏ธ - MCP server enabling automated access to **LeetCode**'s programming problems, solutions, submissions and public data with optional authentication for user-specific features (e.g., notes), supporting both 'leetcode.com' (global) and 'leetcode.cn
What is LeetCode?
LeetCode is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to ๐ โ๏ธ - mcp server enabling automated access to **leetcode**'s programming problems, solutions, submissions and public data with optional authentication for user-specific features (e.g., notes), suppo...
๐ โ๏ธ - MCP server enabling automated access to **LeetCode**'s programming problems, solutions, submissions and public data with optional authentication for user-specific features (e.g., notes), supporting both 'leetcode.com' (global) and 'leetcode.cn
This server falls under the Developer Tools category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- ๐ โ๏ธ - MCP server enabling automated access to **LeetCode**'
Use Cases
Maintainer
Works with
Installation
NPM
npx -y @jinzcdev/leetcode-mcp-serverManual Installation
npx -y @jinzcdev/leetcode-mcp-serverConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use LeetCode
LeetCode MCP Server gives AI assistants direct access to LeetCode's programming problem database, enabling retrieval of daily challenges, problem details, solution editorials, submission history, and user contest rankings โ all through natural language. It supports both the global leetcode.com and the Chinese leetcode.cn platform, with optional session cookie authentication for personal features like viewing your own submissions and notes, making it a powerful companion for algorithm practice and interview preparation.
Prerequisites
- Node.js 16 or higher and npm installed
- An MCP-compatible client such as Claude Desktop, VS Code with MCP extension, or Cursor
- Optional: a LeetCode account and your LEETCODE_SESSION browser cookie for authenticated features (personal submissions, notes)
Install the package
Install the LeetCode MCP Server package using npx (no global install needed) or globally via npm.
npx -y @jinzcdev/leetcode-mcp-serverOptional: extract your LeetCode session cookie
For personal features (submission history, notes), log into leetcode.com in your browser, open Developer Tools โ Application โ Cookies, and copy the value of the 'LEETCODE_SESSION' cookie.
Configure for Claude Desktop
Add the server to your Claude Desktop configuration. Set LEETCODE_SITE to 'global' for leetcode.com or 'cn' for leetcode.cn. Add LEETCODE_SESSION if you have it.
{
"mcpServers": {
"leetcode": {
"command": "npx",
"args": ["-y", "@jinzcdev/leetcode-mcp-server"],
"env": {
"LEETCODE_SITE": "global",
"LEETCODE_SESSION": "YOUR_SESSION_COOKIE_HERE"
}
}
}
}Restart your MCP client
Restart Claude Desktop or your IDE to load the new configuration. The 24+ LeetCode tools will become available in the AI assistant.
Test with the daily challenge
Ask your AI assistant to fetch today's LeetCode daily challenge to confirm the server is working.
LeetCode Examples
Client configuration
Claude Desktop configuration for the LeetCode MCP Server with global site and optional session authentication.
{
"mcpServers": {
"leetcode": {
"command": "npx",
"args": ["-y", "@jinzcdev/leetcode-mcp-server"],
"env": {
"LEETCODE_SITE": "global",
"LEETCODE_SESSION": "YOUR_SESSION_COOKIE_HERE"
}
}
}
}Prompts to try
Example prompts for fetching problems, checking submissions, browsing solutions, and tracking contest performance.
- "What is today's LeetCode daily challenge? Show me the problem description."
- "Find all medium-difficulty graph problems on LeetCode"
- "Show me the top community solutions for Two Sum (problem #1)"
- "Get my recent submission history for the past 30 days"
- "What is my current LeetCode contest rating and ranking?"
- "Fetch the editorial solution for LeetCode problem #42 Trapping Rain Water"Troubleshooting LeetCode
Personal features like submission history return 'not authenticated'
You need to provide your LEETCODE_SESSION cookie in the env configuration. Log into leetcode.com, open browser DevTools โ Application โ Cookies โ leetcode.com, and copy the LEETCODE_SESSION value. Session cookies expire; re-extract if it stops working.
Server connects to leetcode.cn instead of leetcode.com (or vice versa)
Set the LEETCODE_SITE environment variable explicitly to 'global' for leetcode.com or 'cn' for leetcode.cn in your MCP client configuration. Command-line arguments '--site global' or '--site cn' also work and override the env var.
npx download is slow or fails in restricted environments
Install the package globally first with 'npm install -g @jinzcdev/leetcode-mcp-server', then change the command in your config to 'leetcode-mcp-server' (no npx needed). Alternatively, clone the repo and use 'node build/index.js' as the command.
Frequently Asked Questions about LeetCode
What is LeetCode?
LeetCode is a Model Context Protocol (MCP) server that ๐ โ๏ธ - mcp server enabling automated access to **leetcode**'s programming problems, solutions, submissions and public data with optional authentication for user-specific features (e.g., notes), supporting both 'leetcode.com' (global) and 'leetcode.cn It connects AI assistants to external tools and data sources through a standardized interface.
How do I install LeetCode?
Install via npm with the command: npx -y @jinzcdev/leetcode-mcp-server. Then add the server configuration to your AI client's JSON config file (e.g., claude_desktop_config.json or .cursor/mcp.json).
Which AI clients work with LeetCode?
LeetCode works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is LeetCode free to use?
Yes, LeetCode is open source and available under the MIT License license. You can use it freely in both personal and commercial projects.
LeetCode Alternatives โ Similar Developer Tools Servers
Looking for alternatives to LeetCode? Here are other popular developer tools servers you can use with Claude, Cursor, and VS Code.
Ecc
โ 188.2kThe agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
Javaguide
โ 155.8kJava ้ข่ฏ & ๅ็ซฏ้็จ้ข่ฏๆๅ๏ผ่ฆ็่ฎก็ฎๆบๅบ็กใๆฐๆฎๅบใๅๅธๅผใ้ซๅนถๅใ็ณป็ป่ฎพ่ฎกไธ AI ๅบ็จๅผๅ
Gemini CLI
โ 104.5kA secure MCP server that wraps the Google Gemini CLI, allowing clients to query Gemini models using local OAuth sessions without requiring an API key. It provides tools for model interaction and diagnostics with built-in protection against command in
Awesome MCP Servers
โ 87.3kโญ Curated list of Model Context Protocol (MCP) servers - tools that extend Claude Desktop, Cursor, Windsurf, and other MCP clients with custom capabilities.
MCP Servers
โ 86.0kModel Context Protocol Servers
CC Switch
โ 77.5kA cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Gemini CLI & Hermes Agent. Only official website: ccswitch.io
Browse More Developer Tools MCP Servers
Explore all developer tools servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up LeetCode in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use LeetCode?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.