Skip to content

Cannot find package '@modelcontextprotocol/sdk'

Spec
2026-07-28
Evidence
E2Reproducedarm64
TypeScript SDK (server)
@modelcontextprotocol/server@2.4.0
TypeScript SDK v1
@modelcontextprotocol/sdk@1.32.2
Verified

The TypeScript SDK v2 split @modelcontextprotocol/sdk into @modelcontextprotocol/server, @modelcontextprotocol/client and adapter packages. Code from a v1 tutorial fails at import time. We installed only @modelcontextprotocol/server 2.4.0 and ran three typical v1 imports:

v1 import Error
from '@modelcontextprotocol/sdk/server/mcp.js' Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@modelcontextprotocol/sdk' imported from …
from '@modelcontextprotocol/server/mcp.js' Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './mcp.js' is not defined by "exports" in …/@modelcontextprotocol/server/package.json
import { StdioServerTransport } from '@modelcontextprotocol/server' SyntaxError: The requested module '@modelcontextprotocol/server' does not provide an export named 'StdioServerTransport'

The process exits before it can answer, so a client shows Connection closed.

v2 has no deep paths such as /server/mcp.js or /server/stdio.js. Import from the package root, or from the few subpaths it exports:

// v1
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
// v2
import { McpServer } from '@modelcontextprotocol/server';
import { serveStdio } from '@modelcontextprotocol/server/stdio';

If you are not ready to migrate, install v1 on purpose: npm install @modelcontextprotocol/sdk@1. It is still published (1.32.2 at the time of writing) and its clients talk to v2 servers.

Some v1 classes are gone, so the name is missing even from the right package. StdioServerTransport with server.connect() became serveStdio(factory); the Node.js HTTP transport moved to @modelcontextprotocol/node. Follow Upgrade from TypeScript SDK v1 to v2 rather than renaming imports one by one.

Sources

MCPDev is community documentation. It is not affiliated with the Model Context Protocol project or with the vendors of the clients it covers.