libero-mcp 0.2.1 → 0.2.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/COLD_START.md +31 -0
- package/README.md +16 -9
- package/dist/mcp/cold-start.js +50 -0
- package/dist/mcp/server-core.js +5 -3
- package/package.json +3 -2
package/COLD_START.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# libero 冷启动(装机后、reload 前)
|
|
2
|
+
|
|
3
|
+
> 给 Hermes / OpenClaw 等 host agent 读。装完包后**先把下面欢迎发给用户**,再 `/reload-mcp`。
|
|
4
|
+
|
|
5
|
+
## 装机顺序
|
|
6
|
+
|
|
7
|
+
1. `npm i -g libero-mcp@latest`
|
|
8
|
+
2. 配置 `mcp_servers.libero.command: libero-mcp`(如需)
|
|
9
|
+
3. **先介绍**:把「欢迎原文」原样发给用户(不要列工具名、不要问 user_id)
|
|
10
|
+
4. **再刷新**:`/reload-mcp`(或等价)挂上工具
|
|
11
|
+
|
|
12
|
+
## 欢迎原文(原样发给用户)
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
你好,我是 libero,帮你管时间和精力。
|
|
16
|
+
|
|
17
|
+
常用这几件事,直接说就行:
|
|
18
|
+
• 计时:「开始计时写代码」/「开个 25 分钟番茄钟」
|
|
19
|
+
• 日程:「明天 9 点到 11 点写报告」
|
|
20
|
+
• 拆任务:「这个太大了,帮我拆一下」
|
|
21
|
+
• 看数据:「这周时间都花哪儿了」
|
|
22
|
+
• 复盘:「帮我复盘一下这周」
|
|
23
|
+
|
|
24
|
+
想先试哪一句?
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## 硬规矩
|
|
28
|
+
|
|
29
|
+
- **禁止问 user_id**(从会话上下文静默取;取不到用 `local:default`)
|
|
30
|
+
- 不要提 MCP / 工具表 / DB / YAML
|
|
31
|
+
- 用户选了例句 → 直接执行,不要重复整段介绍
|
package/README.md
CHANGED
|
@@ -10,18 +10,26 @@ AI 辅助的精力管理教练:观察实绩 → 发现问题 → 对齐方案
|
|
|
10
10
|
npm i -g libero-mcp@latest
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
### 给 host agent(Hermes / OpenClaw)的装机顺序
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
1. 装包并写好 MCP 配置
|
|
16
|
+
2. **先介绍**:把 [`COLD_START.md`](COLD_START.md) 里的欢迎原文发给用户(不要列工具、不要问 user_id)
|
|
17
|
+
3. **再刷新**:`/reload-mcp`(或等价)挂上工具
|
|
16
18
|
|
|
17
|
-
|
|
19
|
+
用户装完后应直接看到欢迎与试用例句,而不是配置问卷。
|
|
20
|
+
|
|
21
|
+
### 用户怎么试
|
|
22
|
+
|
|
23
|
+
装完后直接说:
|
|
24
|
+
|
|
25
|
+
> 开始计时写代码
|
|
26
|
+
|
|
27
|
+
或:
|
|
18
28
|
|
|
19
29
|
> 这周时间都花哪儿了?帮我复盘一下
|
|
20
30
|
|
|
21
31
|
## 能说什么
|
|
22
32
|
|
|
23
|
-
libero 是个教练,不是表格工具——所有功能都通过自然语言触发:
|
|
24
|
-
|
|
25
33
|
| 想做的事 | 这样说 |
|
|
26
34
|
|---|---|
|
|
27
35
|
| 开始一段专注 | "开始计时写代码" / "开个 25 分钟番茄钟读书" |
|
|
@@ -50,8 +58,7 @@ DB schema 升级在启动时自动跑,不用手工干预。
|
|
|
50
58
|
|
|
51
59
|
## 给开发者
|
|
52
60
|
|
|
61
|
+
- 冷启动文案:[COLD_START.md](COLD_START.md)(与 MCP `instructions` 同源)
|
|
53
62
|
- 协作宪法:[AGENTS.md](AGENTS.md)
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
- Skills 源在 `skills/`(libero-coach / libero-record / libero-onboarding / libero-decompose)
|
|
57
|
-
- 仓库结构 / spec / 决策记录:见 `docs/`
|
|
63
|
+
- 部署细节:[docs/operations/deploy-to-hermes.md](docs/operations/deploy-to-hermes.md)
|
|
64
|
+
- Skills:`skills/`(libero-coach / libero-record / libero-onboarding / libero-decompose)
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cold-start copy for host agents (Hermes / OpenClaw) and MCP server instructions.
|
|
3
|
+
*
|
|
4
|
+
* Timing (user perspective):
|
|
5
|
+
* 1. After npm install / config written
|
|
6
|
+
* 2. FIRST show COLD_START_WELCOME to the user (before tools are live)
|
|
7
|
+
* 3. THEN /reload-mcp (or equivalent) to attach tools
|
|
8
|
+
*
|
|
9
|
+
* MCP cannot push a chat message by itself — hosts must speak this text in the
|
|
10
|
+
* install turn. Server `instructions` reinforce the same rules after connect.
|
|
11
|
+
*/
|
|
12
|
+
/** Short welcome users should see (natural language only). */
|
|
13
|
+
export const COLD_START_WELCOME = `你好,我是 libero,帮你管时间和精力。
|
|
14
|
+
|
|
15
|
+
常用这几件事,直接说就行:
|
|
16
|
+
• 计时:「开始计时写代码」/「开个 25 分钟番茄钟」
|
|
17
|
+
• 日程:「明天 9 点到 11 点写报告」
|
|
18
|
+
• 拆任务:「这个太大了,帮我拆一下」
|
|
19
|
+
• 看数据:「这周时间都花哪儿了」
|
|
20
|
+
• 复盘:「帮我复盘一下这周」
|
|
21
|
+
|
|
22
|
+
想先试哪一句?`;
|
|
23
|
+
/**
|
|
24
|
+
* MCP initialize `instructions` — injected into host model context after connect.
|
|
25
|
+
* Also documents the install sequence for hosts that read package docs.
|
|
26
|
+
*/
|
|
27
|
+
export function buildServerInstructions() {
|
|
28
|
+
return [
|
|
29
|
+
"# libero — 时间与精力管理助手",
|
|
30
|
+
"",
|
|
31
|
+
"## 装机顺序(硬规矩)",
|
|
32
|
+
"1. npm i -g libero-mcp@latest 配置好 mcp_servers 后:",
|
|
33
|
+
"2. **先介绍**:把下面「冷启动欢迎」原样发给用户(不要列工具名 / 不要问配置)",
|
|
34
|
+
"3. **再 reload**:用户看完介绍后,再执行 /reload-mcp(或等价刷新)挂上工具",
|
|
35
|
+
"4. 禁止在介绍或首次对话里索取 user_id / DB_PATH / YAML",
|
|
36
|
+
"",
|
|
37
|
+
"## 冷启动欢迎(原样发给用户)",
|
|
38
|
+
COLD_START_WELCOME,
|
|
39
|
+
"",
|
|
40
|
+
"## user_id(硬纪律)",
|
|
41
|
+
"- 调用任何需要 user_id 的工具时:从当前会话上下文静默取(平台用户 ID / 会话稳定 ID)",
|
|
42
|
+
"- 取不到时用稳定占位 local:default",
|
|
43
|
+
"- **禁止问用户起 user_id**;禁止输出 wechat_你的ID / test_1 这类工程师问卷",
|
|
44
|
+
"- 可选问称呼(display_name),一句即可,可跳过",
|
|
45
|
+
"",
|
|
46
|
+
"## 对用户说话",
|
|
47
|
+
"- 只说自然语言能做什么;不要提 MCP / 工具表 / schema / 数据库",
|
|
48
|
+
"- 用户选了试用例句 → 直接执行对应能力,不要重复整段介绍",
|
|
49
|
+
].join("\n");
|
|
50
|
+
}
|
package/dist/mcp/server-core.js
CHANGED
|
@@ -11,6 +11,7 @@ import { createReminderTools } from "./src/reminder/index.js";
|
|
|
11
11
|
import { createSchedulerTools } from "./src/scheduler/index.js";
|
|
12
12
|
import { createTaskTools } from "./src/task/index.js";
|
|
13
13
|
import { nowLocal, formatTime, parseTime } from "./src/clock/index.js";
|
|
14
|
+
import { buildServerInstructions } from "./cold-start.js";
|
|
14
15
|
/** Wrap any tool result as MCP text content (JSON). Void results become {ok:true}. */
|
|
15
16
|
function asContent(result) {
|
|
16
17
|
return {
|
|
@@ -45,7 +46,8 @@ export function buildServer(db) {
|
|
|
45
46
|
const reminder = createReminderTools(reminderRepo);
|
|
46
47
|
const scheduler = createSchedulerTools(timeblockRepo, reminderRepo, categoryRepo);
|
|
47
48
|
const task = createTaskTools(db);
|
|
48
|
-
|
|
49
|
+
// instructions 必须放在第 2 参 ServerOptions(不是 serverInfo)—— SDK 只从 options 读
|
|
50
|
+
const server = new McpServer({ name: "libero-mcp", version: "0.2.2" }, { instructions: buildServerInstructions() });
|
|
49
51
|
// ============================================================
|
|
50
52
|
// categories (2 tools)
|
|
51
53
|
// ============================================================
|
|
@@ -200,9 +202,9 @@ export function buildServer(db) {
|
|
|
200
202
|
inputSchema: { user_id: z.string().min(1) },
|
|
201
203
|
}, async ({ user_id }) => asContent(await profile.get(user_id)));
|
|
202
204
|
server.registerTool("profile.upsert", {
|
|
203
|
-
description: "创建或更新用户 profile
|
|
205
|
+
description: "创建或更新用户 profile。user_id 从会话上下文静默取,禁止向用户索取。",
|
|
204
206
|
inputSchema: {
|
|
205
|
-
user_id: z.string().min(1),
|
|
207
|
+
user_id: z.string().min(1).describe("从会话上下文静默取;禁止问用户"),
|
|
206
208
|
display_name: z.string().optional(),
|
|
207
209
|
expectations: z.string().optional(),
|
|
208
210
|
settings: z
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "libero-mcp",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "AI 时间管理教练 MCP 工具集——时间块记录、统计、矩阵诊断、计时、分类、profile",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "amosyuan",
|
|
@@ -39,7 +39,8 @@
|
|
|
39
39
|
"files": [
|
|
40
40
|
"dist",
|
|
41
41
|
"data/migrations",
|
|
42
|
-
"data/schema.sql"
|
|
42
|
+
"data/schema.sql",
|
|
43
|
+
"COLD_START.md"
|
|
43
44
|
],
|
|
44
45
|
"dependencies": {
|
|
45
46
|
"@modelcontextprotocol/sdk": "^1.29.0",
|