11# LeetCode MCP Server
22
3- 一个基于Model Context Protocol (MCP)的LeetCode服务器,使用GraphQL查询与LeetCode API交互。
3+ A Model Context Protocol (MCP) server for LeetCode that interacts with the LeetCode API using GraphQL queries.
44
5- ## 功能特点
5+ ## Features
66
7- - 支持查询LeetCode问题、用户信息和竞赛数据
8- - 通过MCP工具和资源提供结构化访问
9- - 完整的错误处理
10- - 模块化架构
7+ - Access LeetCode problems, user information, and contest data
8+ - Structured access through MCP tools and resources
9+ - Comprehensive error handling
10+ - Modular architecture
1111
12- ## 主要工具
12+ ## Available Tools
1313
14- ### 问题相关工具
15- - ` get-daily-challenge ` : 获取每日挑战
16- - ` get-problem ` : 根据slug获取问题详情
17- - ` search-problems ` : 搜索满足条件的问题
14+ ### Problem-related Tools
15+ - ` get-daily-challenge ` : Retrieve the daily challenge problem
16+ - ` get-problem ` : Get detailed information about a specific problem by its slug
17+ - ` search-problems ` : Search for problems based on difficulty, tags, and other criteria
1818
19- ### 用户相关工具
20- - ` get-user-profile ` : 获取用户资料
21- - ` get-user-submissions ` : 获取用户提交记录
22- - ` get-user-contest-ranking ` : 获取用户竞赛排名
19+ ### User-related Tools
20+ - ` get-user-profile ` : Retrieve profile information for a LeetCode user
21+ - ` get-user-submissions ` : Get submission history for a user
22+ - ` get-user-contest-ranking ` : Retrieve contest ranking information for a user
2323
24- ### 竞赛相关工具
25- - ` get-contest-details ` : 获取竞赛详情
24+ ### Contest-related Tools
25+ - ` get-contest-details ` : Get information about a specific contest
26+ - ` get-user-contest-ranking ` : Retrieve a user's performance in contests
2627
27- ## 资源
28+ ## Resources
2829
29- ### 问题资源
30- - ` leetcode://daily-challenge ` : 每日挑战
31- - ` leetcode://problem/{titleSlug} ` : 问题详情
32- - ` leetcode://problems{?tags,difficulty,limit,skip} ` : 问题列表
30+ ### Problem Resources
31+ - ` leetcode://daily-challenge ` : Current daily challenge problem
32+ - ` leetcode://problem/{titleSlug} ` : Detailed information about a specific problem
33+ - ` leetcode://problems{?tags,difficulty,limit,skip} ` : List of problems matching query parameters
3334
34- ### 用户资源
35- - ` leetcode://user/{username}/profile ` : 用户资料
36- - ` leetcode://user/{username}/submissions{?limit} ` : 用户提交
37- - ` leetcode://user/{username}/contest-ranking ` : 用户竞赛排名
35+ ### User Resources
36+ - ` leetcode://user/{username}/profile ` : User profile information
37+ - ` leetcode://user/{username}/submissions{?limit} ` : User's submission history
38+ - ` leetcode://user/{username}/contest-ranking ` : User's contest ranking data
3839
39- ## 快速开始
40+ ## Usage Examples
4041
41- ### 安装依赖
42+ ### Problem Search
43+
44+ ```
45+ What are the top 5 easy array problems on LeetCode?
46+ ```
47+
48+ This will use the ` search-problems ` tool with parameters for difficulty level "EASY" and the "array" tag.
49+
50+ ### Problem Details
51+
52+ ```
53+ Show me details of the "two-sum" problem on LeetCode.
54+ ```
55+
56+ This will use the ` get-problem ` tool with the titleSlug "two-sum" to retrieve comprehensive information about the problem.
57+
58+ ### User Profile
59+
60+ ```
61+ What is the LeetCode profile information for user "username123"?
62+ ```
63+
64+ This will use the ` get-user-profile ` tool to retrieve statistics and profile data for the specified user.
65+
66+ ### Daily Challenge
67+
68+ ```
69+ What is today's LeetCode daily challenge?
70+ ```
71+
72+ This will use the ` get-daily-challenge ` tool to retrieve the current day's challenge problem.
73+
74+ ## Quick Start
75+
76+ ### Install Dependencies
4277``` bash
4378npm install
4479```
4580
46- ### 构建项目
81+ ### Build the Project
4782``` bash
4883npm run build
4984```
5085
51- ### 运行服务器
86+ ### Run the Server
5287``` bash
5388npm start
5489```
5590
56- ### 开发模式
91+ ### Development Mode
5792``` bash
5893npm run dev
5994```
6095
61- ## 使用说明
96+ ## Integration Guide
6297
63- 使用Claude for Desktop或其他MCP兼容的客户端连接到此服务器。
98+ Connect to this server using Claude for Desktop or other MCP-compatible clients.
6499
65- ### 配置示例( Claude for Desktop)
100+ ### Configuration Example ( Claude for Desktop)
66101
67- 在Claude for Desktop的 ` claude_desktop_config.json ` 文件中添加:
102+ Add the following to your Claude for Desktop ` claude_desktop_config.json ` file:
68103
69104``` json
70105{
@@ -77,6 +112,16 @@ npm run dev
77112}
78113```
79114
80- ## 参考
81- - 这个项目受到[ alfa-leetcode-api] ( https://github.com/alfaarghya/alfa-leetcode-api ) 的启发
82- - 使用[ Model Context Protocol] ( https://modelcontextprotocol.io ) 规范实现
115+ ## Clean Installation
116+
117+ For a fresh setup, you can use the provided script:
118+
119+ ``` bash
120+ ./clean-install.sh
121+ ```
122+
123+ This script will remove existing node_modules and dist directories, install dependencies, and build the project.
124+
125+ ## References
126+ - Inspired by [ alfa-leetcode-api] ( https://github.com/alfaarghya/alfa-leetcode-api )
127+ - Implemented using the [ Model Context Protocol] ( https://modelcontextprotocol.io ) specification
0 commit comments