Skip to content

Commit ff6cf11

Browse files
committed
docs: update the README
1 parent 7b4b0f5 commit ff6cf11

File tree

2 files changed

+71
-26
lines changed

2 files changed

+71
-26
lines changed

README.md

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,29 @@ npm run build && node build/index.js --site global
6565

6666
### Visual Studio Code Integration
6767

68-
Add the following JSON configuration to your User Settings (JSON) file Code. Access this by pressing `Ctrl/Cmd + Shift + P` and searching for `Preferences: Open User Settings (JSON)`.
68+
Add the following JSON configuration to your User Settings (JSON) file. Access this by pressing `Ctrl/Cmd + Shift + P` and searching for `Preferences: Open User Settings (JSON)`.
69+
70+
#### Option 1: Using Environment Variables
71+
72+
```json
73+
{
74+
"mcp": {
75+
"servers": {
76+
"leetcode": {
77+
"type": "stdio",
78+
"command": "npx",
79+
"args": ["-y", "@jinzcdev/leetcode-mcp-server"],
80+
"env": {
81+
"LEETCODE_SITE": "global",
82+
"LEETCODE_SESSION": "<YOUR_LEETCODE_SESSION_COOKIE>"
83+
}
84+
}
85+
}
86+
}
87+
}
88+
```
89+
90+
#### Option 2: Using Command Line Arguments
6991

7092
```json
7193
{
@@ -90,18 +112,18 @@ Add the following JSON configuration to your User Settings (JSON) file Code. Acc
90112

91113
For LeetCode China site, modify the `--site` parameter to `cn`.
92114

93-
## Environment Variables
94-
95-
The server supports the following environment variables:
96-
97-
- `LEETCODE_SITE`: LeetCode API endpoint ('global' or 'cn')
98-
- `LEETCODE_SESSION`: LeetCode session cookie for authenticated API access
99-
100-
**Priority Note**:
101-
Command-line arguments take precedence over environment variables when both are specified. For example:
102-
103-
- If `LEETCODE_SITE=cn` is set but you run `leetcode-mcp-server --site global`, the server will use `global`.
104-
- If `LEETCODE_SESSION` exists but you provide `--session "new_cookie"`, the command-line session value will be used.
115+
> [!TIP]
116+
>
117+
> The server supports the following environment variables:
118+
>
119+
> - `LEETCODE_SITE`: LeetCode API endpoint ('global' or 'cn')
120+
> - `LEETCODE_SESSION`: LeetCode session cookie for authenticated API access
121+
>
122+
> **Priority Note**:
123+
> Command-line arguments take precedence over environment variables when both are specified. For example:
124+
>
125+
> - If `LEETCODE_SITE=cn` is set but you run `leetcode-mcp-server --site global`, the server will use `global`.
126+
> - If `LEETCODE_SESSION` exists but you provide `--session "new_cookie"`, the command-line session value will be used.
105127
106128
## Available Tools
107129

README_zh-CN.md

Lines changed: 36 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,29 @@ npm run build && node build/index.js --site global
6565

6666
### Visual Studio Code 集成
6767

68-
在您的用户设置 (JSON) 文件中添加以下 JSON 配置。通过按 `Ctrl/Cmd + Shift + P` 并搜索 `Preferences: Open User Settings (JSON)` 来访问此文件。
68+
在您的用户设置 (JSON) 文件中添加以下配置。通过按 `Ctrl/Cmd + Shift + P` 并搜索 `Preferences: Open User Settings (JSON)` 来访问此文件。
69+
70+
#### 方式一:使用环境变量
71+
72+
```json
73+
{
74+
"mcp": {
75+
"servers": {
76+
"leetcode": {
77+
"type": "stdio",
78+
"command": "npx",
79+
"args": ["-y", "@jinzcdev/leetcode-mcp-server"],
80+
"env": {
81+
"LEETCODE_SITE": "global",
82+
"LEETCODE_SESSION": "<您的 LEETCODE 会话 COOKIE>"
83+
}
84+
}
85+
}
86+
}
87+
}
88+
```
89+
90+
#### 方式二:使用命令行参数
6991

7092
```json
7193
{
@@ -90,18 +112,19 @@ npm run build && node build/index.js --site global
90112

91113
对于 LeetCode 中国站点,请将 `--site` 参数修改为 `cn`
92114

93-
## 环境变量
94-
95-
服务器支持以下环境变量:
96-
97-
- `LEETCODE_SITE`:LeetCode API 端点('global' 或 'cn')
98-
- `LEETCODE_SESSION`:用于授权 API 访问的 LeetCode 会话 cookie
99-
100-
**优先级说明**
101-
当同时指定命令行参数和环境变量时,命令行参数优先。例如:
102-
103-
- 如果设置了 `LEETCODE_SITE=cn` 但您运行 `leetcode-mcp-server --site global`,服务器将使用 `global`
104-
- 如果存在 `LEETCODE_SESSION` 但您提供了 `--session "new_cookie"`,将使用命令行中的会话值。
115+
> [!TIP]
116+
>
117+
> 服务支持以下环境变量:
118+
>
119+
> - `LEETCODE_SITE`:LeetCode API 端点('global' 或 'cn')
120+
> - `LEETCODE_SESSION`:用于授权 API 访问的 LeetCode 会话 cookie
121+
>
122+
> **优先级说明**
123+
>
124+
> 当同时指定命令行参数和环境变量时,命令行参数优先。例如:
125+
>
126+
> - 如果设置了 `LEETCODE_SITE=cn` 但您运行 `leetcode-mcp-server --site global`,服务器将使用 `global`
127+
> - 如果存在 `LEETCODE_SESSION` 但您提供了 `--session "new_cookie"`,将使用命令行中的参数值。
105128
106129
## 可用工具
107130

0 commit comments

Comments
 (0)