Bug
In @modelcontextprotocol/server@2.0.0-alpha.3, CfWorkerJsonSchemaValidator and AjvJsonSchemaValidator are declared in the type declarations (dist/index.d.mts) and listed in the export type statement, but are missing from the runtime dist/index.mjs export. This causes a runtime SyntaxError when importing them from the package root.
Package version
@modelcontextprotocol/server@2.0.0-alpha.3
Reproduction
import{CfWorkerJsonSchemaValidator}from"@modelcontextprotocol/server";constvalidator=newCfWorkerJsonSchemaValidator();Results in:
SyntaxError: Export named 'CfWorkerJsonSchemaValidator' not found in module '.../dist/index.mjs'.
The same happens with AjvJsonSchemaValidator.
Evidence
Type declarations (dist/index.d.mts) — both are present
import{tasAjvJsonSchemaValidator}from"./ajvProvider-DZ_siXcF.mjs";import{tasCfWorkerJsonSchemaValidator}from"./cfWorkerProvider-DUhk5Ewx.mjs";export{ ...,AjvJsonSchemaValidator, ...,CfWorkerJsonSchemaValidator,CfWorkerSchemaDraft, ... };Runtime (dist/index.mjs) — both are absent
export{BAGGAGE_META_KEY,CLIENT_CAPABILITIES_META_KEY, ...,fromJsonSchema,getDisplayName, ...,validateHostHeader};// No CfWorkerJsonSchemaValidator, no AjvJsonSchemaValidatorSubpath exports work correctly
The package.json exports field includes subpath entries that DO export them at runtime:
{
"./validators/ajv": {
"types": "./dist/validators/ajv.d.mts",
"import": "./dist/validators/ajv.mjs"
},
"./validators/cf-worker": {
"types": "./dist/validators/cfWorker.d.mts",
"import": "./dist/validators/cfWorker.mjs"
}
}// dist/validators/cfWorker.mjsimport{tasCfWorkerJsonSchemaValidator}from"../cfWorkerProvider-BrJKpSFH.mjs";export{CfWorkerJsonSchemaValidator};So the classes exist and are exported via subpaths — the main index.mjs bundle just forgot to re-export them.
Workaround
Import from the subpath export instead of the package root:
import{CfWorkerJsonSchemaValidator}from"@modelcontextprotocol/server/validators/cf-worker";import{AjvJsonSchemaValidator}from"@modelcontextprotocol/server/validators/ajv";Expected behavior
Either:
- Re-export
CfWorkerJsonSchemaValidator and AjvJsonSchemaValidator from dist/index.mjs (matching the type declarations), or - Remove them from the
dist/index.d.mts export list if the intent is to only expose them via subpath exports.
Option 1 is preferable since the type declarations already promise these exports from the root, and consumers importing from @modelcontextprotocol/server will expect them to be available at runtime.
Bug
In
@modelcontextprotocol/server@2.0.0-alpha.3,CfWorkerJsonSchemaValidatorandAjvJsonSchemaValidatorare declared in the type declarations (dist/index.d.mts) and listed in theexporttype statement, but are missing from the runtimedist/index.mjsexport. This causes a runtimeSyntaxErrorwhen importing them from the package root.Package version
Reproduction
Results in:
The same happens with
AjvJsonSchemaValidator.Evidence
Type declarations (
dist/index.d.mts) — both are presentRuntime (
dist/index.mjs) — both are absentSubpath exports work correctly
The
package.jsonexports field includes subpath entries that DO export them at runtime:{ "./validators/ajv": { "types": "./dist/validators/ajv.d.mts", "import": "./dist/validators/ajv.mjs" }, "./validators/cf-worker": { "types": "./dist/validators/cfWorker.d.mts", "import": "./dist/validators/cfWorker.mjs" } }So the classes exist and are exported via subpaths — the main
index.mjsbundle just forgot to re-export them.Workaround
Import from the subpath export instead of the package root:
Expected behavior
Either:
CfWorkerJsonSchemaValidatorandAjvJsonSchemaValidatorfromdist/index.mjs(matching the type declarations), ordist/index.d.mtsexport list if the intent is to only expose them via subpath exports.Option 1 is preferable since the type declarations already promise these exports from the root, and consumers importing from
@modelcontextprotocol/serverwill expect them to be available at runtime.