mcp-leetcode
Provides tools for interacting with LeetCode, including daily challenges, problem search, user profiles, submissions, progress, code execution, and notes management (CN-only), supporting both leetcode.com and leetcode.cn.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-leetcodeWhat's today's daily LeetCode challenge?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP LeetCode
A feature-rich LeetCode MCP Server written in Python, supporting both leetcode.com and leetcode.cn.
Features
π Dual Site Support - leetcode.com (Global) & leetcode.cn (China)
π Problem Query - Search, filter, and get problem details
π€ User Data - Profile, submissions, progress, contest info
π» Code Execution - Run and submit code
π Notes Management - CRUD operations (CN only)
β‘ Smart Caching - Reduce API calls with built-in cache
π‘οΈ Type Safe - Full Pydantic v2 type definitions
Related MCP server: LeetCode MCP Server
Quick Start
Installation
pip install mcp-leetcodeConfiguration
cp config.example.yaml config.yaml
# Edit config.yaml with your settingsRun
mcp-leetcodeMCP Client Configuration
Claude Desktop
{
"mcpServers": {
"leetcode": {
"command": "mcp-leetcode",
"env": {
"LEETCODE_SITE": "cn",
"LEETCODE_SESSION": "your_session_cookie",
"LEETCODE_CSRF": "your_csrf_token"
}
}
}
}VS Code (Copilot)
{
"mcp": {
"servers": {
"leetcode": {
"command": "mcp-leetcode",
"env": {
"LEETCODE_SITE": "cn"
}
}
}
}
}Available Tools
Problems
Tool | Description |
| Get today's daily challenge |
| Get problem details by slug |
| Search with filters (tags, difficulty, keywords) |
| Get community solutions |
Users
Tool | Description |
| Get user profile information |
| Get submission history |
| Get problem-solving progress |
| Get contest ranking info |
Code Execution
Tool | Description |
| Run code with test cases |
| Submit code to LeetCode |
Notes (CN only)
Tool | Description |
| Get user notes |
| Create a new note |
| Update existing note |
Development
# Clone
git clone https://github.com/LYCGGG/mcp-leetcode.git
cd mcp-leetcode
# Install dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Lint
ruff check src/License
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
Lean 4 MCP server: compile, prove theorems, and formalize math with Mathlib.
A MCP server built for developers enabling Git based project management with project and personalβ¦
An MCP server that provides read access to your cloud storage providers, bank accounts and more.
Related MCP Servers
- AlicenseCqualityFmaintenanceA Model Context Protocol (MCP) server for LeetCode that enables AI assistants to access LeetCode problems, user information, and contest data.712 npm43MIT
- AlicenseAqualityAmaintenanceA Model Context Protocol server that provides integration with LeetCode APIs, enabling automated interaction with programming problems, contests, solutions, and user data across both leetcode.com and leetcode.cn platforms.9239 npm143MIT
- FlicenseAqualityDmaintenanceAn MCP server that provides tools to interact with the LeetCode API, enabling problem fetching, code template generation, and solution execution/submission.71-
- FlicenseNot gradedqualityCmaintenanceAn MCP server that provides structured, AI-powered guidance for LeetCode problems, including approach analysis, hints, complexity breakdowns, and optimization directions without spoiling solutions.14 npm1-