mcp-server-leetcode
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 claudeGlobal Installation
npm install -g @mcpfun/mcp-server-leetcodeOnce installed, you can run it directly from the command line:
mcp-server-leetcodeLocal Installation
npm install @mcpfun/mcp-server-leetcodeUsage
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 the daily challenge | None |
| Get details for a specific problem |
|
| Search for problems based on criteria |
|
User-related Tools
Tool Name | Description | Parameters |
| Get user information |
|
| Get user submission history |
|
| Get user contest rankings |
|
Contest-related Tools
Tool Name | Description | Parameters |
| Get contest details |
|
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 installRun in development mode:
npm run devBuild the project:
npm run buildLicense
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
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/doggybee/mcp-server-leetcode'
If you have feedback or need assistance with the MCP directory API, please join our Discord server