Skip to main content

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 package
  • type: Always set to 'package'
  • attributes: Object containing:
    • name: Package name (follows the @repo/* convention)
    • version: Semantic version string
    • description: Package description
    • dependencies: Object mapping dependency names to version strings
    • devDependencies: Optional object mapping dev dependency names to version strings
    • peerDependencies: Optional object mapping peer dependency names to version strings
    • keywords: Optional array of keyword strings
    • author: Optional author information
    • license: 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 component
  • type: Always set to 'component'
  • attributes: Object containing:
    • name: Component name
    • description: Component description
    • props: Object mapping prop names to prop definitions
      • Each prop definition includes:
        • type: Data type (string, number, boolean, array, object)
        • description: Prop description
        • default: Optional default value
        • required: Optional boolean indicating if the prop is required
        • enum: Optional array of allowed values (for string or number types)

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 endpoint
  • type: Always set to 'api'
  • attributes: Object containing:
    • path: API endpoint path
    • method: HTTP method (GET, POST, PUT, DELETE, etc.)
    • parameters: Object mapping parameter names to parameter definitions
      • Each parameter definition includes:
        • type: Data type
        • description: Parameter description
        • default: Optional default value
        • required: Optional boolean indicating if the parameter is required
    • responses: Object mapping status codes to response definitions
      • Each response definition includes:
        • description: Response description
        • content: Object mapping content types to schema definitions

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 model
  • type: Always set to 'model'
  • attributes: Object containing:
    • name: Model name
    • description: Model description
    • properties: Object mapping property names to property definitions
      • Each property definition includes:
        • type: Data type
        • description: Property description
        • format: Optional format specifier (e.g., email, date-time)
        • default: Optional default value
        • enum: Optional array of allowed values
    • required: Array of required property names

Creating Custom Schemas

You can create custom schemas for your specific resource types: