Skip to main content

MCP server

The same engine, handed to an agent

xtyle mcp is a Model Context Protocol server built into @xtyle/core. It hands an agent the same capabilities the CLI hands a human, over one stdio connection: every derivation and proof as a callable tool, the concept docs and every component manifest as resources. Each tool runs the same code its CLI counterpart runs, so the two can't drift.

Run it

The server is a subcommand of the xtyle bin. Configure your MCP client to launch it over stdio. The npx form needs no global install.

xtyle mcp
{
  "mcpServers": {
    "xtyle": {
      "command": "npx",
      "args": ["-y", "@xtyle/core", "xtyle", "mcp"]
    }
  }
}

Tools

xtyle_components is the one to reach for first when building against xtyle: it returns token names and prop shapes from the manifest, so an agent works from what ships rather than a guess.

ToolWhat it does
xtyle_derive Run an algorithm over seed colors or pinned tokens and emit the register (css, json, theme, prism, monaco).
xtyle_coverage Check that a derived register covers a component's consumedTokens, an explicit token list, or every shipped component.
xtyle_audit Grade a derived theme against xtyle's canonical text/fill pairs at the WCAG floors: a per-pair AAA/AA/fail tier plus tallies.
xtyle_components List every component, or describe one's full manifest: props, variants, states, slots, consumedTokens, a11y, examples.
xtyle_gauntlet Prove an algorithm's invariants across randomized inputs (one algorithm or all).
xtyle_list_algorithms List the algorithm ids and the emit formats.
xtyle_server_info Report the running server's name, version, and build timestamp.

Resources

It serves xtyle's own docs and contracts straight from the package, so an agent's answers track what ships rather than its training memory.

ResourceWhat it serves
xtyle://concept/{id} The concept narrative: overview, open-register, algorithms, consuming.
xtyle://component/{id} Every component manifest as JSON, the same data the reference pages render.

Why it matters

Agents are first-class consumers of xtyle. Without the server an agent guesses at token names, can't check coverage without a human at a terminal, and answers theory questions from stale memory. The MCP closes that loop: derive, check, and introspect the contract in one place, grounded in what the package actually ships.

Pairs with the engine, not a replacement for it
The MCP runs the same engine the CLI and the browser run. A derived theme is still just CSS custom properties: nothing about consuming one depends on the server.