mcpField
M
MCP Server LeetCode

MCP Server LeetCode

Local
github.com/doggybeeDeveloper Tools44Updated 82w ago

About MCP Server LeetCode

MCP Server LeetCode is an MCP server that gives AI assistants access to LeetCode problems, user profiles and contest data through GraphQL. It suits developers who want to query LeetCode information from an AI client, and it can also be used as a CLI or a JavaScript library.

Key features

  1. 01Problem details and daily challenge lookup
  2. 02Problem search by tags and difficulty
  3. 03User profile and submission history queries
  4. 04Contest details and user contest rankings
  5. 05Both command line and programmable API

Use cases

  1. 01Finding problems that match given tags or difficulty
  2. 02Reviewing a user's submission history or contest ranking
  3. 03Calling LeetCode data from scripts or applications

MCP support

The project runs as an MCP server that exposes LeetCode tools such as get-problem and search-problems, and resources such as leetcode://daily-challenge, to MCP clients.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"leetcode": {
"command": "npx",
"args": [
"-y",
"@mcpfun/mcp-server-leetcode"
]
}
}
}
Run commandnpx -y @mcpfun/mcp-server-leetcode

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npm@mcpfun/mcp-server-leetcode

Tools

7

Saved tool list · updated 3w ago

This tool takes no parameters.

Details

From the project README

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 NameDescriptionParameters
get-daily-challengeGet the daily challengeNone
get-problemGet details for a specific problemtitleSlug (string)
search-problemsSearch for problems based on criteriatags (optional), difficulty (optional), limit (default 20), skip (default 0)
User-related Tools
Tool NameDescriptionParameters
get-user-profileGet user informationusername (string)
get-user-submissionsGet user submission historyusername (string), limit (optional, default 20)
get-user-contest-rankingGet user contest rankingsusername (string)
Contest-related Tools
Tool NameDescriptionParameters
get-contest-detailsGet contest detailscontestSlug (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

Acknowledgements

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.