@mcpcn/mcp-notification 1.1.2 → 1.1.5

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 (2) hide show
  1. package/dist/index.js +10 -8
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -12,11 +12,14 @@ function resolveChatSessionId(request) {
12
12
  }
13
13
  return undefined;
14
14
  };
15
- return (pick(request?.params?.arguments, ['chatSessionId', 'chatSessionID']) ??
16
- pick(request?.meta, ['chatSessionId', 'chatSessionID']) ??
17
- pick(request?.params?._meta, ['chatSessionId', 'chatSessionID']) ??
15
+ return (pick(request?.params?._meta, ['chatSessionId', 'chatSessionID']) ??
18
16
  pick(request?.params?.meta, ['chatSessionId', 'chatSessionID']) ??
19
- pick(request?._meta, ['chatSessionId', 'chatSessionID']));
17
+ pick(request?.meta, ['chatSessionId', 'chatSessionID']) ??
18
+ pick(request?._meta, ['chatSessionId', 'chatSessionID']) ??
19
+ pick(request?.params, ['chatSessionId', 'chatSessionID']) ??
20
+ pick(request?.params?.arguments?.meta, ['chatSessionId', 'chatSessionID']) ??
21
+ pick(request?.params?.arguments?._meta, ['chatSessionId', 'chatSessionID']) ??
22
+ pick(request?.params?.arguments, ['chatSessionId', 'chatSessionID']));
20
23
  }
21
24
  async function postJson(path, body, chatSessionId) {
22
25
  const headers = { 'Content-Type': 'application/json', Accept: 'application/json' };
@@ -136,7 +139,6 @@ class ReminderServer {
136
139
  }));
137
140
  this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
138
141
  try {
139
- console.error('[调试] request.params keys = ' + JSON.stringify(Object.keys(request.params || {})));
140
142
  if (!request.params.arguments || typeof request.params.arguments !== 'object') {
141
143
  throw new McpError(ErrorCode.InvalidParams, '无效的参数');
142
144
  }
@@ -144,8 +146,8 @@ class ReminderServer {
144
146
  const args = request.params.arguments;
145
147
  const chatSessionId = resolveChatSessionId(request);
146
148
  if (!chatSessionId) {
147
- console.error('通知工具未在请求中检测到 chatSessionId(meta.chatSessionId)');
148
- const baseMsg = '解析设备失败: chatSessionId不能为空,通知工具暂无法使用';
149
+ console.error('未在请求中检测到 chatSessionId(meta.chatSessionId)');
150
+ const baseMsg = '解析设备失败: chatSessionId不能为空,工具暂无法使用';
149
151
  const errText = name === 'set_reminder'
150
152
  ? `设置失败:${baseMsg}`
151
153
  : name === 'list_reminders'
@@ -156,7 +158,7 @@ class ReminderServer {
156
158
  return { content: [{ type: 'text', text: errText }], isError: true };
157
159
  }
158
160
  else {
159
- console.error(`通知工具接收到 chatSessionId: ${chatSessionId}`);
161
+ console.error(`接收到 chatSessionId: ${chatSessionId}`);
160
162
  }
161
163
  if (name === 'set_reminder') {
162
164
  const params = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcpcn/mcp-notification",
3
- "version": "1.1.2",
3
+ "version": "1.1.5",
4
4
  "description": "系统通知MCP服务器",
5
5
  "packageManager": "yarn@1.22.22",
6
6
  "main": "dist/index.js",
@@ -36,6 +36,6 @@
36
36
  "typescript": "^5.7.2"
37
37
  },
38
38
  "dependencies": {
39
- "@modelcontextprotocol/sdk": "^1.10.0"
39
+ "@modelcontextprotocol/sdk": "^1.0.4"
40
40
  }
41
41
  }