# c2n Web Components

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.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 6 repo stars
- Author: code2nguyen
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/code2nguyen/web-components/tree/HEAD/packages/tools/mcp
- Updated: 2026-10-29
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/mcp/c2n-web-components

## What it 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.

## Requirements
- Needs: Node.js (commands run via npx)
- Environment variables: `C2N_PROJECT_ROOT` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add --env C2N_PROJECT_ROOT=<C2N_PROJECT_ROOT> --transport stdio mcp -- npx -y @c2n/mcp
```
Replace <…> with your own values

### Codex

**Platform CLI**
```bash
codex mcp add mcp --env C2N_PROJECT_ROOT=<C2N_PROJECT_ROOT> -- npx -y @c2n/mcp
```
Replace <…> with your own values

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "mcp": {
            "command": "npx",
            "args": [
                "-y",
                "@c2n/mcp"
            ],
            "env": {
                "C2N_PROJECT_ROOT": "<C2N_PROJECT_ROOT>"
            }
        }
    }
}
```
Replace <…> with your own values

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "mcp": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "@c2n/mcp"
            ],
            "env": {
                "C2N_PROJECT_ROOT": "<C2N_PROJECT_ROOT>"
            }
        }
    }
}
```
Replace <…> with your own values

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e C2N_PROJECT_ROOT=<C2N_PROJECT_ROOT> mcp npx -y @c2n/mcp
```
Replace <…> with your own values

## When to use it
- 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
- Use the c2n MCP server to show the full API for `c2-button`
- Run `validate_markup` on the `src` folder to catch unknown c2-* attributes
- Search the gallery for a “pill”-style example for c2 components

## Similar
- [experience-lwc-base-components-integrate](https://affpapa.org/en/nevibecode/skills/experience-lwc-base-components-integrate.md) — skill · 2800 installs
- [svelte-components](https://affpapa.org/en/nevibecode/skills/svelte-components.md) — skill · 572 installs
- [KRDS Design System](https://affpapa.org/en/nevibecode/mcp/krds-design-system.md) — MCP server · 531 installs
- [modern-web-guidance](https://affpapa.org/en/nevibecode/skills/modern-web-guidance.md) — skill · 62500 installs
- [web-design-engineer](https://affpapa.org/en/nevibecode/skills/web-design-engineer.md) — skill · 10200 installs
- [web-typography](https://affpapa.org/en/nevibecode/skills/web-typography.md) — skill · 9900 installs

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
