LeetCode

v1.2.0โ€ขDeveloper Toolsโ€ขstable

๐Ÿ“‡ โ˜๏ธ - 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

aialgorithmlcleetcodellm
Share:
114
Stars
0
Downloads
0
Weekly
0/5

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

Programming problem access
Solution and submission tracking
Algorithm practice support
jinzcdev

Maintainer

LicenseMIT License
Languagetypescript
Versionv1.2.0
UpdatedMay 16, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

NPM

npx -y @jinzcdev/leetcode-mcp-server

Manual Installation

npx -y @jinzcdev/leetcode-mcp-server

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

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)
1

Install the package

Install the LeetCode MCP Server package using npx (no global install needed) or globally via npm.

npx -y @jinzcdev/leetcode-mcp-server
2

Optional: 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.

3

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"
      }
    }
  }
}
4

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.

5

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.

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.

Quick Config Preview

{ "mcpServers": { "leetcode-mcp-server": { "command": "npx", "args": ["-y", "@jinzcdev/leetcode-mcp-server"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide โ†’

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.

33,000+ ServersFree & Open SourceStep-by-Step Guides