@mcpcn/mcp-notification 1.1.3 → 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 +8 -7
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -12,10 +12,13 @@ function resolveChatSessionId(request) {
12
12
  }
13
13
  return undefined;
14
14
  };
15
- return (pick(request?.meta, ['chatSessionId', 'chatSessionID']) ??
15
+ return (pick(request?.params?._meta, ['chatSessionId', 'chatSessionID']) ??
16
16
  pick(request?.params?.meta, ['chatSessionId', 'chatSessionID']) ??
17
- pick(request?.params?._meta, ['chatSessionId', 'chatSessionID']) ??
17
+ pick(request?.meta, ['chatSessionId', 'chatSessionID']) ??
18
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']) ??
19
22
  pick(request?.params?.arguments, ['chatSessionId', 'chatSessionID']));
20
23
  }
21
24
  async function postJson(path, body, chatSessionId) {
@@ -136,17 +139,15 @@ 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
  }
143
145
  const name = request.params.name;
144
146
  const args = request.params.arguments;
145
- console.error(`收到工具调用请求: ${name}, 输入: ${JSON.stringify(args)}`);
146
147
  const chatSessionId = resolveChatSessionId(request);
147
148
  if (!chatSessionId) {
148
- console.error('通知工具未在请求中检测到 chatSessionId(meta.chatSessionId)');
149
- const baseMsg = '解析设备失败: chatSessionId不能为空,通知工具暂无法使用';
149
+ console.error('未在请求中检测到 chatSessionId(meta.chatSessionId)');
150
+ const baseMsg = '解析设备失败: chatSessionId不能为空,工具暂无法使用';
150
151
  const errText = name === 'set_reminder'
151
152
  ? `设置失败:${baseMsg}`
152
153
  : name === 'list_reminders'
@@ -157,7 +158,7 @@ class ReminderServer {
157
158
  return { content: [{ type: 'text', text: errText }], isError: true };
158
159
  }
159
160
  else {
160
- console.error(`通知工具接收到 chatSessionId: ${chatSessionId}`);
161
+ console.error(`接收到 chatSessionId: ${chatSessionId}`);
161
162
  }
162
163
  if (name === 'set_reminder') {
163
164
  const params = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcpcn/mcp-notification",
3
- "version": "1.1.3",
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
  }