Schemas
Pre-defined schemas for common resource types in MCP
MCP Schemas
MCP provides pre-defined schemas for common resource types, making it easier to create and validate resources. These schemas follow the resource-based architecture pattern and are implemented using Zod for validation.
Package Schema
The package schema defines the structure for package resources:
Schema Structure
The package schema includes the following fields:
id
: Unique identifier for the packagetype
: Always set to'package'
attributes
: Object containing:name
: Package name (follows the@repo/*
convention)version
: Semantic version stringdescription
: Package descriptiondependencies
: Object mapping dependency names to version stringsdevDependencies
: Optional object mapping dev dependency names to version stringspeerDependencies
: Optional object mapping peer dependency names to version stringskeywords
: Optional array of keyword stringsauthor
: Optional author informationlicense
: Optional license identifier
Component Schema
The component schema defines the structure for UI component resources:
Schema Structure
The component schema includes the following fields:
id
: Unique identifier for the componenttype
: Always set to'component'
attributes
: Object containing:name
: Component namedescription
: Component descriptionprops
: Object mapping prop names to prop definitions- Each prop definition includes:
type
: Data type (string, number, boolean, array, object)description
: Prop descriptiondefault
: Optional default valuerequired
: Optional boolean indicating if the prop is requiredenum
: Optional array of allowed values (for string or number types)
- Each prop definition includes:
API Schema
The API schema defines the structure for API endpoint resources:
Schema Structure
The API schema includes the following fields:
id
: Unique identifier for the API endpointtype
: Always set to'api'
attributes
: Object containing:path
: API endpoint pathmethod
: HTTP method (GET, POST, PUT, DELETE, etc.)parameters
: Object mapping parameter names to parameter definitions- Each parameter definition includes:
type
: Data typedescription
: Parameter descriptiondefault
: Optional default valuerequired
: Optional boolean indicating if the parameter is required
- Each parameter definition includes:
responses
: Object mapping status codes to response definitions- Each response definition includes:
description
: Response descriptioncontent
: Object mapping content types to schema definitions
- Each response definition includes:
Model Schema
The model schema defines the structure for data model resources:
Schema Structure
The model schema includes the following fields:
id
: Unique identifier for the modeltype
: Always set to'model'
attributes
: Object containing:name
: Model namedescription
: Model descriptionproperties
: Object mapping property names to property definitions- Each property definition includes:
type
: Data typedescription
: Property descriptionformat
: Optional format specifier (e.g., email, date-time)default
: Optional default valueenum
: Optional array of allowed values
- Each property definition includes:
required
: Array of required property names
Creating Custom Schemas
You can create custom schemas for your specific resource types: