level-up-mcp-server-cn 0.4.0 → 0.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CLAUDE.md CHANGED
@@ -10,7 +10,8 @@ Level-Up is a gamification MCP server that tracks XP, levels, skills, and quests
10
10
  - **Database**: Supabase (Postgres) — 45 tables, RLS enabled
11
11
  - **Transport**: stdio (default, for Claude Desktop/OpenClaw) + Streamable HTTP (Express, for remote)
12
12
  - **Security**: Critical writes (XP, levels, achievements) go through Postgres SECURITY DEFINER functions via `supabase.rpc()`. Anon key users cannot directly modify XP/level tables.
13
- - **Distribution**: npm package `level-up-mcp-server`, zero-config with hardcoded anon key fallback
13
+ - **Distribution**: npm packages `level-up-mcp-server` (English) + `level-up-mcp-server-cn` (Chinese), zero-config with hardcoded anon key fallback
14
+ - **Localization**: English (main branch, locale=en) + Chinese (zh-cn branch, locale=zh)
14
15
 
15
16
  ## File Structure
16
17
 
@@ -25,22 +26,27 @@ src/
25
26
  │ ├── supabase.ts # Supabase client (anon key hardcoded as fallback)
26
27
  │ ├── errors.ts # Error handling helpers (ok, fail, handleSupabaseError)
27
28
  │ ├── format.ts # Pagination and formatting helpers
29
+ │ ├── ownership.ts # Ownership verification (verifyOwnership helper)
30
+ │ ├── quality-gate.ts # Quality gate checks for task evidence
28
31
  │ ├── rate-limit.ts # Sliding window rate limiter (per-entity, 10min windows)
29
32
  │ └── register.ts # Tool registration helpers (toMcpResponse, logRegistered)
30
33
  └── tools/
31
34
  ├── users.ts # Section 1: 13 user tools
32
- ├── agents.ts # Section 2: 3 agent tools
35
+ ├── agents.ts # Section 2: 4 agent tools
33
36
  ├── skills.ts # Section 3: 6 skill tools
34
- ├── tasks.ts # Section 4: 7 task tools (XP awarded here via RPC)
37
+ ├── tasks.ts # Section 4: 10 task tools (XP awarded here via RPC)
35
38
  ├── ratings.ts # Section 5: 7 rating tools
36
39
  ├── quests.ts # Section 6: 12 quest tools (NOT ACTIVE YET)
37
40
  ├── metrics.ts # Section 7: 3 metrics tools
38
41
  ├── xp.ts # Section 8: 5 XP/progression tools
39
42
  ├── leaderboards.ts # Section 9: 1 leaderboard tool
40
43
  ├── leveling.ts # Section 10: 3 leveling tools
41
- ├── achievements.ts # Section 11: 1 achievement tool
44
+ ├── achievements.ts # Section 11: 2 achievement tools
42
45
  ├── admin.ts # Section 12: 5 admin tools
43
- └── system.ts # Section 13: 3 system tools (level-up check via RPC)
46
+ ├── system.ts # Section 13: 4 system tools (level-up check via RPC)
47
+ ├── bootstrap.ts # Section 14: 2 onboarding tools (setup wizard)
48
+ ├── growth-plan.ts # Section 15: 2 growth plan tools
49
+ └── dispatchers/ # 8 category dispatchers (token-efficient tool routing)
44
50
  ```
45
51
 
46
52
  ## Core Data Flow
@@ -110,37 +116,44 @@ These bypass RLS and are the ONLY way to modify XP/level data:
110
116
  4. `register_user_secure(...)` — Atomic user creation
111
117
  5. `register_agent_secure(...)` — Agent creation with owner validation
112
118
 
113
- ## Current Status (as of March 14, 2026)
119
+ ## Current Status (as of March 21, 2026)
114
120
 
115
121
  ### Working
116
122
  - All 69 MCP tools compile and register
117
- - User registration, agent creation, skill management
123
+ - User registration via `register_user_secure` RPC (with direct insert fallback)
124
+ - Agent creation via `register_agent_secure` RPC (with direct insert fallback)
118
125
  - Task lifecycle (start → update → complete → fail)
119
126
  - XP calculation via Postgres RPC (anti-cheat)
120
127
  - Level-up via Postgres RPC (uses cumulative_xp correctly)
128
+ - Agent XP — `start_task` accepts agent_id, `inferPerformerType()` correctly sets performer_type, XP splits work
129
+ - Star display — `formatRankDisplay()` returns ★/☆ string + stars_earned/stars_total in get_user_progress, get_agent_profile, check_level_up
130
+ - Achievement auto-triggers — 5 task-count achievements after complete_task, ~11 level/rank achievements after check_level_up
131
+ - Ownership verification on 21 tools via `verifyOwnership()` helper
132
+ - Admin gate on 5 admin tools via `checkAdmin()` + `LEVELUP_ADMIN_SECRET`
121
133
  - Claude Desktop integration (stdio)
122
134
  - OpenClaw tool registration (stdio)
123
- - npm published (zero-config with anon key)
135
+ - npm published: `level-up-mcp-server` (English), `level-up-mcp-server-cn` (Chinese)
124
136
  - Railway deployed (HTTP endpoint)
125
- - Test suite: vitest with 8 test files (unit, integration, security, simulation)
137
+ - Test suite: vitest with 12 test files (unit, integration, security, simulation, ownership)
138
+ - Chinese localization: zh-cn branch with xianxia agent ranks and full UI translation
126
139
 
127
- ### Known Bugs / Issues
140
+ ### Resolved Issues (were previously known bugs)
128
141
 
129
- **HIGH PRIORITY:**
130
- 1. **Agents not earning XP** When Claude tracks tasks, it may not be passing agent_id to start_task, making them user_solo instead of user_with_agent. Check: is register_agent being called first? Is the agent_id being passed to start_task? Check task_xp_awards table to see performer_type and recipients.
142
+ 1. ~~**Agents not earning XP**~~ — Fixed. `start_task` accepts `agent_id`, `inferPerformerType()` correctly determines performer_type, XP splits through RPC.
143
+ 2. ~~**Stars not displayed**~~Fixed. `formatRankDisplay()` in format.ts calculates `stars = (level - min_level) + 1`, returned by get_user_progress, get_agent_profile, check_level_up.
144
+ 3. ~~**register_user/agent direct inserts**~~ — Fixed. Both use `supabase.rpc("register_user_secure")` / `register_agent_secure` as primary path, with direct insert as fallback only if RPC fails.
145
+ 4. ~~**Achievement triggers not automated**~~ — Partially fixed. 5 task-count achievements auto-fire after complete_task, ~11 level/rank achievements auto-fire after check_level_up. Remaining ~38 achievements require manual `scan_achievements` call.
131
146
 
132
- 2. **Stars not displayed** — Tool responses return rank_letter and rank_name but don't calculate star count. Fix: add `stars = (current_level - rank_min_level) + 1` to get_user_progress, get_agent_profile, and check_level_up responses.
133
-
134
- 3. **register_user and register_agent still do direct inserts** — Not yet refactored to use register_user_secure / register_agent_secure RPC. The Postgres functions exist but the TypeScript tool handlers still use direct supabase.from().insert(). Should call supabase.rpc() instead for consistency.
147
+ ### Remaining Known Issues
135
148
 
136
149
  **MEDIUM PRIORITY:**
137
- 4. **Achievement triggers not automated** — grant_achievement RPC exists but nothing calls it automatically after task completion or level-up.
138
- 5. **Weekly bonus cron not set up** — 26 criteria in DB but no processing job.
139
- 6. **Dead code in fail_task** — Reads failConfig before calling awardTaskXp(task.id) but the RPC handles this internally.
150
+ 1. **~38 achievements not auto-triggered** — XP milestones, skill counts, integrity, profile completeness, etc. still require manual `levelup_scan_achievements` call. Could be automated by hooking into complete_task and check_level_up.
151
+ 2. **Weekly bonus cron not set up** — 26 criteria in DB but no processing job.
140
152
 
141
153
  **LOW PRIORITY:**
142
- 7. **supabase.ts comments reference service_role key** — Default is now anon key.
143
- 8. **xp_config has 58 entries vs 49 in seed doc** — 9 extra, should audit.
154
+ 3. **Dead code in fail_task** — Reads failConfig before calling awardTaskXp(task.id) but the RPC handles this internally.
155
+ 4. **supabase.ts comments reference service_role key** — Default is now anon key.
156
+ 5. **xp_config has 58 entries vs 49 in seed doc** — 9 extra, should audit.
144
157
 
145
158
  ### Unactivated Features (designed but not connected)
146
159
 
@@ -195,14 +208,20 @@ npm test # Runs all test files
195
208
  ```
