Skip to main content
Glama

MCP LeetCode

Python MCP License

English | δΈ­ζ–‡

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

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

No tool schema history has been recorded yet.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    A
    maintenance
    A 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.
    9
    239
    141
    MIT
  • F
    license
    A
    quality
    D
    maintenance
    An MCP server that provides tools to interact with the LeetCode API, enabling problem fetching, code template generation, and solution execution/submission.
    7
    1
    -
  • F
    license
    Not graded
    quality
    C
    maintenance
    An MCP server that provides structured, AI-powered guidance for LeetCode problems, including approach analysis, hints, complexity breakdowns, and optimization directions without spoiling solutions.
    4
    1
    -

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/LYCGGG/mcp-leetcode'

If you have feedback or need assistance with the MCP directory API, please join our Discord server