@mcpcn/mcp-notification 1.0.18 → 1.0.19
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/dist/index.js +30 -2
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
3
3
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
|
-
import {
|
|
4
|
+
import { ErrorCode, ListToolsRequestSchema, McpError } from '@modelcontextprotocol/sdk/types.js';
|
|
5
|
+
import { z } from 'zod';
|
|
5
6
|
const API_BASE = process.env.REMINDER_API_BASE || 'https://www.mcpcn.cc/api';
|
|
6
7
|
function resolveChatSessionId(request) {
|
|
7
8
|
const pick = (obj, keys) => {
|
|
@@ -171,7 +172,34 @@ class ReminderServer {
|
|
|
171
172
|
},
|
|
172
173
|
],
|
|
173
174
|
}));
|
|
174
|
-
|
|
175
|
+
const CallToolWithMetaSchema = z
|
|
176
|
+
.object({
|
|
177
|
+
jsonrpc: z.literal('2.0'),
|
|
178
|
+
method: z.literal('tools/call'),
|
|
179
|
+
id: z.union([z.string(), z.number()]),
|
|
180
|
+
params: z
|
|
181
|
+
.object({
|
|
182
|
+
name: z.string(),
|
|
183
|
+
arguments: z.any().optional(),
|
|
184
|
+
_meta: z
|
|
185
|
+
.object({
|
|
186
|
+
chatSessionId: z.string().optional(),
|
|
187
|
+
chatSessionID: z.string().optional(),
|
|
188
|
+
})
|
|
189
|
+
.passthrough()
|
|
190
|
+
.optional(),
|
|
191
|
+
meta: z
|
|
192
|
+
.object({
|
|
193
|
+
chatSessionId: z.string().optional(),
|
|
194
|
+
chatSessionID: z.string().optional(),
|
|
195
|
+
})
|
|
196
|
+
.passthrough()
|
|
197
|
+
.optional(),
|
|
198
|
+
})
|
|
199
|
+
.passthrough(),
|
|
200
|
+
})
|
|
201
|
+
.passthrough();
|
|
202
|
+
this.server.setRequestHandler(CallToolWithMetaSchema, async (request) => {
|
|
175
203
|
try {
|
|
176
204
|
if (!request.params.arguments || typeof request.params.arguments !== 'object') {
|
|
177
205
|
throw new McpError(ErrorCode.InvalidParams, '无效的参数');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mcpcn/mcp-notification",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.19",
|
|
4
4
|
"description": "系统通知MCP服务器",
|
|
5
5
|
"packageManager": "yarn@1.22.22",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"typescript": "^5.7.2"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@modelcontextprotocol/sdk": "^1.10.0"
|
|
39
|
+
"@modelcontextprotocol/sdk": "^1.10.0",
|
|
40
|
+
"zod": "^3.25.76"
|
|
40
41
|
}
|
|
41
42
|
}
|