Skip to content

Commit b5e9e8c

Browse files
committed
Add clean-install script and update README
1 parent ebadfd7 commit b5e9e8c

File tree

2 files changed

+95
-1
lines changed

2 files changed

+95
-1
lines changed

README.md

Lines changed: 80 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,82 @@
11
# LeetCode MCP Server
22

3-
A Model Context Protocol (MCP) server for LeetCode that provides access to problems, user data, and contest information through GraphQL.
3+
一个基于Model Context Protocol (MCP)的LeetCode服务器,使用GraphQL查询与LeetCode API交互。
4+
5+
## 功能特点
6+
7+
- 支持查询LeetCode问题、用户信息和竞赛数据
8+
- 通过MCP工具和资源提供结构化访问
9+
- 完整的错误处理
10+
- 模块化架构
11+
12+
## 主要工具
13+
14+
### 问题相关工具
15+
- `get-daily-challenge`: 获取每日挑战
16+
- `get-problem`: 根据slug获取问题详情
17+
- `search-problems`: 搜索满足条件的问题
18+
19+
### 用户相关工具
20+
- `get-user-profile`: 获取用户资料
21+
- `get-user-submissions`: 获取用户提交记录
22+
- `get-user-contest-ranking`: 获取用户竞赛排名
23+
24+
### 竞赛相关工具
25+
- `get-contest-details`: 获取竞赛详情
26+
27+
## 资源
28+
29+
### 问题资源
30+
- `leetcode://daily-challenge`: 每日挑战
31+
- `leetcode://problem/{titleSlug}`: 问题详情
32+
- `leetcode://problems{?tags,difficulty,limit,skip}`: 问题列表
33+
34+
### 用户资源
35+
- `leetcode://user/{username}/profile`: 用户资料
36+
- `leetcode://user/{username}/submissions{?limit}`: 用户提交
37+
- `leetcode://user/{username}/contest-ranking`: 用户竞赛排名
38+
39+
## 快速开始
40+
41+
### 安装依赖
42+
```bash
43+
npm install
44+
```
45+
46+
### 构建项目
47+
```bash
48+
npm run build
49+
```
50+
51+
### 运行服务器
52+
```bash
53+
npm start
54+
```
55+
56+
### 开发模式
57+
```bash
58+
npm run dev
59+
```
60+
61+
## 使用说明
62+
63+
使用Claude for Desktop或其他MCP兼容的客户端连接到此服务器。
64+
65+
### 配置示例(Claude for Desktop)
66+
67+
在Claude for Desktop的`claude_desktop_config.json`文件中添加:
68+
69+
```json
70+
{
71+
"mcpServers": {
72+
"leetcode": {
73+
"command": "node",
74+
"args": ["/path/to/leetcode-mcp-server/dist/index.js"]
75+
}
76+
}
77+
}
78+
```
79+
80+
## 参考
81+
- 这个项目受到[alfa-leetcode-api](https://github.com/alfaarghya/alfa-leetcode-api)的启发
82+
- 使用[Model Context Protocol](https://modelcontextprotocol.io)规范实现

clean-install.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
3+
# 删除node_modules和package-lock.json
4+
echo "正在清理旧依赖..."
5+
rm -rf node_modules package-lock.json
6+
7+
# 清理npm缓存
8+
echo "清理npm缓存..."
9+
npm cache clean --force
10+
11+
# 重新安装依赖
12+
echo "重新安装依赖..."
13+
npm install
14+
15+
echo "依赖安装完成!"

0 commit comments

Comments
 (0)