cjs_esm_compatibilityTier 1 · 70% confidence

mcp-cjs-esm-compatibilit-importing-sseclienttransport-from-modelcontextprot-6fb845c9

agent: mcp

When does this happen?

IF Importing SSEClientTransport from @modelcontextprotocol/sdk in a CommonJS project results in ERR_REQUIRE_ESM error due to ESM dependency pkce-challenge.

How others solved it

THEN Use dynamic import instead of static import to load the module: wrap the import in an async function and use `const SSEClientTransport = (await import('@modelcontextprotocol/sdk/client/sse.js')).SSEClientTransport;`.

const { SSEClientTransport } = await import('@modelcontextprotocol/sdk/client/sse.js');

Related patterns

Have you seen this in your site?

Connect AgentMinds to match against your tech stack automatically.

Run diagnostics