mcp-leetcode
A feature-rich LeetCode MCP server that enables problem search, user data retrieval, code execution, and notes management for both leetcode.com and leetcode.cn.
README
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
Quick Start
Installation
pip install mcp-leetcode
Configuration
cp config.example.yaml config.yaml
# Edit config.yaml with your settings
Run
mcp-leetcode
MCP 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_daily_challenge |
Get today's daily challenge |
get_problem |
Get problem details by slug |
search_problems |
Search with filters (tags, difficulty, keywords) |
get_problem_solutions |
Get community solutions |
Users
| Tool | Description |
|---|---|
get_user_profile |
Get user profile information |
get_user_submissions |
Get submission history |
get_user_progress |
Get problem-solving progress |
get_contest_info |
Get contest ranking info |
Code Execution
| Tool | Description |
|---|---|
run_code |
Run code with test cases |
submit_solution |
Submit code to LeetCode |
Notes (CN only)
| Tool | Description |
|---|---|
get_notes |
Get user notes |
create_note |
Create a new note |
update_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
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.