Skip to content

Commit 2a07274

Browse files
Fix Zod type compatibility with @modelcontextprotocol/sdk
The SDK imports Zod from 'zod/v4' while this package imported from 'zod'. Although both resolve to the same version (3.25.x), TypeScript sees them as separate modules with incompatible type declarations. This caused type errors when: - Extending SDK schemas like RequestSchema.extend() - Passing SDK schemas to setRequestHandler/setNotificationHandler - Using ZodObject/ZodLiteral types from different import paths Changes: - Import zod from 'zod/v4' to match SDK import path - Update z.record() calls to use Zod v4 signature (requires both key and value schemas) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent fff93a4 commit 2a07274

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/app-bridge.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
2-
import { ZodLiteral, ZodObject } from "zod";
2+
import { ZodLiteral, ZodObject } from "zod/v4";
33

44
import { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
55
import {

src/types.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import {
1212
Tool,
1313
ToolSchema,
1414
} from "@modelcontextprotocol/sdk/types.js";
15-
import { z } from "zod";
15+
import { z } from "zod/v4";
1616

1717
/**
1818
* Type-level assertion that validates a Zod schema produces the expected interface.
@@ -314,7 +314,7 @@ export interface McpUiToolInputNotification {
314314
export const McpUiToolInputNotificationSchema = z.object({
315315
method: z.literal("ui/notifications/tool-input"),
316316
params: z.object({
317-
arguments: z.record(z.unknown()).optional(),
317+
arguments: z.record(z.string(), z.unknown()).optional(),
318318
}),
319319
});
320320

@@ -353,7 +353,7 @@ export interface McpUiToolInputPartialNotification {
353353
export const McpUiToolInputPartialNotificationSchema = z.object({
354354
method: z.literal("ui/notifications/tool-input-partial"),
355355
params: z.object({
356-
arguments: z.record(z.unknown()).optional(),
356+
arguments: z.record(z.string(), z.unknown()).optional(),
357357
}),
358358
});
359359

0 commit comments

Comments
 (0)