LeetCode

by doggybee

10 stars
Not rated
GitHub

About

Provides structured access to LeetCode's problem database, user profiles, and contest information through GraphQL queries for exploring challenges, tracking progress, and analyzing performance.

Details

Author
doggybee
Repository
doggybee/mcp-server-leetcode
GitHub stars
10
License
MIT License
Categories
Developer Tools, Other, Design, File Management, AI, Search, Knowledge Base, Database
Tags
#visualization

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

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name LeetCode
    Command (node, npx, python, etc.) node
    Arguments
    • Argument 1 /path/to/dist/index.js

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

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

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

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

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

get-daily-challenge

Get the daily challenge. Parameters: None

get-problem

Get details for a specific problem. Parameters: titleSlug (string)

search-problems

Search for problems based on criteria. Parameters: tags (optional), difficulty (optional), limit (default 20), skip (default 0)

get-user-profile

Get user information. Parameters: username (string)

get-user-submissions

Get user submission history. Parameters: username (string), limit (optional, default 20)

get-user-contest-ranking

Get user contest rankings. Parameters: username (string)

get-contest-details

Get contest details. Parameters: contestSlug (string)

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "leetcode": {
            "cwd": "string",
            "env": {},
            "args": [
                "/path/to/dist/index.js"
            ],
            "shell": false,
            "command": "node"
        }
    }
}

Linux

{
    "cwd": "string",
    "env": [],
    "args": [
        "/path/to/dist/index.js"
    ],
    "shell": false,
    "command": "node"
}

Macos

{
    "cwd": "string",
    "env": [],
    "args": [
        "/path/to/dist/index.js"
    ],
    "shell": false,
    "command": "node"
}

Windows

{
    "env": [],
    "args": [
        "/c",
        "mcp-server-leetcode"
    ],
    "command": "cmd"
}

MCP Server LeetCode

npm version
GitHub license
Version
smithery badge

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

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

Problem-related 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) |

User-related Tools

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

Contest-related Tools

| 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

Related Projects

- Model Context Protocol - MCP specifications and documentation
- Claude for Desktop - AI assistant with MCP support

Acknowledgements

- This project was inspired by alfa-leetcode-api

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.