@mcpcn/mcp-notification 1.1.11 → 1.1.16

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.
Files changed (3) hide show
  1. package/README.md +167 -167
  2. package/dist/index.js +56 -20
  3. package/package.json +41 -41
package/README.md CHANGED
@@ -1,167 +1,167 @@
1
- # MCP 通知提醒服务器
2
-
3
- 一个基于 Model Context Protocol (MCP) 的通知提醒服务器,提供设置提醒、查询提醒列表、取消提醒三种工具,并通过后端接口对接统一的提醒调度与分发。
4
-
5
- ## 功能特性
6
-
7
- - 🔔 设置提醒:支持一次性、固定间隔循环、每日循环
8
- - 📋 查询列表:获取设备的待触发提醒列表(仅 `scheduled`)
9
- - ❌ 取消提醒:按 `id` 取消指定提醒
10
- - ⚡ MCP 协议集成:适配各类 MCP 客户端
11
- - 🌐 可配置后端地址:通过环境变量 `REMINDER_API_BASE` 指定
12
-
13
- ## 安装
14
-
15
- ### 前置要求
16
-
17
- - Node.js >= 18
18
-
19
- ### 安装依赖
20
-
21
- ```bash
22
- npm install
23
- ```
24
-
25
- ### 构建项目
26
-
27
- ```bash
28
- npm run build
29
- ```
30
-
31
- ## 使用方法
32
-
33
- ### 1. 直接运行
34
-
35
- ```bash
36
- npm run start
37
- # 或
38
- node dist/index.js
39
- ```
40
-
41
- ### 2. 作为 MCP 服务器
42
-
43
- 在您的 MCP 客户端配置中添加:
44
-
45
- ```json
46
- {
47
- "mcpServers": {
48
- "通知提醒": {
49
- "command": "node",
50
- "args": ["/path/to/通知提醒新/dist/index.js"],
51
- "env": {
52
- "REMINDER_API_BASE": "https://www.rapido.chat/api"
53
- }
54
- }
55
- }
56
- }
57
- ```
58
-
59
- 或使用已发布命令名(全局安装后):
60
-
61
- ```json
62
- {
63
- "mcpServers": {
64
- "通知提醒": {
65
- "command": "notification-mcp",
66
- "args": [],
67
- "env": {
68
- "REMINDER_API_BASE": "https://www.mcpcn.cc/api"
69
- }
70
- }
71
- }
72
- }
73
- ```
74
-
75
- ## 工具说明
76
-
77
- ### set_reminder
78
-
79
- 设置通知提醒,支持以下模式(请求需携带会话头 `chatSessionId`,详见下文“会话标识”):
80
-
81
- - 一次性(相对延时)
82
- ```json
83
- { "content": "开会", "repeat": "none", "delaySec": 300 }
84
- ```
85
-
86
- - 一次性(绝对时间)
87
- ```json
88
- { "content": "开会", "repeat": "none", "triggerAt": "2025-11-15T20:00:00+08:00" }
89
- ```
90
-
91
- - 间隔循环(每5分钟)
92
- ```json
93
- { "content": "喝水", "repeat": "interval", "intervalSec": 300 }
94
- ```
95
-
96
- - 每日循环(每天18:00,北京时间)
97
- ```json
98
- { "content": "下班打卡", "repeat": "daily", "timeOfDay": "18:00", "tzOffsetMin": 480 }
99
- ```
100
-
101
- 参数:
102
-
103
- - `content` (string, 必需)
104
- - `repeat` (string, 必需):`none|interval|daily`
105
- - `delaySec` (number, 可选):一次性延时触发
106
- - `triggerAt` (string, 可选):一次性绝对时间(RFC3339)
107
- - `intervalSec` (number, 可选):间隔循环秒数
108
- - `timeOfDay` (string, 可选):每日循环的时间(如 `18:00` 或 `18:00:00`)
109
- - `tzOffsetMin` (number, 可选):时区偏移分钟(北京为 `480`)
110
-
111
- ### list_reminders
112
-
113
- 查询待触发提醒列表(请求需携带会话头 `chatSessionId`):
114
-
115
- 参数:无
116
-
117
- 返回:提醒条目数组(仅 `scheduled` 状态)
118
-
119
- ### cancel_reminder
120
-
121
- 取消指定提醒(请求需携带会话头 `chatSessionId`):
122
-
123
- 参数:
124
-
125
- - `id` (string, 必需)
126
-
127
- ## 会话标识
128
-
129
- MCP 客户端需在调用工具时携带 `meta.chatSessionId`,服务端会自动解析并将其作为 HTTP 请求头 `chatSessionId` 传给后端接口:
130
-
131
- - 解析来源:`request.meta.chatSessionId` 或 `request.params.meta.chatSessionId`
132
- - 请求头:`chatSessionId: <meta.chatSessionId>`
133
-
134
- ## 后端接口
135
-
136
- 默认后端基地址为 `https://www.mcpcn.cc/api`(可通过 `REMINDER_API_BASE` 修改)。接口为:
137
-
138
- - 设置提醒:`https://www.mcpcn.cc/api/reminder/set`
139
- - 列表查询:`https://www.mcpcn.cc/api/reminder/list`
140
- - 取消提醒:`https://www.mcpcn.cc/api/reminder/cancel`
141
-
142
- ## 项目结构
143
-
144
- ```
145
- 通知提醒新/
146
- ├── src/
147
- │ └── index.ts # MCP 服务器实现(工具与接口调用)
148
- ├── dist/
149
- │ └── index.js # 构建输出文件
150
- ├── package.json # 项目配置(main/bin 脚本)
151
- ├── tsconfig.json # TypeScript 配置
152
- └── README.md # 使用说明
153
- ```
154
-
155
- ## 技术栈
156
-
157
- - **TypeScript**
158
- - **Node.js**
159
- - **@modelcontextprotocol/sdk**
160
-
161
- ## 许可证
162
-
163
- MIT License
164
-
165
- ## 贡献
166
-
167
- 欢迎提交 Issue 和 Pull Request!
1
+ # MCP 通知提醒服务器
2
+
3
+ 一个基于 Model Context Protocol (MCP) 的通知提醒服务器,提供设置提醒、查询提醒列表、取消提醒三种工具,并通过后端接口对接统一的提醒调度与分发。
4
+
5
+ ## 功能特性
6
+
7
+ - 🔔 设置提醒:支持一次性、固定间隔循环、每日循环
8
+ - 📋 查询列表:获取设备的待触发提醒列表(仅 `scheduled`)
9
+ - ❌ 取消提醒:按 `id` 取消指定提醒
10
+ - ⚡ MCP 协议集成:适配各类 MCP 客户端
11
+ - 🌐 可配置后端地址:通过环境变量 `REMINDER_API_BASE` 指定
12
+
13
+ ## 安装
14
+
15
+ ### 前置要求
16
+
17
+ - Node.js >= 18
18
+
19
+ ### 安装依赖
20
+
21
+ ```bash
22
+ npm install
23
+ ```
24
+
25
+ ### 构建项目
26
+
27
+ ```bash
28
+ npm run build
29
+ ```
30
+
31
+ ## 使用方法
32
+
33
+ ### 1. 直接运行
34
+
35
+ ```bash
36
+ npm run start
37
+ # 或
38
+ node dist/index.js
39
+ ```
40
+
41
+ ### 2. 作为 MCP 服务器
42
+
43
+ 在您的 MCP 客户端配置中添加:
44
+
45
+ ```json
46
+ {
47
+ "mcpServers": {
48
+ "通知提醒": {
49
+ "command": "node",
50
+ "args": ["/path/to/通知提醒新/dist/index.js"],
51
+ "env": {
52
+ "REMINDER_API_BASE": "https://www.rapido.chat/api"
53
+ }
54
+ }
55
+ }
56
+ }
57
+ ```
58
+
59
+ 或使用已发布命令名(全局安装后):
60
+
61
+ ```json
62
+ {
63
+ "mcpServers": {
64
+ "通知提醒": {
65
+ "command": "notification-mcp",
66
+ "args": [],
67
+ "env": {
68
+ "REMINDER_API_BASE": "https://www.mcpcn.cc/api"
69
+ }
70
+ }
71
+ }
72
+ }
73
+ ```
74
+
75
+ ## 工具说明
76
+
77
+ ### set_reminder
78
+
79
+ 设置通知提醒,支持以下模式(请求需携带会话头 `chatSessionId`,详见下文“会话标识”):
80
+
81
+ - 一次性(相对延时)
82
+ ```json
83
+ { "content": "开会", "repeat": "none", "delaySec": 300 }
84
+ ```
85
+
86
+ - 一次性(绝对时间)
87
+ ```json
88
+ { "content": "开会", "repeat": "none", "triggerAt": "2025-11-15T20:00:00+08:00" }
89
+ ```
90
+
91
+ - 间隔循环(每5分钟)
92
+ ```json
93
+ { "content": "喝水", "repeat": "interval", "intervalSec": 300 }
94
+ ```
95
+
96
+ - 每日循环(每天18:00,北京时间)
97
+ ```json
98
+ { "content": "下班打卡", "repeat": "daily", "timeOfDay": "18:00", "tzOffsetMin": 480 }
99
+ ```
100
+
101
+ 参数:
102
+
103
+ - `content` (string, 必需)
104
+ - `repeat` (string, 必需):`none|interval|daily`
105
+ - `delaySec` (number, 可选):一次性延时触发
106
+ - `triggerAt` (string, 可选):一次性绝对时间(RFC3339)
107
+ - `intervalSec` (number, 可选):间隔循环秒数
108
+ - `timeOfDay` (string, 可选):每日循环的时间(如 `18:00` 或 `18:00:00`)
109
+ - `tzOffsetMin` (number, 可选):时区偏移分钟(北京为 `480`)
110
+
111
+ ### list_reminders
112
+
113
+ 查询待触发提醒列表(请求需携带会话头 `chatSessionId`):
114
+
115
+ 参数:无
116
+
117
+ 返回:提醒条目数组(仅 `scheduled` 状态)
118
+
119
+ ### cancel_reminder
120
+
121
+ 取消指定提醒(请求需携带会话头 `chatSessionId`):
122
+
123
+ 参数:
124
+
125
+ - `id` (string, 必需)
126
+
127
+ ## 会话标识
128
+
129
+ MCP 客户端需在调用工具时携带 `meta.chatSessionId`,服务端会自动解析并将其作为 HTTP 请求头 `chatSessionId` 传给后端接口:
130
+
131
+ - 解析来源:`request.meta.chatSessionId` 或 `request.params.meta.chatSessionId`
132
+ - 请求头:`chatSessionId: <meta.chatSessionId>`
133
+
134
+ ## 后端接口
135
+
136
+ 默认后端基地址为 `https://www.mcpcn.cc/api`(可通过 `REMINDER_API_BASE` 修改)。接口为:
137
+
138
+ - 设置提醒:`https://www.mcpcn.cc/api/reminder/set`
139
+ - 列表查询:`https://www.mcpcn.cc/api/reminder/list`
140
+ - 取消提醒:`https://www.mcpcn.cc/api/reminder/cancel`
141
+
142
+ ## 项目结构
143
+
144
+ ```
145
+ 通知提醒新/
146
+ ├── src/
147
+ │ └── index.ts # MCP 服务器实现(工具与接口调用)
148
+ ├── dist/
149
+ │ └── index.js # 构建输出文件
150
+ ├── package.json # 项目配置(main/bin 脚本)
151
+ ├── tsconfig.json # TypeScript 配置
152
+ └── README.md # 使用说明
153
+ ```
154
+
155
+ ## 技术栈
156
+
157
+ - **TypeScript**
158
+ - **Node.js**
159
+ - **@modelcontextprotocol/sdk**
160
+
161
+ ## 许可证
162
+
163
+ MIT License
164
+
165
+ ## 贡献
166
+
167
+ 欢迎提交 Issue 和 Pull Request!
package/dist/index.js CHANGED
@@ -95,45 +95,80 @@ class ReminderServer {
95
95
  tools: [
96
96
  {
97
97
  name: 'set_reminder',
98
- description: '设置通知提醒,支持一次性、按间隔循环、每日循环。规则:当用户表述为具体某天/今天/明天/后天/某日期某时间等,请选择repeat=none;优选将具体日期时间直接计算为RFC3339并填入triggerAt,或仅提供timeOfDay让服务端自动推算到最近一次的该时间(若当天已过则推算到明天)。只有当用户明确说“每天/每日/每晚/每早/每隔X时间”时,才使用repeat=daily或repeat=interval。一次性提醒可提供triggerAt或delaySec,或提供timeOfDay用于推算,优先使用delaySec。',
98
+ description: '设置通知提醒或创建自动任务。核心逻辑:1. 优先判断eventType。2. 时间处理:优先将用户口语时间转换为绝对时间(triggerAt)或相对秒数(delaySec)。只有当用户明确指定"每天/每隔X"时才使用循环设置。',
99
99
  inputSchema: {
100
100
  type: 'object',
101
101
  properties: {
102
- content: { type: 'string', minLength: 1, description: '提醒内容,例如 “开会”。' },
103
- repeat: { type: 'string', enum: ['none', 'interval', 'daily'], default: 'none', description: '提醒类型:none 一次性(包含“今天/明天/某天”的语义)、interval 按间隔、daily 每日(仅当用户明确要求“每天”时使用)。' },
104
- delaySec: { type: 'number', minimum: 1, description: '一次性提醒相对延迟秒数,例如 300 表示5分钟后触发。与triggerAt二选一。' },
105
- triggerAt: { type: 'string', description: '一次性提醒绝对时间,RFC3339 格式,例如 2025-11-21T08:00:00+08:00。' },
106
- intervalSec: { type: 'number', minimum: 1, description: '按间隔循环的间隔秒数,例如 3600 表示每小时提醒一次。仅repeat=interval时必需。' },
107
- timeOfDay: { type: 'string', pattern: '^\\d{1,2}:\\d{2}(:\\d{2})?$', description: '一天中的时间,格式 HH:mm 或 HH:mm:ss,例如 08:00 或 08:00:00。repeat=daily时必需;repeat=none且未提供triggerAt/delaySec时用于推算。典型用法:用户说“明天早上8点”,请选择repeat=none并设置timeOfDay="08:00",服务端会自动推算到最近的08:00。' },
108
- tzOffsetMin: { type: 'number', description: '时区偏移分钟,例如北京为 480;不提供时默认使用本机时区。' },
102
+ eventType: {
103
+ type: 'string',
104
+ enum: ['reminder', 'task'],
105
+ description: '决定由谁执行。task: 仅限系统能自动完成的数字化动作(发送邮件/消息、API打卡)。若用户要求物理动作(如"买咖啡"、"取快递")或不支持的操作,必须降级选 reminder。reminder: 提醒用户自己去做的任何事项。'
106
+ },
107
+ content: {
108
+ type: 'string',
109
+ minLength: 1,
110
+ description: '事项核心内容。关键清洗规则:请剔除用于"设定提醒时间"的词语(如"明天早上8点提醒我"->剔除"明天早上8点"),但务必保留属于事项内容的时间描述(如"提交10月份报告"、"准备周五的会议"中的时间词需保留)。'
111
+ },
112
+ repeat: {
113
+ type: 'string',
114
+ enum: ['none', 'interval', 'daily'],
115
+ default: 'none',
116
+ description: 'none: 单次(含今天/明天/特定日期)。daily: 仅当明确说"每天/每日"时。interval: 仅当明确说"每隔X分钟/小时"时。注意:若用户说"每周五"或"工作日",当前不支持复杂循环,请计算下一次发生的具体日期设为 none。'
117
+ },
118
+ delaySec: {
119
+ type: 'number',
120
+ minimum: 1,
121
+ description: '(优先级最高)相对现在的延迟秒数。如"5分钟后"->300。'
122
+ },
123
+ triggerAt: {
124
+ type: 'string',
125
+ description: '(优先级次高)RFC3339 格式绝对时间 (YYYY-MM-DDTHH:mm:ss+HH:mm)。优先计算具体日期时间填入此项。'
126
+ },
127
+ intervalSec: {
128
+ type: 'number',
129
+ minimum: 1,
130
+ description: '循环间隔秒数。仅 repeat=interval 时有效。'
131
+ },
132
+ timeOfDay: {
133
+ type: 'string',
134
+ pattern: '^([0-1]?[0-9]|2[0-3]):[0-5][0-9](:[0-5][0-9])?$',
135
+ description: 'HH:mm 格式。场景:1) repeat=daily 时指定每天几点;2) repeat=none 且无法确定具体日期时,辅助服务端推算。'
136
+ },
137
+ tzOffsetMin: {
138
+ type: 'number',
139
+ description: '用户所在时区偏移(如北京为480)。'
140
+ }
109
141
  },
110
- required: ['content', 'repeat'],
142
+ required: ['eventType', 'content', 'repeat'],
111
143
  additionalProperties: false,
112
144
  oneOf: [
113
145
  {
146
+ description: '单次提醒:必须提供 triggerAt 或 delaySec 或 timeOfDay 其中之一',
114
147
  properties: { repeat: { const: 'none' } },
115
148
  anyOf: [
116
149
  { required: ['triggerAt'] },
117
150
  { required: ['delaySec'] },
118
- { required: ['timeOfDay'] },
119
- ],
151
+ { required: ['timeOfDay'] }
152
+ ]
120
153
  },
121
154
  {
155
+ description: '间隔循环:必须提供 intervalSec',
122
156
  properties: { repeat: { const: 'interval' } },
123
- required: ['intervalSec'],
157
+ required: ['intervalSec']
124
158
  },
125
159
  {
160
+ description: '每日循环:必须提供 timeOfDay',
126
161
  properties: { repeat: { const: 'daily' } },
127
- required: ['timeOfDay'],
128
- },
162
+ required: ['timeOfDay']
163
+ }
129
164
  ],
130
165
  examples: [
131
- { content: '开会', repeat: 'none', triggerAt: '2025-11-21T08:00:00+08:00' },
132
- { content: '喝水', repeat: 'none', delaySec: 300 },
133
- { content: '出发去10号线', repeat: 'none', timeOfDay: '08:00', tzOffsetMin: 480 },
134
- { content: '站立休息', repeat: 'interval', intervalSec: 1800 },
135
- { content: '打卡', repeat: 'daily', timeOfDay: '09:00', tzOffsetMin: 480 },
136
- ],
166
+ { eventType: 'reminder', content: '准备下周五的PPT', repeat: 'none', triggerAt: '2025-11-21T08:00:00+08:00' },
167
+ { eventType: 'reminder', content: '去楼下拿快递', repeat: 'none', delaySec: 600 },
168
+ { eventType: 'task', content: '发送邮件到 examples@gmail.com,内容是:王总,项目有新的进展吗', repeat: 'none', timeOfDay: '15:00', tzOffsetMin: 480 },
169
+ { eventType: 'reminder', content: '站立休息', repeat: 'interval', intervalSec: 1800 },
170
+ { eventType: 'task', content: '打卡', repeat: 'daily', timeOfDay: '09:00', tzOffsetMin: 480 }
171
+ ]
137
172
  },
