Skip to content

Conversation

@tonxxd
Copy link

@tonxxd tonxxd commented Nov 30, 2025

Changes import * as z from 'zod/v4' to import z from 'zod/v4' (namespace import to default import) across all files that use zod/v4 to fix compatibility with Deno environments using esm.sh.

This change fixes issue #1182 where the SDK causes a TypeError: e.custom is not a function when deployed to Deno environments (like Supabase Edge Functions) and loaded via esm.sh.
When esm.sh bundles the SDK for Deno, the zod/v4 module's named exports (z.custom, z.string, z.object, etc.) are not available on the namespace import. With import * as z, these functions become undefined. They only exist on z.default.

How Has This Been Tested?

  • npm run typecheck
  • Build succeeds
  • Created and ran Deno test scripts to reproduce the issue and verify the fix

Breaking Changes

None

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

Impact:

@tonxxd tonxxd requested review from a team as code owners November 30, 2025 17:01
@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 30, 2025

Open in StackBlitz

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/sdk@1194 

commit: 794eeeb

Copy link
Contributor

@KKonstantinov KKonstantinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@KKonstantinov
Copy link
Contributor

@modelcontextprotocol/typescript-sdk-auth - need approval on this one.

@mattzcarey
Copy link
Contributor

I'm not sure how we keep this in sync in future

tonxxd added a commit to mcp-use/mcp-ts-sdk-fork that referenced this pull request Dec 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants