mcp-server-leetcode
A Model Context Protocol (MCP) server for LeetCode that provides access to problems, user data, and contest information through GraphQL
Documentation
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-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 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
Frequently asked questions
What is mcp-server-leetcode?
mcp-server-leetcode is A Model Context Protocol (MCP) server for LeetCode that provides access to problems, user data, and contest information through GraphQL
How do I install mcp-server-leetcode?
Open the GitHub repository and follow its README. Most MCP servers are added to your client's MCP config, then called by your agent.
Is mcp-server-leetcode open source?
Yes โ it is hosted on GitHub at https://github.com/doggybee/mcp-server-leetcode and has 32 stars.
Related MCP tools
๐ Cherry Studio is a desktop client that supports for multiple LLM providers. Built for the Model Context Protocol to enhance AI capabilities.
Enhanced ChatGPT Clone: Features Agents, MCP, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini...
FastGPT is a knowledge-based platform built on the LLMs, offers a comprehensive suite of out-of-the-box capabilities such as data processing, RAG retrieval, ...
Composio equips your AI agents & LLMs with 100+ high-quality integrations via function calling for the Model Context Protocol. Enhance AI assistants with powerf
๐ฆ Repomix is a powerful tool that packs your entire repository into a single, AI-friendly file. Perfect for when you need to feed your codebase to Large Lan...
AI Agents & MCPs & AI Workflow Automation โข (~400 MCP servers for AI agents) โข AI Automation / AI Agent with MCPs โข AI Workflows & AI Agents โข MCPs for AI Ag...
Run your own MCP server? See who uses it and what to fix.
Measure it with TrackMCP