Installation

Usage Guides

Reference

Commands

Language Server

MCP Server

MCP Server

Model Context Protocol server for custom elements. See MCP Integration for setup.

MCP Resources

URIDescription
cem://schemaJSON schema for custom elements manifests
cem://packagesPackage discovery and overview of available manifest packages
cem://elementsSummaries of all available elements with capabilities and metadata
cem://element/{tagName}Detailed element information including attributes, slots, events, CSS properties, parts, and states
cem://element/{tagName}/attributesAttribute documentation with type constraints, valid values, and usage patterns
cem://element/{tagName}/slotsContent guidelines and accessibility considerations for slots
cem://element/{tagName}/eventsEvent triggers, data payloads, and JavaScript integration patterns
cem://element/{tagName}/css/partsCSS parts styling guidance
cem://element/{tagName}/css/custom-propertiesCSS custom properties documentation
cem://element/{tagName}/css/statesCSS custom states documentation
cem://guidelinesDesign system guidelines and best practices
cem://accessibilityAccessibility patterns and validation rules
cem://configCurrent resolved configuration (merged from file + workspace cascade)
cem://config/schemaOverview of all config schema sections with links to per-section detail
cem://config/schema/{section}JSON schema for a specific config section (generate, serve, health, mcp, export, warnings)

MCP Tools

generate_html

Generate correct HTML structure with proper slots and attributes using manifest data.

ParameterTypeRequiredDescription
tagNamestringElement to generate HTML for
attributesobjectAttribute values to include
contentobjectSlot content mapping

validate_html

Validates custom element usage based on manifest guidelines.

ParameterTypeRequiredDescription
htmlstringHTML content to validate
tagNamestringFocus validation on specific element
contextstringValidation context for custom elements

Validation Types:

  • Slot content guidelines
  • Attribute conflicts (e.g., loading="eager" + lazy="true")
  • Content/attribute redundancy
  • Manifest compliance

generate_config

Generate or update CEM configuration for a project. Returns the current config, config file path, full JSON schema, and guidance for each config section. Use with an optional focus parameter to narrow to a specific section.

ParameterTypeRequiredDescription
focusstringConfig section to focus on: generate, serve, health, mcp, export, or warnings. Omit for all sections.

validate_config

Validate the current CEM configuration file. Runs schema validation and semantic checks (glob reachability, output path existence, URL rewrite validation). Returns structured JSON with errors and warnings, each with field path and source position.

No parameters required.

Configuration

Claude Desktop

{
  "mcpServers": {
    "cem": {
      "command": "cem",
      "args": ["mcp"]
    }
  }
}

Other Clients

Configure stdio transport with command cem mcp. See MCP specification for details.

Server Options

cem mcp [flags]

Flags:

  • --package <path> - Specify project directory or package specifier (npm:, jsr:, or URL)
  • --additional-packages <specs> - Load additional packages alongside local project (repeatable)
  • --max-description-length <num> - Override 2000 character description limit
  • --verbose, -v - Increase verbosity (-v info, -vv debug, -vvv trace)
  • --quiet, -q - Quiet output (warnings and errors only)

Loading Additional Packages

Load elements from external packages that aren’t in your local project:

# Single additional package
cem mcp --additional-packages npm:@rhds/elements@2.0.0

# Multiple packages
cem mcp --additional-packages npm:@vaadin/button@24.3.5 \
        --additional-packages https://cdn.jsdelivr.net/npm/@example/components/

Or configure in .config/cem.yaml:

additionalPackages:
  - npm:@rhds/elements@2.0.0
  - https://cdn.jsdelivr.net/npm/@shortfuse/materialdesignweb/