@decocms/runtime 1.0.1 → 1.0.3
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/package.json +3 -4
- package/src/tools.ts +6 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@decocms/runtime",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"check": "tsc --noEmit",
|
|
@@ -8,9 +8,8 @@
|
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@cloudflare/workers-types": "^4.20250617.0",
|
|
11
|
-
"@
|
|
12
|
-
"@
|
|
13
|
-
"@modelcontextprotocol/sdk": "1.20.2",
|
|
11
|
+
"@decocms/bindings": "1.0.3",
|
|
12
|
+
"@modelcontextprotocol/sdk": "1.25.1",
|
|
14
13
|
"@ai-sdk/provider": "^2.0.0",
|
|
15
14
|
"hono": "^4.10.7",
|
|
16
15
|
"jose": "^6.0.11",
|
package/src/tools.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/* oxlint-disable no-explicit-any */
|
|
2
2
|
/* oxlint-disable ban-types */
|
|
3
|
-
import { HttpServerTransport } from "@deco/mcp/http";
|
|
4
3
|
import {
|
|
5
4
|
OnEventsInputSchema,
|
|
6
5
|
OnEventsOutputSchema,
|
|
7
6
|
type EventBusBindingClient,
|
|
8
7
|
} from "@decocms/bindings";
|
|
9
8
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
9
|
+
import { WebStandardStreamableHTTPServerTransport as HttpServerTransport } from "@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";
|
|
10
10
|
import type { GetPromptResult } from "@modelcontextprotocol/sdk/types.js";
|
|
11
11
|
import { z } from "zod";
|
|
12
12
|
import { zodToJsonSchema } from "zod-to-json-schema";
|
|
@@ -418,7 +418,7 @@ const toolsFor = <TSchema extends z.ZodTypeAny = never>({
|
|
|
418
418
|
if (events && state && bus) {
|
|
419
419
|
// Sync subscriptions - always call to handle deletions too
|
|
420
420
|
const subscriptions = Event.subscriptions(
|
|
421
|
-
events?.handlers ?? {},
|
|
421
|
+
events?.handlers ?? ({} as Record<string, never>),
|
|
422
422
|
state,
|
|
423
423
|
);
|
|
424
424
|
await bus.EVENT_SYNC_SUBSCRIPTIONS({ subscriptions });
|
|
@@ -594,7 +594,9 @@ export const createMCPServer = <
|
|
|
594
594
|
{
|
|
595
595
|
title: prompt.title,
|
|
596
596
|
description: prompt.description,
|
|
597
|
-
argsSchema: prompt.argsSchema
|
|
597
|
+
argsSchema: prompt.argsSchema
|
|
598
|
+
? (prompt.argsSchema as unknown as z.ZodRawShape)
|
|
599
|
+
: z.object({}).shape,
|
|
598
600
|
},
|
|
599
601
|
async (args) => {
|
|
600
602
|
return await prompt.execute({
|
|
@@ -614,7 +616,7 @@ export const createMCPServer = <
|
|
|
614
616
|
|
|
615
617
|
await server.connect(transport);
|
|
616
618
|
|
|
617
|
-
return await transport.
|
|
619
|
+
return await transport.handleRequest(req);
|
|
618
620
|
};
|
|
619
621
|
|
|
620
622
|
const callTool: CallTool = async ({ toolCallId, toolCallInput }) => {
|