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.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
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
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
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
- AlicenseCqualityDmaintenanceA Model Context Protocol (MCP) server for LeetCode that enables AI assistants to access LeetCode problems, user information, and contest data.755 npm44MIT
- 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.9940 npm158MIT
- FlicenseAqualityDmaintenanceAn MCP server that provides tools to interact with the LeetCode API, enabling problem fetching, code template generation, and solution execution/submission.71-
- FlicenseNot gradedqualityDmaintenanceA tutorial and working MCP server that connects to your LeetCode profile, enabling AI assistants to check solved problems and recommend new ones by topic and difficulty.1-