Access LeetCode Data via MCP
Query LeetCode problems, daily challenges, user profiles, submissions, and contest rankings directly from an AI assistant.
Maintainer of this project? Claim this page to edit the listing.
1.0.0Add to Favorites
Why it matters
Integrate AI assistants with LeetCode to access problems, user data, and competition information. Enables programmatic interaction with LeetCode's platform.
Outcomes
What it gets done
Fetch daily LeetCode challenges.
Retrieve specific problem details and search for problems.
Access user profiles, submission history, and contest rankings.
Query competition details.
Install
Add it to your toolbox
Run in your project directory:
curl -fsSL https://spark.entire.vc/get/vb-mcp-server-leetcode | bash Capabilities
Tools your agent gets
Get the daily challenge problem from LeetCode
Get details of a specific LeetCode problem
Search LeetCode problems by criteria
Get user profile information from LeetCode
Get user submission history from LeetCode
Get user's competition ratings and rankings
Get competition details from LeetCode
Overview
mcp-server-leetcode MCP Server
mcp-server-leetcode gives AI assistants access to LeetCode's problem catalog, daily challenges, user profiles, submissions, and contest rankings through MCP tools, resources, and a JavaScript library API. Use it when an AI assistant needs to look up public LeetCode problem, user, or contest data. Not applicable for submitting solutions or accessing private account data.
What it does
mcp-server-leetcode (currently versioned 1.0.1) is an MCP server that gives AI assistants access to LeetCode's problem catalog, user profiles, submission history, and contest data, described by its own README as providing fast access to the LeetCode API with full support for MCP tools and resources. It exposes both MCP tools/resources and a programmable JavaScript API (LeetCodeService) for the same functionality, so it can be embedded directly in a Node.js application instead of only being driven through an MCP client.
When to use - and when NOT to
Use it when you want an AI assistant to fetch the daily LeetCode challenge, search problems by tag or difficulty, look up a specific problem's details, check a user's public profile or submission history, or pull contest rankings and details. Do not use it for actions LeetCode itself doesn't expose publicly, like submitting solutions or accessing private account data - this server only reads publicly available problem, user, and contest information.
Capabilities
Problem tools: get-daily-challenge (no parameters), get-problem (by titleSlug), search-problems (filter by tags, difficulty, with limit/skip pagination).
User tools: get-user-profile (by username), get-user-submissions (by username, with a limit), get-user-contest-ranking (by username).
Contest tools: get-contest-details (by contestSlug).
It also exposes MCP resources directly: leetcode://daily-challenge, leetcode://problem/{titleSlug}, leetcode://problems{?tags,difficulty,limit,skip}, leetcode://user/{username}/profile, leetcode://user/{username}/submissions{?limit}, and leetcode://user/{username}/contest-ranking.
As a library, it can be used programmatically:
import { LeetCodeService } from '@mcpfun/mcp-server-leetcode';
const leetcodeService = new LeetCodeService();
const dailyChallenge = await leetcodeService.getDailyChallenge();
const problems = await leetcodeService.searchProblems({ difficulty: 'MEDIUM', tags: 'array+dynamic-programming' });
How to install
Install automatically for Claude Desktop via Smithery:
npx -y @smithery/cli install @doggybee/mcp-server-leetcode --client claude
Or install globally and run directly:
npm install -g @mcpfun/mcp-server-leetcode
mcp-server-leetcode
Then register it in claude_desktop_config.json:
{
"mcpServers": {
"leetcode": {
"command": "mcp-server-leetcode"
}
}
}
For local development, clone the repo, run npm install, and use npm run dev or npm run build, pointing the config's command/args at node /path/to/dist/index.js.
The server also supports a plain local (non-global) npm install @mcpfun/mcp-server-leetcode, useful when embedding it as a project dependency rather than a system-wide CLI tool. The project describes itself as inspired by the community alfa-leetcode-api project, and points to the Model Context Protocol specification and Claude for Desktop's MCP support as the two related projects it builds on and integrates with. It's licensed MIT.
Who it's for
Developers and competitive programmers who want an AI assistant to pull LeetCode problems, daily challenges, and user or contest stats into a conversation instead of switching to the LeetCode website.
Source README
MCP Server LeetCode
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 challengeleetcode://problem/{titleSlug}: Problem detailsleetcode://problems{?tags,difficulty,limit,skip}: Problem list
User Resources
leetcode://user/{username}/profile: User profileleetcode://user/{username}/submissions{?limit}: User submissionsleetcode://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
Related Projects
- Model Context Protocol - MCP specifications and documentation
- Claude for Desktop - AI assistant with MCP support
FAQ
Common questions
Discussion
Questions & comments ยท 0
Sign In Sign in to leave a comment.