@mcpcn/mcp-notification 1.1.11 → 1.1.13

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 +9 -7
  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,10 +95,11 @@ 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: '设置通知提醒,接收事件类型(提醒消息,执行任务)。支持一次性、按间隔循环、每日循环。规则:当用户表述为具体某天/今天/明天/后天/某日期某时间等,请选择repeat=none;优选将具体日期时间直接计算为RFC3339并填入triggerAt,或仅提供timeOfDay让服务端自动推算到最近一次的该时间(若当天已过则推算到明天)。只有当用户明确说"每天/每日/每晚/每早/每隔X时间"时,才使用repeat=daily或repeat=interval。一次性提醒可提供triggerAt或delaySec,或提供timeOfDay用于推算,优先使用delaySec。',
99
99
  inputSchema: {
100
100
  type: 'object',
101
101
  properties: {
102
+ eventType: { type: 'string', enum: ['reminder', 'task'], description: '事件类型:reminder 提醒消息(用于通知用户)、task 执行任务(用于触发定时操作)。' },
102
103
  content: { type: 'string', minLength: 1, description: '提醒内容,例如 “开会”。' },
103
104
  repeat: { type: 'string', enum: ['none', 'interval', 'daily'], default: 'none', description: '提醒类型:none 一次性(包含“今天/明天/某天”的语义)、interval 按间隔、daily 每日(仅当用户明确要求“每天”时使用)。' },
104
105
  delaySec: { type: 'number', minimum: 1, description: '一次性提醒相对延迟秒数,例如 300 表示5分钟后触发。与triggerAt二选一。' },
@@ -107,7 +108,7 @@ class ReminderServer {
107
108
  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
109
  tzOffsetMin: { type: 'number', description: '时区偏移分钟,例如北京为 480;不提供时默认使用本机时区。' },
109
110
  },
110
- required: ['content', 'repeat'],
111
+ required: ['eventType', 'content', 'repeat'],
111
112
  additionalProperties: false,
112
113
  oneOf: [
113
114
  {
@@ -128,11 +129,11 @@ class ReminderServer {
128
129
  },
129
130
  ],
130
131
  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 },
132
+ { eventType: 'reminder', content: '开会', repeat: 'none', triggerAt: '2025-11-21T08:00:00+08:00' },
133
+ { eventType: 'reminder', content: '喝水', repeat: 'none', delaySec: 300 },
134
+ { eventType: 'task', content: '下午3点发邮件到 examples@gmail.com,内容是:王总,项目有新的进展吗', repeat: 'none', timeOfDay: '15:00', tzOffsetMin: 480 },
135
+ { eventType: 'reminder', content: '站立休息', repeat: 'interval', intervalSec: 1800 },
136
+ { eventType: 'task', content: '打卡', repeat: 'daily', timeOfDay: '09:00', tzOffsetMin: 480 },
136
137
  ],
137
138
  },
138
139
  },
@@ -185,6 +186,7 @@ class ReminderServer {
185
186
  }
186
187
  if (name === 'set_reminder') {
187
188
  const params = {
189
+ eventType: String(args.eventType || ''),
188
190
  content: String(args.content || ''),
189
191
  repeat: String(args.repeat || ''),
190
192
  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.13",
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
+ }