stnd.build

Model Context Protocol (@stnd/mcp)

How the Standard Model Context Protocol server connects AI agents and developers to framework laws, design tokens, HTML utilities, and architectural linters.

@stnd/mcp is the official Model Context Protocol server for the Standard framework. It acts as an active bridge between the repository invariants and modern AI coding assistants (such as Antigravity, Cursor, Windsurf, Claude Code, and Zed), ensuring that code generation is guided by verified design tokens, semantic utility classes, unified hook contracts, and automated architectural audits.


1. Why an MCP Server for Standard?

Large Language Models have been trained on millions of generic web applications. By default, they tend to reach for outdated or conflicting patterns: adding .primary or .btn-primary classes, writing raw hex codes (#3b82f6) in CSS, inventing arbitrary token names, scattering direct database calls across .astro templates, or importing sibling modules across vertical boundaries.

@stnd/mcp eliminates this cognitive drift by providing:

  1. Dynamic Token Introspection: Real-time extraction of the 380+ active design tokens directly from packages/styles/_standard-*.scss.
  2. HTML Utilities & Component Vocabulary: Live catalog of the Swiss grid, hybrid spacing, flexbox helpers, and button/card grammars.
  3. Automated Architectural Audits: High-speed compliance scanners that check code against the 8 non-negotiable laws and the Vanilla-First styling policy before anything is committed.

2. Server Transports & Configuration

Standard MCP is available in two complementary transport modes: Remote Server (SSE/HTTP) hosted live on stnd.build, and Local Process (StdIO) running from the monorepo.

Any AI assistant (Cursor, Windsurf, Claude Desktop, Antigravity, Zed, Remote Agents) can connect directly to the live endpoint hosted on Cloudflare Workers without cloning the repo or installing dependencies:

{
  "mcpServers": {
    "standard": {
      "url": "https://stnd.build/api/mcp"
    }
  }
}

The remote endpoint provides live access to all 380+ tokens, Swiss utilities, unified hooks contracts, and realtime code linting (stnd_lint_markup, stnd_lint_markdown) with full CORS support and Server-Sent Events (SSE) streaming.

Option B: Local CLI Server via StdIO (Monorepo Development)

When developing locally inside the repository, run the local StdIO binary to enable full filesystem access for disk-level audits (stnd_audit_app, stnd_audit_module):

# Start the local MCP server via Node
node packages/mcp/bin/stnd-mcp.js

# Run the repo-wide architectural audit
node packages/mcp/tests/audit-all-apps.js

In your local client configuration:

{
  "mcpServers": {
    "standard": {
      "command": "node",
      "args": ["/absolute/path/to/utopie/packages/mcp/bin/stnd-mcp.js"]
    }
  }
}

3. Protocol Resources

@stnd/mcp exposes four read-only resources under the stnd:// URI scheme:

Resource URI Description Output Format
stnd://framework/laws The eight inviolable laws and core conventions (Vanilla First, Obsidian markdown rules, zero literal colors). JSON
stnd://framework/hooks The complete specification for the Unified Hooks System (runHook, runPipeline, <Hook zone="..." />, action extensions, and server: true invariants). JSON
stnd://framework/tokens Dynamically parsed catalog of all 380+ design tokens grouped by category (colors, spaces, font, radius, transitions). JSON
stnd://framework/utilities The catalog of 60+ HTML layout classes, Swiss grid helpers, and semantic component structures. JSON
stnd://crafts/all The Three Crafts overview (Writer, Builder, Craftsman) with mental models, constraints, and commands. JSON
stnd://crafts/writer Master Blueprint for Writers (Markdown conventions, frontmatter lifecycle, digital garden). JSON
stnd://crafts/builder Master Blueprint for Builders (vertical slices, Cloudflare edge, the 8 laws). JSON
stnd://crafts/craftsman Master Blueprint for Craftsmen (OKLCH tokens, 1rlh harmonics, live Workshop ]). JSON
stnd://cookbook/all The progressive cookbook recipes (0 to 7) with scaffolding commands and topologies. JSON

4. Auditor & Query Tools

@stnd/mcp exposes specialized tools that agents and CLI scripts call during development:

stnd_get_craft_guide

Returns the architectural blueprint, mental model, and specific laws for a craft persona (writer, builder, craftsman).

stnd_get_cookbook_recipe

Looks up progressive Standard cookbook recipes (patterns, landing, blog, add-anything, garden, intention, photo) with CLI commands and architectural patterns.

stnd_get_utilities

Searches HTML utility classes and component vocabulary. Accepts optional filters for category (layout_flexbox, layout_grid, spacing, typography, components) and search queries (e.g. "button", "card", "gap").

stnd_get_tokens

Retrieves design tokens matching a category (colors, spacing, typography, radii) or keyword query (e.g. "surface", "accent", "mono").

stnd_get_hooks_info

Returns hook specifications, registration rules, and details on specific hooks (e.g. "note:render", "launcher:action").

stnd_audit_app

Performs an exhaustive architectural audit of an entire application directory (e.g. apps/stnd.gd). It evaluates:

stnd_audit_module

Audits a single vertical-slice module folder against boundaries, manifest standards, and SPA event listener lifecycle.

stnd_lint_markup

Lints HTML, Astro, or Svelte code snippets against the Vanilla-First design rules:

stnd_lint_markdown

Lints .md files or strings against the convention: “Never hard-wrap lines in any .md file”, preventing hard line breaks that break Obsidian and Swiss typography layouts.


5. Integrating with CI & Development Workflows

In addition to serving AI agents via MCP, the audit engines in packages/mcp/src/auditors/ are integrated into repo-wide pre-push and testing pipelines, providing a unified standard across both human pull requests and autonomous commits.