c2n Web Components — Claude Code MCP server: what it does
c2n Web Components — an MCP server that hands an AI agent the exact API of c2 (c2-*) components: attributes, slots, events, CSS variables and markup examples.
MIT ★ 6 updated 2026-10-29
claude mcp add --env C2N_PROJECT_ROOT=<C2N_PROJECT_ROOT> --transport stdio mcp -- npx -y @c2n/mcpWhat c2n Web Components does
The server runs over stdio and plugs into any MCP host. It reads from a bundled data/registry.json file covering the component list, full API per component, a gallery of usage examples, curated presets, @c2n/theme tokens and variant generation, split across tools such as list_components, get_component, get_theme and generate_variant. Once installed, calls against the registry don't need a network connection.
A separate validate_markup tool checks markup and CSS already written in a project: it flags native elements like <button>, <input> or <select> that a c2-* component is meant to replace, unknown tags, attributes and CSS variables, and box styling such as border, padding or background applied directly to a c2-* host. The same check ships as a CLI command and as a PostToolUse hook for Claude Code.
The server only reports facts about the c2 component API; it doesn't install packages or edit application code on its own. That part is handled by the separate @c2n/skill package.
What it helps with
- pull the exact API of a c2-* component without digging through source files
- catch unknown tags, attributes or CSS variables in markup using c2-* components
- find a styling example in the gallery by description like “glass” or “pill”
- generate a CSS class, Lit subclass or JSON from a theme preset
- wire markup validation into a Claude Code PostToolUse hook
Example prompts for the agent
- Use the c2n MCP server to show the full API for
c2-button - Run
validate_markupon thesrcfolder to catch unknown c2-* attributes - Search the gallery for a “pill”-style example for c2 components
How to install c2n Web Components
Platform CLI
claude mcp add --env C2N_PROJECT_ROOT=<C2N_PROJECT_ROOT> --transport stdio mcp -- npx -y @c2n/mcpReplace <…> with your own values
Platform CLI
codex mcp add mcp --env C2N_PROJECT_ROOT=<C2N_PROJECT_ROOT> -- npx -y @c2n/mcpReplace <…> with your own values
Config file
{
"mcpServers": {
"mcp": {
"command": "npx",
"args": [
"-y",
"@c2n/mcp"
],
"env": {
"C2N_PROJECT_ROOT": "<C2N_PROJECT_ROOT>"
}
}
}
}Replace <…> with your own values
Config file
{
"servers": {
"mcp": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@c2n/mcp"
],
"env": {
"C2N_PROJECT_ROOT": "<C2N_PROJECT_ROOT>"
}
}
}
}Replace <…> with your own values
Platform CLI
gemini mcp add -e C2N_PROJECT_ROOT=<C2N_PROJECT_ROOT> mcp npx -y @c2n/mcpReplace <…> with your own values
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about c2n Web Components
How do I install c2n Web Components in Claude Code?
Run claude mcp add c2n -- npx -y @c2n/mcp. To set a project root, use claude mcp add --env C2N_PROJECT_ROOT=<C2N_PROJECT_ROOT> --transport stdio mcp -- npx -y @c2n/mcp instead.
What does c2n Web Components do?
It gives an AI agent the API of c2 components — attributes, slots, events, CSS variables — plus gallery examples and theme tokens, and checks written markup against the c2-* API.
Does c2n Web Components need internet access after setup?
No, the component data is bundled locally in data/registry.json, so tool calls work without network access once it's installed.