Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/validators-subpath-only.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@modelcontextprotocol/server': patch
'@modelcontextprotocol/client': patch
---

`AjvJsonSchemaValidator`, `CfWorkerJsonSchemaValidator` and `CfWorkerSchemaDraft` types are now only exported from the `/validators/ajv` and `/validators/cf-worker` subpaths, not the package root. The codemod already routes v1 imports there.
2 changes: 2 additions & 0 deletions packages/client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ The MCP (Model Context Protocol) TypeScript client SDK. Build MCP clients that c
npm install @modelcontextprotocol/client@alpha
```

TypeScript ≥6.0 no longer auto-includes `@types/*` — add `"types": ["node"]` to your `tsconfig.json` `compilerOptions` (the published `.d.mts` references `Buffer`).

## Documentation

- **[Repository README](https://github.com/modelcontextprotocol/typescript-sdk#readme)** — overview, package layout, examples
Expand Down
3 changes: 2 additions & 1 deletion packages/client/tsdown.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ export default defineConfig({
shims: true,
dts: {
resolver: 'tsc',
resolve: ['ajv', 'ajv-formats'],
resolve: ['ajv', 'ajv-formats', 'json-schema-typed'],
compilerOptions: {
baseUrl: '.',
paths: {
'fast-uri': ['../core/src/validators/fastUriShim.d.ts'],
'@modelcontextprotocol/core': ['../core/src/index.ts'],
'@modelcontextprotocol/core/public': ['../core/src/exports/public/index.ts'],
'@modelcontextprotocol/core/validators/ajv': ['../core/src/validators/ajvProvider.ts'],
Expand Down
8 changes: 4 additions & 4 deletions packages/core/src/exports/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,10 @@ export {
export type { SpecTypeName, SpecTypes } from '../../types/specTypeSchema.js';
export { isSpecType, specTypeSchemas } from '../../types/specTypeSchema.js';
export type { StandardSchemaV1, StandardSchemaV1Sync, StandardSchemaWithJSON } from '../../util/standardSchema.js';
// Validator providers are type-only here — import the runtime classes from the explicit
// `@modelcontextprotocol/{client,server}/validators/{ajv,cf-worker}` subpaths to customise.
export type { AjvJsonSchemaValidator } from '../../validators/ajvProvider.js';
export type { CfWorkerJsonSchemaValidator, CfWorkerSchemaDraft } from '../../validators/cfWorkerProvider.js';
// Validator provider classes (`AjvJsonSchemaValidator`, `CfWorkerJsonSchemaValidator`) are
// intentionally NOT re-exported here — import them from the explicit
// `@modelcontextprotocol/{client,server}/validators/{ajv,cf-worker}` subpaths so the
// root entrypoint's bundled `.d.mts` doesn't pull the inlined ajv/cfworker type chunks.
Comment thread
claude[bot] marked this conversation as resolved.
// fromJsonSchema is intentionally NOT exported here — the server and client packages
// provide runtime-aware wrappers that default to the appropriate validator via _shims.
export type { JsonSchemaType, JsonSchemaValidator, jsonSchemaValidator, JsonSchemaValidatorResult } from '../../validators/types.js';
24 changes: 24 additions & 0 deletions packages/core/src/validators/fastUriShim.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* dts-bundling shim for `fast-uri`.
*
* ajv@8.18.0's published .d.ts does `import { URIComponent } from "fast-uri"`,
* but fast-uri ships its types as `export = namespace`, which rolldown's dts
* bundler can't destructure into a named import — it drops the import and
* leaves a dangling `URIComponent` reference in the bundled .d.mts (TS2304 for
* downstream consumers with `skipLibCheck: false`).
*
* The server/client tsdown configs map `fast-uri` to this file via
* `dts.compilerOptions.paths` so the type is inlined as a plain named export.
* Runtime code is unaffected (this is a `.d.ts`; the path mapping is dts-only).
*/
export interface URIComponent {
scheme?: string;
userinfo?: string;
host?: string;
port?: number | string;
path?: string;
query?: string;
fragment?: string;
reference?: string;
error?: string;
}
7 changes: 0 additions & 7 deletions packages/middleware/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,6 @@
}
},
"types": "./dist/index.d.mts",
"typesVersions": {
"*": {
"sse": [
"dist/sse.d.mts"
]
}
},
"files": [
"dist"
],
Expand Down
2 changes: 2 additions & 0 deletions packages/server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ The MCP (Model Context Protocol) TypeScript server SDK. Build MCP servers that e
npm install @modelcontextprotocol/server@alpha
```

TypeScript ≥6.0 no longer auto-includes `@types/*` — add `"types": ["node"]` to your `tsconfig.json` `compilerOptions` (the published `.d.mts` references `Buffer`).

Optional framework adapters: [`@modelcontextprotocol/express`](https://www.npmjs.com/package/@modelcontextprotocol/express), [`@modelcontextprotocol/hono`](https://www.npmjs.com/package/@modelcontextprotocol/hono),
[`@modelcontextprotocol/node`](https://www.npmjs.com/package/@modelcontextprotocol/node).

Expand Down
3 changes: 2 additions & 1 deletion packages/server/tsdown.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ export default defineConfig({
shims: true,
dts: {
resolver: 'tsc',
resolve: ['ajv', 'ajv-formats'],
resolve: ['ajv', 'ajv-formats', 'json-schema-typed'],
Comment thread
claude[bot] marked this conversation as resolved.
compilerOptions: {
baseUrl: '.',
paths: {
'fast-uri': ['../core/src/validators/fastUriShim.d.ts'],
'@modelcontextprotocol/core': ['../core/src/index.ts'],
'@modelcontextprotocol/core/public': ['../core/src/exports/public/index.ts'],
'@modelcontextprotocol/core/validators/ajv': ['../core/src/validators/ajvProvider.ts'],
Expand Down
Loading