196
209
 
197
210
  Test files:
198
- - `src/services/format.test.ts` — 16 tests for formatting helpers
199
- - `src/services/errors.test.ts` — 12 tests for error handling
211
+ - `src/services/format.test.ts` — 22 tests for formatting helpers (incl. star calculation)
212
+ - `src/services/errors.test.ts` — 14 tests for error handling
200
213
  - `src/services/rate-limit.test.ts` — 7 tests for sliding window rate limiter
201
214
  - `src/tools/tasks.test.ts` — 10 integration tests for task RPCs
202
215
  - `src/tools/security.test.ts` — 36 security tests (RPC whitelisting, anti-farming, input validation)
203
216
  - `src/tools/simulation.test.ts` — 28 tests simulating legitimate + attack scenarios with in-memory mock DB
204
217
  - `src/tools/timing-simulation.test.ts` — 10 tests for XP tier timing boundaries
205
218
  - `src/tools/progression-simulation.test.ts` — 6 tests analyzing level curve and farming strategies
219
+ - `src/tools/ownership-simulation.test.ts` — 36 tests for verifyOwnership/checkAdmin + attacker simulation
220
+ - `src/tools/anti-farming-simulation.test.ts` — 37 tests for gaming resistance across anti-abuse layers
221
+ - `src/tools/v022-user-simulation.test.ts` — User journey simulation tests
222
+ - `src/tools/v022-profiles-simulation.test.ts` — Profile visibility simulation tests
223
+ - `src/tools/v030-simulation.test.ts` — v0.3 feature simulation tests
224
+ - `src/tools/v032-bugfix-simulation.test.ts` — Bugfix regression tests
206
225
 
207
226
  Note: Uses `pool: "forks"` in vitest.config.ts (threads pool causes module isolation crashes on Windows/OneDrive). The `pretest` script clears `.vite` cache to prevent corruption.
208
227
 
