diff --git a/.changeset/legacy-module-resolution-types.md b/.changeset/legacy-module-resolution-types.md new file mode 100644 index 000000000..c12cb839d --- /dev/null +++ b/.changeset/legacy-module-resolution-types.md @@ -0,0 +1,10 @@ +--- +'@modelcontextprotocol/client': patch +'@modelcontextprotocol/server': patch +'@modelcontextprotocol/node': patch +'@modelcontextprotocol/express': patch +'@modelcontextprotocol/fastify': patch +'@modelcontextprotocol/hono': patch +--- + +Add top-level `types` field (and `typesVersions` on client/server for their subpath exports) so consumers on legacy `moduleResolution: "node"` can resolve type declarations. The `exports` map remains the source of truth for `nodenext`/`bundler` resolution. The `typesVersions` map includes entries for subpaths added by sibling PRs in this series (`zod-schemas`, `stdio`); those entries are no-ops until the corresponding `dist/*.d.mts` files exist. diff --git a/packages/client/package.json b/packages/client/package.json index cf9dbff6b..39f3a22ea 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -92,5 +92,16 @@ "typescript-eslint": "catalog:devTools", "vitest": "catalog:devTools", "tsdown": "catalog:devTools" + }, + "types": "./dist/index.d.mts", + "typesVersions": { + "*": { + "validators/cf-worker": [ + "dist/validators/cfWorker.d.mts" + ], + "stdio": [ + "dist/stdio.d.mts" + ] + } } } diff --git a/packages/middleware/express/package.json b/packages/middleware/express/package.json index 39d671b81..c7e5763ae 100644 --- a/packages/middleware/express/package.json +++ b/packages/middleware/express/package.json @@ -63,5 +63,6 @@ "typescript": "catalog:devTools", "typescript-eslint": "catalog:devTools", "vitest": "catalog:devTools" - } + }, + "types": "./dist/index.d.mts" } diff --git a/packages/middleware/fastify/package.json b/packages/middleware/fastify/package.json index d3d4c352b..0cb8eff24 100644 --- a/packages/middleware/fastify/package.json +++ b/packages/middleware/fastify/package.json @@ -61,5 +61,6 @@ "typescript": "catalog:devTools", "typescript-eslint": "catalog:devTools", "vitest": "catalog:devTools" - } + }, + "types": "./dist/index.d.mts" } diff --git a/packages/middleware/hono/package.json b/packages/middleware/hono/package.json index f23c9ccb6..497f2b127 100644 --- a/packages/middleware/hono/package.json +++ b/packages/middleware/hono/package.json @@ -61,5 +61,6 @@ "typescript": "catalog:devTools", "typescript-eslint": "catalog:devTools", "vitest": "catalog:devTools" - } + }, + "types": "./dist/index.d.mts" } diff --git a/packages/middleware/node/package.json b/packages/middleware/node/package.json index 7fcaf9106..a284ea597 100644 --- a/packages/middleware/node/package.json +++ b/packages/middleware/node/package.json @@ -67,5 +67,6 @@ "typescript": "catalog:devTools", "typescript-eslint": "catalog:devTools", "vitest": "catalog:devTools" - } + }, + "types": "./dist/index.d.mts" } diff --git a/packages/server/package.json b/packages/server/package.json index b40135ec9..163583e5c 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -87,5 +87,19 @@ "typescript": "catalog:devTools", "typescript-eslint": "catalog:devTools", "vitest": "catalog:devTools" + }, + "types": "./dist/index.d.mts", + "typesVersions": { + "*": { + "validators/cf-worker": [ + "dist/validators/cfWorker.d.mts" + ], + "zod-schemas": [ + "dist/zodSchemas.d.mts" + ], + "stdio": [ + "dist/stdio.d.mts" + ] + } } }