Fire in da houseTop Tip:Paying $100+ per month for Perplexity, MidJourney, Runway, ChatGPT and other tools is crazy - get all your AI tools in one site starting at $15 per month with Galaxy AI Fire in da houseCheck it out free

mcp-server-leetcode

MCP.Pizza Chef: doggybee

The mcp-server-leetcode is an MCP server that exposes LeetCode's problems, user profiles, and contest information via a GraphQL API. It enables AI assistants and applications to query and retrieve detailed coding challenge data, user statistics, and contest rankings efficiently. This server supports MCP tools and resources, offering both CLI and programmable API access for seamless integration into AI workflows and developer tools.

Use This MCP server To

Search and retrieve LeetCode problems by difficulty or topic Fetch daily coding challenges for practice Access user profile data including solved problems and stats Query ongoing and past contest information and rankings Integrate LeetCode data into AI coding assistants Automate problem recommendations based on user progress Build dashboards displaying user and contest analytics

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

Acknowledgements

mcp-server-leetcode FAQ

How do I install the mcp-server-leetcode?
You can install it via npm using `npm install @mcpfun/mcp-server-leetcode` and follow the setup instructions in the GitHub README.
Does mcp-server-leetcode support real-time contest updates?
Yes, it provides access to current contest data and rankings through its GraphQL API.
Can I use mcp-server-leetcode with multiple LLM providers?
Yes, it is provider-agnostic and works with OpenAI, Claude, Gemini, and other LLMs supporting MCP.
Is there a CLI available for interacting with mcp-server-leetcode?
Yes, the server includes a CLI for quick access to LeetCode data without programming.
How does mcp-server-leetcode handle user authentication?
It supports secure authentication methods to access user-specific data while maintaining privacy and security.
Can I extend mcp-server-leetcode to add custom queries?
Yes, since it uses GraphQL, you can extend or customize queries to fit your needs.
What programming languages can I use to interact with mcp-server-leetcode?
You can use any language that supports HTTP requests to GraphQL APIs, including JavaScript, Python, and more.
Is the mcp-server-leetcode open source?
Yes, it is open source and available on GitHub under a permissive license.