138
173
  },
139
174
  {
@@ -185,6 +220,7 @@ class ReminderServer {
185
220
  }
186
221
  if (name === 'set_reminder') {
187
222
  const params = {
223
+ eventType: String(args.eventType || ''),
188
224
  content: String(args.content || ''),
189
225
  repeat: String(args.repeat || ''),
190
226
  delaySec: args.delaySec,
package/package.json CHANGED
@@ -1,41 +1,41 @@
1
- {
2
- "name": "@mcpcn/mcp-notification",
3
- "version": "1.1.11",
4
- "description": "系统通知MCP服务器",
5
- "packageManager": "yarn@1.22.22",
6
- "main": "dist/index.js",
7
- "types": "dist/index.d.ts",
8
- "bin": {
9
- "notification-mcp": "./dist/index.js"
10
- },
11
- "files": [
12
- "dist/**/*"
13
- ],
14
- "engines": {
15
- "node": ">=18"
16
- },
17
- "keywords": [
18
- "mcp",
19
- "notification",
20
- "通知提醒",
21
- "schedule",
22
- "interval",
23
- "daily"
24
- ],
25
- "scripts": {
26
- "build": "tsc && node -e \"try{require('fs').chmodSync('dist/index.js',0o755)}catch(e){}\"",
27
- "start": "node dist/index.js",
28
- "dev": "tsc -w",
29
- "clean": "node -e \"try{require('fs').rmSync('dist',{recursive:true,force:true})}catch(e){}\"",
30
- "prepare": "npm run clean && npm run build"
31
- },
32
- "type": "module",
33
- "license": "MIT",
34
- "devDependencies": {
35
- "@types/node": "^22.10.2",
36
- "typescript": "^5.7.2"
37
- },
38
- "dependencies": {
39
- "@modelcontextprotocol/sdk": "^1.0.4"
40
- }
41
- }
1
+ {
2
+ "name": "@mcpcn/mcp-notification",
3
+ "version": "1.1.16",
4
+ "description": "系统通知MCP服务器",
5
+ "packageManager": "yarn@1.22.22",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "bin": {
9
+ "notification-mcp": "./dist/index.js"
10
+ },
11
+ "files": [
12
+ "dist/**/*"
13
+ ],
14
+ "engines": {
15
+ "node": ">=18"
16
+ },
17
+ "keywords": [
18
+ "mcp",
19
+ "notification",
20
+ "通知提醒",
21
+ "schedule",
22
+ "interval",
23
+ "daily"
24
+ ],
25
+ "scripts": {
26
+ "build": "tsc && node -e \"try{require('fs').chmodSync('dist/index.js',0o755)}catch(e){}\"",
27
+ "start": "node dist/index.js",
28
+ "dev": "tsc -w",
29
+ "clean": "node -e \"try{require('fs').rmSync('dist',{recursive:true,force:true})}catch(e){}\"",
30
+ "prepare": "npm run clean && npm run build"
31
+ },
32
+ "type": "module",
33
+ "license": "MIT",
34
+ "devDependencies": {
35
+ "@types/node": "^22.10.2",
36
+ "typescript": "^5.7.2"
37
+ },
38
+ "dependencies": {
39
+ "@modelcontextprotocol/sdk": "^1.0.4"
40
+ }
41
+ }