Skip to content

MCP server Experimental

@elenajs/mcp is a Model Context Protocol server that exposes Elena component metadata, scaffolding tools, and authoring guidance to AI assistants. It reads the Custom Elements Manifest generated by elena build and provides resources, tools, and prompts for web component development.

WARNING

@elenajs/mcp is an experimental package and not yet ready for production use. APIs may change without notice.

Install

sh
npm install --save-dev @elenajs/mcp
sh
yarn add --dev @elenajs/mcp
sh
pnpm add --save-dev @elenajs/mcp
sh
bun add --dev @elenajs/mcp

Configuration

json
// .mcp.json
{
  "mcpServers": {
    "elena": {
      "command": "npx",
      "args": ["@elenajs/mcp"]
    }
  }
}
json
// claude_desktop_config.json
{
  "mcpServers": {
    "elena": {
      "command": "npx",
      "args": ["@elenajs/mcp"]
    }
  }
}

You can optionally pass a project root path as an argument:

json
"args": ["@elenajs/mcp", "./path/to/component-library"]

TIP

Elena MCP server reads custom-elements.json from the project’s dist/ directory. Run elena build first to generate it.

Resources

The server exposes the following resources that AI assistants can read for context:

ResourceDescription
elena://componentsJSON array of all components with summary info.
elena://components/{tagName}Full API details for a specific component: props, events, CSS properties, slots.
elena://patternsComponent authoring guide covering types, props, events, CSS, lifecycle, and best practices.
elena://frameworksFramework integration guide for Plain HTML, Eleventy, Next.js, React, Svelte, Vue, and Angular.
elena://ssrServer-side rendering guide: layout shift avoidance, @elenajs/ssr API, and Eleventy patterns.
elena://apiFull API reference for all Elena packages.

Tools

scaffold-component

Generates JavaScript and CSS boilerplate for a new Elena component. Returns file contents without writing to disk.

ParameterTypeRequiredDescription
namestringYesComponent class name in PascalCase (e.g. "DatePicker").
tagNamestringYesCustom element tag name (e.g. "elena-date-picker").
propsArray<{ name, type?, default?, description? }>NoProps to define.
eventsstring[]NoEvent names to delegate.
cssPropertiesArray<{ name, description? }>NoCSS custom properties.
descriptionstringNoComponent description for JSDoc.
status"alpha" | "beta" | "stable"NoComponent status (default: "alpha").
cssEncapsulationbooleanNoInclude the all:unset encapsulation reset in CSS (default: true).
ssrbooleanNoInclude :scope:not([hydrated]) pre-hydration styles to avoid layout shift (default: false).

lookup-component

Queries API details for an existing component by tag name or class name. Returns props, events, CSS properties, slots, and metadata.

ParameterTypeRequiredDescription
namestringYesComponent tag name (e.g. "elena-button") or class name (e.g. "Button").

get-patterns

Returns the Elena component authoring guide (same content as elena://patterns).

get-api-reference

Returns the full API reference for all Elena packages (same content as elena://api).

get-frameworks-guide

Returns the framework integration guide (same content as elena://frameworks).

get-ssr-guide

Returns the server-side rendering guide (same content as elena://ssr).

Prompts

create-component

A guided workflow for creating new Elena components. The AI assistant asks about props, events, and CSS properties, then generates boilerplate using the scaffold-component tool.

review-component

A best-practices review checklist for existing Elena components. Pass your component's JavaScript (and optionally CSS) code to get a structured review covering props, JSDoc, CSS isolation, hydration, and framework compatibility.

Skills Pre-release

Elena also provices agent skills to complement the @elenajs/mcp. Once installed, your coding agent automatically has context on Elena component authoring patterns without additional setup. Use skills for general authoring guidance; use MCP when you need dynamic tools like component scaffolding and CEM lookup.

Install

sh
npx skills add https://elenajs.com

The CLI fetches the skills index and lets you choose which skills to install. Skills are then written into your agent’s configuration and loaded automatically when needed.

Available skills

SkillDescription
elena-authoringComponent types, props, events, templates, lifecycle, mixins and framework compatibility rules.
elena-stylesCSS encapsulation, reset, SSR hydration patterns, theming and browser bug workarounds.
elena-toolingBundler config, CLI scaffolding, Custom Elements Manifest, server-side rendering and TypeScript.