Skip to main content
Glama

MCP Server LeetCode

npm version GitHub license Version

A Model Context Protocol (MCP) server for LeetCode that enables AI assistants to access LeetCode problems, user information, and contest data.

Features

  • 🚀 Fast access to LeetCode API

  • 🔍 Search problems, retrieve daily challenges, and check user profiles

  • 🏆 Query contest data and rankings

  • 🧩 Full support for MCP tools and resources

  • 📦 Provides both CLI and programmable API

Related MCP server: LeetCode MCP Server

Installation

Installing via Smithery

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

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

Global Installation

npm install -g @mcpfun/mcp-server-leetcode

Once installed, you can run it directly from the command line:

mcp-server-leetcode

Local Installation

npm install @mcpfun/mcp-server-leetcode

Usage

Integration with Claude for Desktop

Add the following to your Claude for Desktop claude_desktop_config.json file:

{
  "mcpServers": {
    "leetcode": {
      "command": "mcp-server-leetcode"
    }
  }
}

For local development:

{
  "mcpServers": {
    "leetcode": {
      "command": "node",
      "args": ["/path/to/dist/index.js"]
    }
  }
}

Use as a Library

import { LeetCodeService } from '@mcpfun/mcp-server-leetcode';

// Initialize the service
const leetcodeService = new LeetCodeService();

// Get daily challenge
const dailyChallenge = await leetcodeService.getDailyChallenge();

// Search problems
const problems = await leetcodeService.searchProblems({
  difficulty: 'MEDIUM',
  tags: 'array+dynamic-programming'
});

Available Tools

Tool Name

Description

Parameters

get-daily-challenge

Get the daily challenge

None

get-problem

Get details for a specific problem

titleSlug (string)

search-problems

Search for problems based on criteria

tags (optional), difficulty (optional), limit (default 20), skip (default 0)

Tool Name

Description

Parameters

get-user-profile

Get user information

username (string)

get-user-submissions

Get user submission history

username (string), limit (optional, default 20)

get-user-contest-ranking

Get user contest rankings

username (string)

Tool Name

Description

Parameters

get-contest-details

Get contest details

contestSlug (string)

Available Resources

Problem Resources

  • leetcode://daily-challenge: Daily challenge

  • leetcode://problem/{titleSlug}: Problem details

  • leetcode://problems{?tags,difficulty,limit,skip}: Problem list

User Resources

  • leetcode://user/{username}/profile: User profile

  • leetcode://user/{username}/submissions{?limit}: User submissions

  • leetcode://user/{username}/contest-ranking: User contest ranking

Local Development

Clone the repository and install dependencies:

git clone https://github.com/doggybee/mcp-server-leetcode.git
cd mcp-server-leetcode
npm install

Run in development mode:

npm run dev

Build the project:

npm run build

License

MIT

Acknowledgements

Available Tools

7 tools
get-contest-detailsD

Inputs: contestSlug (required).

get-daily-challengeD

Inputs: no named parameters.

get-problemD

Inputs: titleSlug (required).

get-user-contest-rankingD

Inputs: username (required).

get-user-profileD

Inputs: username (required).

get-user-submissionsD

Inputs: username (required), limit.

search-problemsD

Inputs: tags, difficulty, limit, skip.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    C2.1/5.0

    Scored across 7 tools

    Disambiguation5/5

    Each tool has a clearly distinct purpose targeting different LeetCode resources: contests, daily challenges, problems, user rankings, profiles, submissions, and problem search. There is no overlap in functionality, making tool selection straightforward for an agent.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern using kebab-case (e.g., get-contest-details, search-problems). The naming is uniform throughout with no deviations in style or convention.

    Tool Count5/5

    With 7 tools, the server is well-scoped for a LeetCode integration, covering key areas like problem access, user data, and contests. Each tool serves a specific, necessary function without bloat.

    Completeness4/5

    The tool set provides comprehensive read-only coverage for LeetCode data, including problems, user profiles, contests, and submissions. A minor gap exists in write operations (e.g., submitting solutions or managing account settings), but core retrieval needs are fully met.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    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
      940 npm
      158
      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
      A
      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.
      6
      1
      -
    • F
      license
      Not graded
      quality
      D
      maintenance
      A 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
      -