package/README.md CHANGED
@@ -1,198 +1,262 @@
1
- # 升级 MCP 服务器(中文版)
2
-
3
- 一个游戏化MCP服务器,为人类和AI智能体追踪经验值、等级、技能和任务。训练您的智能体,安装新技能,增强工作流程,优化输出表现。让它们不断升级!
4
-
5
- ## 功能介绍
6
-
7
- 升级追踪您和您的AI智能体完成的高效工作,奖励经验值、提升技能等级并解锁成就。
8
-
9
- - **用户** 拥有主等级 + 3个职业等级(训练师、指挥官、搭档)
10
- - **智能体** 拥有等级、技能熟练度(0-10)和诚信分数
11
- - **任务** 根据类型、难度、输出质量和完成度获得经验值
12
- - **成就** 达到里程碑时解锁(8个类别共54个成就)
13
- - **段位系统** 从E(分析师/练器境)到S(至尊/人工大能),含星级进度
14
-
15
- ## 快速开始
16
-
17
- ### 1. 安装
18
-
19
- 无需配置 — 只需将升级添加到您的MCP客户端即可使用。服务器会自动连接到共享的升级数据库。
20
-
21
- ### 2. 连接到 Claude Desktop
22
-
23
- 将以下内容添加到您的 Claude Desktop 配置文件中:
24
-
25
- **Windows(Microsoft Store 版本):**
26
- `%LOCALAPPDATA%\Packages\Claude_pzs8sxrjxfjjc\LocalCache\Roaming\Claude\claude_desktop_config.json`
27
-
28
- **Windows(直接安装版本):**
29
- `%APPDATA%\Claude\claude_desktop_config.json`
30
-
31
- **macOS:**
32
- `~/Library/Application Support/Claude/claude_desktop_config.json`
33
-
34
- ```json
35
- {
36
- "mcpServers": {
37
- "level-up-cn": {
38
- "command": "npx",
39
- "args": ["-y", "level-up-mcp-server-cn"]
40
- }
41
- }
42
- }
43
- ```
44
-
45
- 保存后重启 Claude Desktop。
46
-
47
- ### 2b. 自动识别(可选)
48
-
49
- 注册后,将您的用户和智能体ID添加到配置中,这样 升级在每次新对话中都能自动识别您:
50
-
51
- ```json
52
- {
53
- "mcpServers": {
54
- "level-up-cn": {
55
- "command": "npx",
56
- "args": ["-y", "level-up-mcp-server-cn"],
57
- "env": {
58
- "LEVELUP_USER_ID": "<您的用户UUID>",
59
- "LEVELUP_AGENT_ID": "<您的智能体UUID>"
60
- }
61
- }
62
- }
63
- }
64
- ```
65
-
66
- 要查找您的ID,请问Claude:*"我在升级上是谁?"* 或 *"列出我的智能体"*。
67
-
68
- ### 3. 连接到 OpenClaw
69
-
70
- 在 `~/.openclaw/openclaw.json` 的 `mcpServers` 下添加:
71
-
72
- ```json
73
- {
74
- "mcpServers": {
75
- "level-up-cn": {
76
- "command": "npx",
77
- "args": ["-y", "level-up-mcp-server-cn"]
78
- }
79
- }
80
- }
81
- ```
82
-
83
- 然后重启:`openclaw gateway restart`
84
-
85
- ### 4. 添加系统提示词
86
-
87
- 将以下内容添加到您的智能体系统提示词或 Claude Desktop 自定义指令中,以实现自动任务追踪:
88
-
89
- ```
90
- 你已安装 升级游戏化工具。请主动使用它们:
91
-
92
- 1. 识别身份:在首次交互时,调用 levelup_whoami(无需参数)
93
- 自动识别用户及其智能体。如未找到,则提供注册服务。
94
-
95
- 2. 追踪工作:当用户要求你完成有意义的工作(编码、研究、
96
- 写作、分析 — 任何产生交付物的工作)时,静默执行:
97
- - 调用 levelup_infer_task_type 对工作进行分类
98
- - 开始工作时调用 levelup_start_task
99
- - 交付结果时调用 levelup_complete_task
100
- 不要追踪闲聊、问候或简单查询。
101
-
102
- 3. 评估:完成任务后,调用 levelup_submit_agent_evaluation
103
- 进行诚实的自我评估。您的诚信分数取决于评估的一致性。
104
-
105
- 4. 升级:奖励经验值后,调用 levelup_check_level_up 以执行
106
- 待处理的等级提升。
107
-
108
- 5. 状态:当用户询问进度、经验值、等级或成就时,
109
- 使用相应的 升级工具展示其数据。
110
-
111
- 保持透明 — 如果用户询问你在追踪什么,请解释 升级系统。
112
- 绝不虚报经验值或夸大任务难度。
113
- ```
114
-
115
- ### 5. 试一试
116
-
117
- 连接后,直接问Claude:
118
-
119
- ```
120
- 帮我注册升级。我的名字是[你的名字]。
121
- ```
122
-
123
- 然后做一些实际工作,看着你的经验值增长!
124
-
125
- ## 运行模式
126
-
127
- ### stdio(默认 — 用于 Claude Desktop / OpenClaw)
128
- ```bash
129
- npx level-up-mcp-server-cn
130
- ```
131
-
132
- ### HTTP(用于远程访问/测试)
133
- ```bash
134
- TRANSPORT=http PORT=3000 npx level-up-mcp-server-cn
135
- ```
136
-
137
- 健康检查:`GET /health`
138
- MCP 接口:`POST /mcp`
139
-
140
- ## 72个工具,14个模块
141
-
142
- | # | 模块 | 工具数 | 说明 |
143
- |---|------|--------|------|
144
- | 1 | 用户 | 13 | 注册、资料、身份关联、引导设置 |
145
- | 2 | 智能体 | 3 | 注册智能体、资料、列表 |
146
- | 3 | 技能 | 6 | 添加/列出技能、熟练度追踪 |
147
- | 4 | 任务 | 7 | 开始、更新、完成、失败任务(标准级以上需要证据) |
148
- | 5 | 评分 | 7 | 质量评估、期望记录、校准 |
149
- | 6 | 任务链 | 12 | 每周奖励、任务链、社区任务链 |
150
- | 7 | 指标 | 3 | 平台指标导入 |
151
- | 8 | 经验值与进度 | 5 | 经验值历史、摘要、预测 |
152
- | 9 | 排行榜 | 1 | 按经验值、等级、技能排名 |
153
- | 10 | 等级 | 3 | 等级信息、要求、下一个解锁 |
154
- | 11 | 成就 | 1 | 8个类别共54个成就 |
155
- | 12 | 管理 | 5 | 创建任务类型、技能、分配规则 |
156
- | 13 | 系统 | 4 | 处理指标、快照、升级检查、身份识别 |
157
- | 14 | 成长计划 | 2 | 成长计划、浏览推荐技能组 |
158
-
159
- ## 经验值系统
160
-
161
- ```
162
- 总经验值 = 基础经验值 x 难度(1-7) x 输出类型 x 完成度
163
- + 速度奖励 + 连续奖励 + 首次奖励 + 质量奖励
164
- ```
165
-
166
- **输出倍率:** 对话型(1.0x) > 交付物(1.75x) > 已部署(2.5x)
167
-
168
- **经验值分配**(user_with_agent):智能体 60%,用户 40%
169
-
170
- **每条路线30级**,段位 E > D > C > B > A > S,含星级进度
171
-
172
- ## 安全性
173
-
174
- 经验值奖励和升级通过 Postgres SECURITY DEFINER 函数在服务端验证。MCP 服务器无法虚增经验值 — 所有计算都在数据库中使用经过验证的任务数据和配置进行。
175
-
176
- ## 技术栈
177
-
178
- - **语言:** TypeScript
179
- - **MCP SDK:** @modelcontextprotocol/sdk v1.x
180
- - **数据库:** Supabase (Postgres) — 45张表
181
- - **传输方式:** stdio + Streamable HTTP
182
- - **数据验证:** Zod
183
- - **安全:** Postgres RPC 函数(SECURITY DEFINER)
184
-
185
- ## 高级:自定义数据库
186
-
187
- 如果您想运行自己的 升级实例,请设置以下环境变量:
188
-
189
- | 变量 | 说明 |
190
- |------|------|
191
- | `SUPABASE_URL` | 您的 Supabase 项目 URL |
192
- | `SUPABASE_SERVICE_KEY` | 您的 Supabase service_role 密钥 |
193
- | `TRANSPORT` | `stdio`(默认)或 `http` |
194
- | `PORT` | HTTP 端口(默认:3000) |
195
-
196
- ## 许可证
197
-
198
- 免费使用、修改和部署。不得提供竞争性的游戏化即服务产品。2030年3月13日转为 Apache 2.0。详见 LICENSE 文件。
1
+ # 升级 MCP 服务器(中文版)
2
+
3
+ 一个游戏化MCP服务器,为人类和AI智能体追踪经验值、等级、技能和任务。训练您的智能体,安装新技能,增强工作流程,优化输出表现。让它们不断升级!
4
+
5
+ ## 功能介绍
6
+
7
+ 升级追踪您和您的AI智能体完成的高效工作,奖励经验值、提升技能等级并解锁成就。
8
+
9
+ - **用户** 拥有主等级 + 3个职业等级(训练师、指挥官、搭档)
10
+ - **智能体** 拥有等级、技能熟练度(0-10)和诚信分数
11
+ - **任务** 根据类型、难度、输出质量和完成度获得经验值
12
+ - **成就** 达到里程碑时解锁(8个类别共54个成就)
13
+ - **段位系统** 从E(分析师/练器境)到S(至尊/人工大能),含星级进度
14
+
15
+ ## 快速开始
16
+
17
+ ### 1. 安装
18
+
19
+ 无需配置 — 只需将升级添加到您的MCP客户端即可使用。服务器会自动连接到共享的升级数据库。
20
+
21
+ ### 2. 连接到 Claude Desktop
22
+
23
+ 将以下内容添加到您的 Claude Desktop 配置文件中:
24
+
25
+ **Windows(Microsoft Store 版本):**
26
+ `%LOCALAPPDATA%\Packages\Claude_pzs8sxrjxfjjc\LocalCache\Roaming\Claude\claude_desktop_config.json`
27
+
28
+ **Windows(直接安装版本):**
29
+ `%APPDATA%\Claude\claude_desktop_config.json`
30
+
31
+ **macOS:**
32
+ `~/Library/Application Support/Claude/claude_desktop_config.json`
33
+
34
+ ```json
35
+ {
36
+ "mcpServers": {
37
+ "level-up-cn": {
38
+ "command": "npx",
39
+ "args": ["-y", "level-up-mcp-server-cn"]
40
+ }
41
+ }
42
+ }
43
+ ```
44
+
45
+ 保存后重启 Claude Desktop。
46
+
47
+ ### 2b. 自动识别(可选)
48
+
49
+ 注册后,将您的用户和智能体ID添加到配置中,这样 升级在每次新对话中都能自动识别您:
50
+
51
+ ```json
52
+ {
53
+ "mcpServers": {
54
+ "level-up-cn": {
55
+ "command": "npx",
56
+ "args": ["-y", "level-up-mcp-server-cn"],
57
+ "env": {
58
+ "LEVELUP_USER_ID": "<您的用户UUID>",
59
+ "LEVELUP_AGENT_ID": "<您的智能体UUID>"
60
+ }
61
+ }
62
+ }
63
+ }
64
+ ```
65
+
66
+ 要查找您的ID,请问Claude:*"我在升级上是谁?"* 或 *"列出我的智能体"*。
67
+
68
+ ### 3. 连接到 OpenClaw
69
+
70
+ 在 `~/.openclaw/openclaw.json` 的 `mcpServers` 下添加:
71
+
72
+ ```json
73
+ {
74
+ "mcpServers": {
75
+ "level-up-cn": {
76
+ "command": "npx",
77
+ "args": ["-y", "level-up-mcp-server-cn"]
78
+ }
79
+ }
80
+ }
81
+ ```
82
+
83
+ 然后重启:`openclaw gateway restart`
84
+
85
+ ### 4. 连接到 Cursor
86
+
87
+ 在项目根目录创建 `.cursor/mcp.json`:
88
+
89
+ ```json
90
+ {
91
+ "mcpServers": {
92
+ "升级": {
93
+ "command": "npx",
94
+ "args": ["-y", "level-up-mcp-server-cn"]
95
+ }
96
+ }
97
+ }
98
+ ```
99
+
100
+ ### 5. 连接到 Cline / Windsurf
101
+
102
+ 在设置中添加 MCP 服务器配置:
103
+
104
+ ```json
105
+ {
106
+ "升级": {
107
+ "command": "npx",
108
+ "args": ["-y", "level-up-mcp-server-cn"]
109
+ }
110
+ }
111
+ ```
112
+
113
+ ### 6. 连接到 Claude Code
114
+
115
+ 在项目根目录的 `.mcp.json` 中添加:
116
+
117
+ ```json
118
+ {
119
+ "mcpServers": {
120
+ "升级": {
121
+ "command": "npx",
122
+ "args": ["-y", "level-up-mcp-server-cn"]
123
+ }
124
+ }
125
+ }
126
+ ```
127
+
128
+ 或使用命令行:
129
+ ```bash
130
+ claude mcp add 升级 -- npx -y level-up-mcp-server-cn
131
+ ```
132
+
133
+ ### 7. 通用 MCP 客户端
134
+
135
+ 任何支持 MCP 协议的客户端都可以连接。使用 stdio 传输:
136
+
137
+ ```bash
138
+ npx level-up-mcp-server-cn
139
+ ```
140
+
141
+ 或使用 HTTP 传输进行远程连接:
142
+
143
+ ```bash
144
+ TRANSPORT=http PORT=3000 npx level-up-mcp-server-cn
145
+ ```
146
+
147
+ 端点:`POST http://localhost:3000/mcp`
148
+
149
+ ### 8. 添加系统提示词
150
+
151
+ 将以下内容添加到您的智能体系统提示词或 Claude Desktop 自定义指令中,以实现自动任务追踪:
152
+
153
+ ```
154
+ 你已安装 升级游戏化工具。请主动使用它们:
155
+
156
+ 1. 识别身份:在首次交互时,调用 levelup_whoami(无需参数)
157
+ 自动识别用户及其智能体。如未找到,则提供注册服务。
158
+
159
+ 2. 追踪工作:当用户要求你完成有意义的工作(编码、研究、
160
+ 写作、分析 — 任何产生交付物的工作)时,静默执行:
161
+ - 调用 levelup_infer_task_type 对工作进行分类
162
+ - 开始工作时调用 levelup_start_task
163
+ - 交付结果时调用 levelup_complete_task
164
+ 不要追踪闲聊、问候或简单查询。
165
+
166
+ 3. 评估:完成任务后,调用 levelup_submit_agent_evaluation
167
+ 进行诚实的自我评估。您的诚信分数取决于评估的一致性。
168
+
169
+ 4. 升级:奖励经验值后,调用 levelup_check_level_up 以执行
170
+ 待处理的等级提升。
171
+
172
+ 5. 状态:当用户询问进度、经验值、等级或成就时,
173
+ 使用相应的 升级工具展示其数据。
174
+
175
+ 保持透明 — 如果用户询问你在追踪什么,请解释 升级系统。
176
+ 绝不虚报经验值或夸大任务难度。
177
+ ```
178
+
179
+ ### 9. 试一试
180
+
181
+ 连接后,直接问Claude:
182
+
183
+ ```
184
+ 帮我注册升级。我的名字是[你的名字]。
185
+ ```
186
+
187
+ 然后做一些实际工作,看着你的经验值增长!
188
+
189
+ ## 运行模式
190
+
191
+ ### stdio(默认 用于 Claude Desktop / OpenClaw)
192
+ ```bash
193
+ npx level-up-mcp-server-cn
194
+ ```
195
+
196
+ ### HTTP(用于远程访问/测试)
197
+ ```bash
198
+ TRANSPORT=http PORT=3000 npx level-up-mcp-server-cn
199
+ ```
200
+
201
+ 健康检查:`GET /health`
202
+ MCP 接口:`POST /mcp`
203
+
204
+ ## 72个工具,14个模块
205
+
206
+ | # | 模块 | 工具数 | 说明 |
207
+ |---|------|--------|------|
208
+ | 1 | 用户 | 13 | 注册、资料、身份关联、引导设置 |
209
+ | 2 | 智能体 | 3 | 注册智能体、资料、列表 |
210
+ | 3 | 技能 | 6 | 添加/列出技能、熟练度追踪 |
211
+ | 4 | 任务 | 7 | 开始、更新、完成、失败任务(标准级以上需要证据) |
212
+ | 5 | 评分 | 7 | 质量评估、期望记录、校准 |
213
+ | 6 | 任务链 | 12 | 每周奖励、任务链、社区任务链 |
214
+ | 7 | 指标 | 3 | 平台指标导入 |
215
+ | 8 | 经验值与进度 | 5 | 经验值历史、摘要、预测 |
216
+ | 9 | 排行榜 | 1 | 按经验值、等级、技能排名 |
217
+ | 10 | 等级 | 3 | 等级信息、要求、下一个解锁 |
218
+ | 11 | 成就 | 1 | 8个类别共54个成就 |
219
+ | 12 | 管理 | 5 | 创建任务类型、技能、分配规则 |
220
+ | 13 | 系统 | 4 | 处理指标、快照、升级检查、身份识别 |
221
+ | 14 | 成长计划 | 2 | 成长计划、浏览推荐技能组 |
222
+
223
+ ## 经验值系统
224
+
225
+ ```
226
+ 总经验值 = 基础经验值 x 难度(1-7) x 输出类型 x 完成度
227
+ + 速度奖励 + 连续奖励 + 首次奖励 + 质量奖励
228
+ ```
229
+
230
+ **输出倍率:** 对话型(1.0x) > 交付物(1.75x) > 已部署(2.5x)
231
+
232
+ **经验值分配**(user_with_agent):智能体 60%,用户 40%
233
+
234
+ **每条路线30级**,段位 E > D > C > B > A > S,含星级进度
235
+
236
+ ## 安全性
237
+
238
+ 经验值奖励和升级通过 Postgres SECURITY DEFINER 函数在服务端验证。MCP 服务器无法虚增经验值 — 所有计算都在数据库中使用经过验证的任务数据和配置进行。
239
+
240
+ ## 技术栈
241
+
242
+ - **语言:** TypeScript
243
+ - **MCP SDK:** @modelcontextprotocol/sdk v1.x
244
+ - **数据库:** Supabase (Postgres) — 45张表
245
+ - **传输方式:** stdio + Streamable HTTP
246
+ - **数据验证:** Zod
247
+ - **安全:** Postgres RPC 函数(SECURITY DEFINER)
248
+
249
+ ## 高级:自定义数据库
250
+
251
+ 如果您想运行自己的 升级实例,请设置以下环境变量:
252
+
253
+ | 变量 | 说明 |
254
+ |------|------|
255
+ | `SUPABASE_URL` | 您的 Supabase 项目 URL |
256
+ | `SUPABASE_SERVICE_KEY` | 您的 Supabase service_role 密钥 |
257
+ | `TRANSPORT` | `stdio`(默认)或 `http` |
258
+ | `PORT` | HTTP 端口(默认:3000) |
259
+
260
+ ## 许可证
261
+
262
+ 免费使用、修改和部署。不得提供竞争性的游戏化即服务产品。2030年3月13日转为 Apache 2.0。详见 LICENSE 文件。