@decocms/runtime 1.0.0 → 1.0.2

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decocms/runtime",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
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
- "@deco/mcp": "npm:@jsr/deco__mcp@0.7.8",
12
11
  "@decocms/bindings": "1.0.1-alpha.27",
13
- "@modelcontextprotocol/sdk": "1.20.2",
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/events.ts CHANGED
@@ -92,7 +92,7 @@ export type EventHandlers<
92
92
  > = [TSchema] extends [never]
93
93
  ? Record<string, never>
94
94
  :
95
- | BatchHandler<z.infer<TSchema>> // Global handler with events
95
+ | BatchHandler<Env> // Global handler with events
96
96
  | {
97
97
  [K in keyof z.infer<TSchema> as z.infer<TSchema>[K] extends {
98
98
  __type: string;
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";
@@ -331,7 +331,7 @@ export interface CreateMCPServerOptions<
331
331
  before?: (env: TEnv) => Promise<void> | void;
332
332
  oauth?: OAuthConfig;
333
333
  events?: {
334
- bus?: keyof PickByType<TEnv, EventBusBindingClient>;
334
+ bus?: keyof PickByType<State, EventBusBindingClient>;
335
335
  handlers?: EventHandlers<TEnv, TSchema>;
336
336
  };
337
337
  configuration?: {
@@ -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.handleMessage(req);
619
+ return await transport.handleRequest(req);
618
620
  };
619
621
 
620
622
  const callTool: CallTool = async ({ toolCallId, toolCallInput }) => {