MCP TypeScript SDK (V2) / @modelcontextprotocol/server / shimsBrowser
shimsBrowser
Classes
DefaultJsonSchemaValidator
Defined in: packages/core-internal/src/validators/cfWorkerProvider.ts:50
@cfworker/json-schema-backed JSON Schema validator. See @modelcontextprotocol/{client,server}/validators/cf-worker for the customisation entry point.
Default validates as JSON Schema 2020-12 (SEP-1613). Schemas declaring a different $schema are rejected with a plain Error. Passing an explicit draft to the constructor overrides this — that draft is used for every schema regardless of $schema.
Examples
Use with default configuration (2020-12, shortcircuit on)
const validator = new CfWorkerJsonSchemaValidator();Use with custom configuration
const validator = new CfWorkerJsonSchemaValidator({
draft: '2020-12',
shortcircuit: false // Report all errors
});Implements
Constructors
Constructor
new DefaultJsonSchemaValidator(
options?):DefaultJsonSchemaValidator
Defined in: packages/core-internal/src/validators/cfWorkerProvider.ts:64
Create a validator
Parameters
options?
Configuration options
draft?
JSON Schema draft version to force for every schema. When set, the $schema check is skipped. When omitted, the provider validates as 2020-12 and rejects schemas declaring a different $schema.
shortcircuit?
boolean
If true, stop validation after first error (default: true)
Returns
Methods
getValidator()
getValidator<
T>(schema):JsonSchemaValidator<T>
Defined in: packages/core-internal/src/validators/cfWorkerProvider.ts:77
Create a validator for the given JSON Schema
Unlike AJV, this validator is not cached internally
Type Parameters
T
T
Parameters
schema
Standard JSON Schema object
Returns
A validator function that validates input data
Implementation of
jsonSchemaValidator.getValidator
Variables
process
constprocess:object
Defined in: packages/server/src/shimsBrowser.ts:20
Type Declaration
stdin
Get Signature
get stdin():
never
Returns
never
stdout
Get Signature
get stdout():
never
Returns
never