MCP.so
登录

LeetCode MCP (Model Context Protocol)

@Kishan-N

关于 LeetCode MCP (Model Context Protocol)

MCP Server to generate Leetcode Notes

基本信息

分类

记忆与知识

运行时

python

传输方式

stdio

发布者

Kishan-N

配置

使用下面的配置,将此服务器添加到你的 MCP 客户端。

{
  "mcpServers": {
    "Leetcode_Notes_MCP": {
      "command": "python",
      "args": [
        "leetcode_mcp.py"
      ]
    }
  }
}

工具

未检测到工具

工具是从 README 中自动提取的。维护者可以在 ## Tools 标题下列出工具,即可填充这部分内容。

概览

What is LeetCode MCP?

LeetCode MCP is a Python-based tool that fetches LeetCode problem descriptions and produces detailed explanations of multiple solution approaches. It is designed for developers preparing for coding interviews who want to understand both the intuition and complexity behind different solutions.

How to use LeetCode MCP?

Clone the repository, install dependencies with pip install -r requirements.txt, and add your OpenAI API key to config.json. Then run python leetcode_mcp.py and enter the LeetCode problem name (e.g., valid-sudoku) when prompted. The tool returns a markdown-formatted analysis.

Key features of LeetCode MCP

  • Fetches problem descriptions directly from LeetCode
  • Extracts examples and constraints from the problem page
  • Provides multiple solution approaches per problem
  • Includes intuition, complexity analysis, and implementation details
  • Generates step-by-step explanations for each solution
  • Outputs everything in a clean markdown format

Use cases of LeetCode MCP

  • Quickly grasp multiple ways to solve a specific LeetCode problem
  • Understand time and space complexity trade-offs before implementing
  • Get a structured breakdown of solutions for interview preparation
  • Learn step-by-step reasoning behind optimal and alternative algorithms

FAQ from LeetCode MCP

What API key is required?

An OpenAI API key must be set in the config.json file under the key OPENAI_API_KEY. The tool uses it to generate solution explanations.

Does LeetCode MCP scrape LeetCode?

Yes, it fetches problem data from LeetCode’s public pages. Users should respect LeetCode’s terms of service and avoid excessive requests.

How do I run the tool after installation?

Run python leetcode_mcp.py from the project directory. You will be prompted to enter the name of the LeetCode problem (e.g., two-sum).

What output format does the tool produce?

The tool outputs a markdown document containing the problem title, difficulty, description, examples, constraints, and multiple solution approaches with intuition, complexity, and implementation details.

评论

记忆与知识 分类下的更多 MCP 服务器