AgentStack
Browse Sign in
Browse Why AgentStack Sell Docs
Sign in
MCP verified MIT Self-run

Leetcode Mcp Server

mcp-jinzcdev-leetcode-mcp-server · by jinzcdev

An MCP server enabling automated access to LeetCode's problems, solutions, and public data with optional authentication for user-specific features, supporting leetcode.com & leetcode.cn sites.

No reviews yet
0 installs
14 views
0.0% view→install

Install

$ agentstack add mcp-jinzcdev-leetcode-mcp-server

✓ scanned · ✓ verified, works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

View the full security report →

Verified badge

Passed review? Show it. Paste this badge into your README, it links to the public security report.

AgentStack Verified badge Links to your public security report.
[![AgentStack Verified](https://agentstack.voostack.com/badges/verified.svg)](https://agentstack.voostack.com/security/report/mcp-jinzcdev-leetcode-mcp-server)

Reliability & compatibility

Security review passed
0 installs to date
no reviews yet
4mo ago

Declared compatibility

Claude CodeClaude DesktopCursorWindsurf

Compatibility is declared by the source manifest. End-to-end runtime verification is coming, see below.

Preview Execution monitoring

We're building live execution health for every listing: tool-call success rate, median latency, uptime, and last-checked timestamps, measured, not self-reported. It isn't live yet, so we don't show numbers we can't stand behind.

How agent discovery & health will work →
Are you the author of Leetcode Mcp Server? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

LeetCode MCP Server

[](https://www.npmjs.com/package/@jinzcdev/leetcode-mcp-server) [](https://www.npmjs.com/package/@jinzcdev/leetcode-mcp-server) [](./LICENSE) [](README_zh-CN.md) [](https://github.com/jinzcdev/leetcode-mcp-server)

The LeetCode MCP Server is a Model Context Protocol (MCP) server that provides seamless integration with LeetCode APIs, enabling advanced automation and intelligent interaction with LeetCode's programming problems, contests, solutions, and user data.

Features

  • 🌐 Multi-site Support: Support​ both leetcode.com (Global) and leetcode.cn (China) platforms
  • 📊 Problem Data Retrieval: Obtain detailed problem descriptions, constraints, examples, official editorials, and ​user-submitted solutions
  • 👤 User Data Access: Retrieve user profiles, submission history, and contest performance
  • 🔒 ​Private Data Access: Create and query user notes, track problem-solving progress, and analyze submission details (AC/WA analysis)
  • 🔍 Advanced Search Capabilities: Filter problems by tags, difficulty levels, categories, and keywords
  • 📅 Daily Challenge Access: Easily access daily challenge problems

Prerequisites

  1. Node.js (v20.x or above)
  2. (Optional) LeetCode session cookie for authenticated API access

Installation

Installing via Smithery

To install leetcode-mcp-server for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install @jinzcdev/leetcode-mcp-server --client claude

Manual Installation

# Install from npm
npm install @jinzcdev/leetcode-mcp-server -g

# Or run with Global site configuration
npx -y @jinzcdev/leetcode-mcp-server --site global

# Run with authentication (for accessing private data)
npx -y @jinzcdev/leetcode-mcp-server --site global --session 

Alternatively, you can clone the repository and run it locally:

# Clone the repository
git clone https://github.com/jinzcdev/leetcode-mcp-server.git

# Navigate to the project directory
cd leetcode-mcp-server

# Build the project
npm install && npm run build

# Run the server
node build/index.js --site global

Usage

Visual Studio Code Integration

Add the following JSON configuration to your User Settings (JSON) file. Access this by pressing Ctrl/Cmd + Shift + P and searching for Preferences: Open User Settings (JSON).

Option 1: Using Environment Variables
{
  "mcp": {
    "servers": {
      "leetcode": {
        "type": "stdio",
        "command": "npx",
        "args": ["-y", "@jinzcdev/leetcode-mcp-server"],
        "env": {
          "LEETCODE_SITE": "global",
          "LEETCODE_SESSION": ""
        }
      }
    }
  }
}
Option 2: Using Command Line Arguments
{
  "mcp": {
    "servers": {
      "leetcode": {
        "type": "stdio",
        "command": "npx",
        "args": [
          "-y",
          "@jinzcdev/leetcode-mcp-server",
          "--site",
          "global",
          "--session",
          ""
        ]
      }
    }
  }
}

For LeetCode China site, modify the --site parameter to cn.

> [!TIP] > > The server supports the following optional environment variables: > > - LEETCODE_SITE: LeetCode API endpoint ('global' or 'cn', default: 'global') > - LEETCODE_SESSION: LeetCode session cookie for authenticated API access (default: empty) > > Priority Note: > Command-line arguments take precedence over environment variables when both are specified. For example: > > - If LEETCODE_SITE=cn is set but you run leetcode-mcp-server --site global, the server will use global. > - If LEETCODE_SESSION exists but you provide --session "new_cookie", the command-line session value will be used.

Available Tools

Problems

| Tool | Global | CN | Auth Required | Description | | ----------------------- | :----: | :-: | :-----------: | ------------------------------------------------------------ | | getdailychallenge | ✅ | ✅ | ❌ | Retrieves today's LeetCode Daily Challenge problem | | getproblem | ✅ | ✅ | ❌ | Retrieves details for a specific LeetCode problem | | searchproblems | ✅ | ✅ | ❌ | Searches for LeetCode problems with multiple filter criteria |

Users

| Tool | Global | CN | Auth Required | Description | | --------------------------------- | :----: | :-: | :-----------: | ------------------------------------------------------------ | | getuserprofile | ✅ | ✅ | ❌ | Retrieves profile information for a LeetCode user | | getusercontestranking | ✅ | ✅ | ❌ | Obtains contest ranking statistics for a user | | getrecentacsubmissions | ✅ | ✅ | ❌ | Retrieves a user's recent accepted submissions | | getrecentsubmissions | ✅ | ❌ | ❌ | Retrieves a user's recent submissions history | | getuserstatus | ✅ | ✅ | ✅ | Retrieves current user's current status | | getproblemsubmissionreport | ✅ | ✅ | ✅ | Provides detailed submission analysis for a specific problem | | getproblemprogress | ✅ | ✅ | ✅ | Retrieves current user's problem-solving progress | | getall_submissions | ✅ | ✅ | ✅ | Retrieves current user's submission history |

Submissions

| Tool | Global | CN | Auth Required | Description | | ------------------- | :----: | :-: | :-----------: | ------------------------------------------------------------- | | runcode | ✅ | ✅ | ✅ | Runs code for a problem and polls /check/ until finished | | submitsolution | ✅ | ✅ | ✅ | Submits code for a problem and polls /check/ until finished |

Notes

| Tool | Global | CN | Auth Required | Description | | ---------------- | :----: | :-: | :-----------: | ----------------------------------------------------- | | searchnotes | ❌ | ✅ | ✅ | Searches for user notes with filtering options | | getnote | ❌ | ✅ | ✅ | Retrieves notes for a specific problem by question ID | | createnote | ❌ | ✅ | ✅ | Creates a new note for a specific problem | | updatenote | ❌ | ✅ | ✅ | Updates an existing note with new content |

Solutions

| Tool | Global | CN | Auth Required | Description | | -------------------------- | :----: | :-: | :-----------: | -------------------------------------------------------------- | | listproblemsolutions | ✅ | ✅ | ❌ | Retrieves a list of community solutions for a specific problem | | getproblemsolution | ✅ | ✅ | ❌ | Retrieves the complete content of a specific solution |

Tool Parameters

Problems

  • getdailychallenge - Retrieves today's LeetCode Daily Challenge problem with complete details
  • No parameters required
  • get_problem - Retrieves details about a specific LeetCode problem
  • titleSlug: The URL slug/identifier of the problem (string, required)
  • search_problems - Searches for LeetCode problems based on multiple filter criteria
  • category: Problem category filter (string, optional, default: "all-code-essentials")
  • tags: List of topic tags to filter problems by (string[], optional)
  • difficulty: Problem difficulty level filter (enum: "EASY", "MEDIUM", "HARD", optional)
  • searchKeywords: Keywords to search in problem titles and descriptions (string, optional)
  • limit: Maximum number of problems to return (number, optional, default: 10)
  • offset: Number of problems to skip (number, optional)

Users

  • getuserprofile - Retrieves profile information about a LeetCode user
  • username: LeetCode username (string, required)
  • getusercontest_ranking - Retrieves a user's contest ranking information
  • username: LeetCode username (string, required)
  • attended: Whether to include only the contests the user has participated in (boolean, optional, default: true)
  • getrecentsubmissions - Retrieves a user's recent submissions on LeetCode Global
  • username: LeetCode username (string, required)
  • limit: Maximum number of submissions to return (number, optional, default: 10)
  • getrecentac_submissions - Retrieves a user's recent accepted submissions
  • username: LeetCode username (string, required)
  • limit: Maximum number of submissions to return (number, optional, default: 10)
  • getuserstatus - Retrieves the current user's status
  • No parameters required
  • getproblemsubmission_report - Retrieves detailed information about a specific submission
  • id: The numerical submission ID (number, required)
  • getproblemprogress - Retrieves the current user's problem-solving progress
  • offset: Number of questions to skip (number, optional, default: 0)
  • limit: Maximum number of questions to return (number, optional, default: 100)
  • questionStatus: Filter by question status (enum: "ATTEMPTED", "SOLVED", optional)
  • difficulty: Filter by difficulty levels (string[], optional)
  • getallsubmissions - Retrieves paginated list of user's submissions
  • limit: Maximum number of submissions to return (number, default: 20)
  • offset: Number of submissions to skip (number, default: 0)
  • questionSlug: Optional problem identifier (string, optional)
  • lang: Programming language filter (string, optional, CN only)
  • status: Submission status filter (enum: "AC", "WA", optional, CN only)
  • lastKey: Pagination token for retrieving next page (string, optional, CN only)

Submissions

  • run_code - Runs code for a specific problem and waits until finished (requires authentication)
  • titleSlug: The URL slug/identifier of the problem (string, required)
  • lang: Programming language (string enum, required)
  • typedCode: Source code to run (string, required)
  • dataInput: Custom input to run (string, optional)
  • timeoutMs: Polling timeout in milliseconds (number, optional, default: 120000)
  • pollIntervalMs: Polling interval in milliseconds (number, optional, default: 1500)
  • submit_solution - Submits code for a specific problem and waits until finished (requires authentication)
  • titleSlug: The URL slug/identifier of the problem (string, required)
  • lang: Programming language (string enum, required)
  • typedCode: Source code to submit (string, required)
  • timeoutMs: Polling timeout in milliseconds (number, optional, default: 120000)
  • pollIntervalMs: Polling interval in milliseconds (number, optional, default: 1500)

Notes

  • search_notes - Searches for user notes on LeetCode China
  • keyword: Search term to filter notes (string, optional)
  • limit: Maximum number of notes to return (number, optional, default: 10)
  • skip: Number of notes to skip (number, optional, default: 0)
  • orderBy: Sort order for returned notes (enum: "ASCENDING", "DESCENDING", optional, default: "DESCENDING")
  • get_note - Retrieves user notes for a specific LeetCode problem
  • questionId: The question ID of the LeetCode problem (string, required)
  • limit: Maximum number of notes to return (number, optional, default: 10)
  • skip: Number of notes to skip (number, optional, default: 0)
  • create_note - Creates a new note for a specific LeetCode problem
  • questionId: The question ID of the LeetCode problem (string, required)
  • content: The content of the note, supports markdown format (string, required)
  • summary: An optional short summary or title for the note (string, optional)
  • update_note - Updates an existing note with new content or summary
  • noteId: The ID of the note to update (string, required)
  • content: The new content for the note, supports markdown format (string, required)
  • summary: An optional new short summary or title for the note (string, optional)

Solutions

  • listproblemsolutions - Retrieves a list of community solutions for a specific problem
  • questionSlug: The URL slug/identifier of the problem (string, required)
  • limit: Maximum number of solutions to return (number, optional, default: 10)
  • skip: Number of solutions to skip (number, optional)
  • userInput: Search term to filter solutions (string, optional)
  • tagSlugs: Array of tag identifiers to filter solutions (string[], optional, default: [])
  • orderBy: Sorting criteria for the returned solutions
  • Global: enum: "HOT", "MOSTRECENT", "MOSTVOTES", optional, default: "HOT"
  • CN: enum: "DEFAULT", "MOSTUPVOTE", "HOT", "NEWESTTOOLDEST", "OLDESTTO_NEWEST", optional, default: "DEFAULT"
  • getproblemsolution - Retrieves the complete content of a specific solution
  • topicId: Unique topic ID of the solution (string, required, Global only)
  • slug: Unique slug/identifier of the solution (string, required, CN only)

Available Resources

| Resource Name | Global | CN | Auth Required | Description | | ---------------------- | :----: | :-: | :-----------: | ------------------------------------------------------------ | | problem-categories | ✅ | ✅ | ❌ | A list of all problem classification categories | | problem-tags | ✅ | ✅ | ❌ | A detailed collection of algorithmic and data structure tags | | problem-langs | ✅ | ✅ | ❌ | A complete list of all supported programming languages | | problem-detail | ✅ | ✅ | ❌ | Provides details about a specific problem | | problem-solution | ✅ | ✅ | ❌ | Provides the complete content of a specific solution |

Resource URIs

  • problem-categories - A list of all problem classification categories
  • URI: categories://problems/all
  • problem-tags - A detailed collection of algorithmic and data structure tags
  • URI: tags://problems/all
  • problem-langs - A complete list of all programming languages supported by LeetCode
  • URI: langs://problems/all
  • problem-detail - Provides details about a specific LeetCode problem
  • URI: problem://{titleSlug}
  • Parameters:
  • titleSlug: Problem identifier as it appears in the LeetCode URL
  • problem-solution - Provides the complete content of a specific solution
  • Global URI: solution://{topicId}
  • Parameters:
  • topicId: Unique topic ID of the solution
  • CN URI: solution://{slug}
  • Parameters:
  • slug: Unique slug/identifier of the solution

Authentication

User-specific data access requires LeetCode session authentication:

  1. Log in to LeetCode (Global or China site)
  2. Extract LEETCODE_SESSION cookie from browser developer tools
  3. Configure server with --session flag or LEETCODE_SESSION environment variable

Response Format

All tools return JSON-formatted responses with the following structure:

{
  "content": [
    {
      "type": "text",
      "text": "JSON_DATA_STRING"
    }
  ]
}

The JSON_DATA_STRING contains either the requested data or an error message for failed requests.

License

T

Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet, be the first.

Versions

  • v0.1.0 Imported from the upstream source.