You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
alpha.3: CfWorkerJsonSchemaValidator and AjvJsonSchemaValidator declared in types but missing from runtime index.mjs export #2391
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.
export{BAGGAGE_META_KEY,CLIENT_CAPABILITIES_META_KEY, ...,fromJsonSchema,getDisplayName, ...,validateHostHeader};// No CfWorkerJsonSchemaValidator, no AjvJsonSchemaValidator
Subpath exports work correctly
The package.json exports field includes subpath entries that DO export them at runtime:
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.
Root cause: \packages/server/src/index.ts\ didn't re-export \AjvJsonSchemaValidator, \CfWorkerJsonSchemaValidator, or \CfWorkerSchemaDraft\ — so the runtime bundle omitted them even though the type declarations already listed them.
Fix: Added 3 re-export lines to \packages/server/src/index.ts:
\export { Ajv, addFormats, AjvJsonSchemaValidator } from '@modelcontextprotocol/core-internal/validators/ajv'\
\export type { CfWorkerSchemaDraft } from '@modelcontextprotocol/core-internal/validators/cfWorker'\
\export { CfWorkerJsonSchemaValidator } from '@modelcontextprotocol/core-internal/validators/cfWorker'\
Subpath imports (@modelcontextprotocol/server/validators/ajv, @modelcontextprotocol/server/validators/cf-worker) are unchanged.
@felixweinberger or any maintainer — could you pull this in? The repo appears to restrict cross-fork PRs.
Opened a narrow draft PR for the current CJS declaration/runtime mismatch: #2432.\n\nThe fix keeps the validator provider classes on the documented validator subpaths and removes them from the client/server root declaration barrels, so CJS consumers fail at type-check time instead of compiling root imports that resolve to undefined at runtime.
Activity
fuleinist commentedon Jul 1, 2026
I have a fix ready on my fork: fuleinist#1
Root cause: \packages/server/src/index.ts\ didn't re-export \AjvJsonSchemaValidator, \CfWorkerJsonSchemaValidator, or \CfWorkerSchemaDraft\ — so the runtime bundle omitted them even though the type declarations already listed them.
Fix: Added 3 re-export lines to \packages/server/src/index.ts:
Subpath imports (@modelcontextprotocol/server/validators/ajv, @modelcontextprotocol/server/validators/cf-worker) are unchanged.
@felixweinberger or any maintainer — could you pull this in? The repo appears to restrict cross-fork PRs.
felixweinberger commentedon Jul 2, 2026
Thanks for the report - taking a look
morluto commentedon Jul 3, 2026
Opened a narrow draft PR for the current CJS declaration/runtime mismatch: #2432.\n\nThe fix keeps the validator provider classes on the documented validator subpaths and removes them from the client/server root declaration barrels, so CJS consumers fail at type-check time instead of compiling root imports that resolve to
undefinedat runtime.