[![CI](https://github.com/Brandcode-Studio/brandsystem-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/Brandcode-Studio/brandsystem-mcp/actions/workflows/ci.yml) [![npm version](https://img.shields.io/npm/v/@brandsystem/mcp)](https://www.npmjs.com/package/@brandsystem/mcp) [![Node](https://img.shields.io/node/v/@brandsystem/mcp)](https://www.npmjs.com/package/@brandsystem/mcp) [![brandsystem-mcp MCP server](https://glama.ai/mcp/servers/Brandcode-Studio/brandsystem-mcp/badges/score.svg)](https://glama.ai/mcp/servers/Brandcode-Studio/brandsystem-mcp) [![npm downloads](https://img.shields.io/npm/dw/@brandsystem/mcp)](https://www.npmjs.com/package/@brandsystem/mcp) [![MCP Badge](https://lobehub.com/badge/mcp/brandcode-studio-brandsystem-mcp)](https://lobehub.com/mcp/brandcode-studio-brandsystem-mcp) # Use your brand guidelines with AI **`@brandsystem/mcp` turns the brand material you already have into context AI agents can use.** Give it a website, PDF guide, Figma library, local files, or a Brandcode Studio brand. It produces a portable `.brand/` runtime with design tokens, voice rules, provenance, and compliance checks. Local-first. No account required. The default Core profile exposes 12 tools covering the complete adopt → use → check loop. ## Start here Install it for your agent, then ask: **“How do I use my brand guidelines with AI?”** ```bash # Codex npx @brandsystem/mcp install --client codex --write # Claude Code, Cursor, Windsurf, or Claude Desktop npx @brandsystem/mcp install --client claude-code --write # Cline npx @brandsystem/mcp install --client cline --write ``` `install` is a dry run unless you pass `--write`. Replace `claude-code` with `cline`, `cursor`, `windsurf`, or `claude-desktop` as needed. JSON-file targets preserve existing settings; Cline and Codex setup delegate to their official MCP commands so their current schemas remain authoritative. Agents can follow the compact [installation guide](llms-install.md) without reading this entire README. Already configured? Tell your agent: > Use my existing brand guidelines with AI. Start from this website/PDF/Figma library and show me what needs human confirmation. ## What It Solves AI tools default to category-average output because they have no brand context. Brand guidelines live in PDFs, Figma files, and people's heads — none of which AI tools can read at the moment of creation. The dominant failure mode isn't "broken output"; it's "correct but generic" — output that passes mechanical checks but reads like a competent generalist could have made it. This MCP server is the authoring half of the **"Two MCPs, One Brand"** model. It extracts brand identity from live sources, compiles it into a `.brand/` directory with structured governance (anti-patterns, proof-point status, voice rules, application rules) plus DTCG tokens, brand-runtime.json, and interaction-policy.json. That directory is the **portable brand runtime** — the artifact that travels with your brand from surface to surface. - **Claude Design** reads the `.brand/` directory natively when pointed at a governed repo - **Claude Code**, **Claude Desktop**, **Cursor**, and **Windsurf** connect to this server directly over stdio and load `brand-runtime.json` at generation time - **ChatGPT** and other remote-first clients consume the same runtime as an uploaded artifact (`brand-report.html` / `brand-runtime.json`) or via a remote MCP connection — see [Compatibility](#compatibility-at-a-glance) - **@brandcode/mcp** (the hosted Use MCP) serves the same runtime over HTTP for teams that want authenticated live reads at `mcp.brandcode.studio/{slug}` With brand-runtime.json loaded, agent prompts collapse from 200-400 tokens of inline brand context to just the delta. First output is on-brand. No review bottleneck. --- ## Quick Start ### 1. Add to your MCP config Copy this into `.mcp.json` (Claude Code), `.cursor/mcp.json` (Cursor), or Windsurf MCP settings. Codex users can run `npx @brandsystem/mcp install --client codex --write` instead: ```json { "mcpServers": { "brandsystem": { "command": "npx", "args": ["-y", "@brandsystem/mcp"] } } } ``` ### 2. Create your brand system Tell your AI tool: > Run brand_start with client_name="Acme Corp", website_url="https://acme.com", and mode="auto" That single command extracts colors, fonts, and logo from the website, escalates to rendered or deeper multi-page extraction when the cheap pass is weak, compiles DTCG tokens, generates `design-synthesis.json` + `DESIGN.md`, and generates a portable HTML brand report -- all in under 60 seconds. ### 3. What you get ``` .brand/ brand.config.yaml ← brand name, source URLs, session state core-identity.yaml ← colors (with roles), fonts, logo specs tokens.json ← DTCG design tokens brand-runtime.json ← single-file brand context for any AI agent interaction-policy.json ← anti-patterns, voice constraints, never-say words design-synthesis.json ← spacing, radius, shadows, component signals DESIGN.md ← portable design brief (agent-readable) brand-report.html ← visual report (paste into any AI chat) assets/logo/ ← extracted logo files (SVG/PNG) ``` Load `brand-runtime.json` into any sub-agent's context. First output is on-brand. No per-prompt boilerplate. ### 4. Use it > Run brand_write for a social-graphic about "Q3 product launch" The AI now has your full brand context — colors, typography, logo, anti-patterns, voice rules — and generates on-brand content. ### 5. Go deeper (optional) | Session | What it adds | Command | |---------|-------------|---------| | 1. Core Identity | Colors, fonts, logo, tokens | `brand_start` (done above) | | 2. Visual Identity | Composition, anti-patterns, illustration style | `brand_deepen_identity` | | 3. Messaging | Voice, tone, never-say words, brand story | `brand_compile_messaging` | | 4. Content Strategy | Personas, journey stages, themes | `brand_build_personas` | Each session enriches `brand-runtime.json`. Stop at any point — Session 1 alone is valuable. ### 6. Share with your team > Run brand_brandcode_connect to save on Brandcode Studio Your brand persists on [brandcode.studio](https://brandcode.studio). Teammates pull the same brand into their tools. One source of truth. --- ## What It Does **Session 1: Core Identity** -- Extract colors, fonts, and logo from a website or Figma file. Compile into DTCG tokens, a structured design synthesis layer, a portable `DESIGN.md`, and an HTML report. **Session 2: Visual Identity** -- Define composition rules, pattern language, illustration style, and anti-patterns through a guided interview. Anti-patterns become enforceable compliance rules. **Session 3: Messaging** -- Audit existing website voice, then define perspective, voice codex (tone, vocabulary, AI-ism detection), and brand story through a guided interview. **Session 4: Content Strategy** -- Build buyer personas, journey stages, editorial themes, and a persona x stage messaging matrix. Each session builds on the previous. Stop anywhere -- you get value immediately. ### Two Ways To Use It **Local-first MCP flow** -- Start from a website or Figma file, build a `.brand/` directory locally, and use it immediately in chat or code tools with no account required. **Brandcode Studio-connected flow** -- Connect an existing hosted brand from Brandcode Studio, pull the packaged brand into `.brand/`, and keep it synced over time. ### Two MCPs, One Brand The `.brand` runtime is the product. Two MCPs serve it: **`@brandsystem/mcp` — Build (this package).** Author and compile the `.brand` runtime locally. Extract from websites, Figma, and PDFs. Compile governance (anti-patterns, proof-point status, voice rules, application rules) plus DTCG tokens, brand-runtime.json, and interaction-policy.json into a single `.brand/` directory. Portable, versionable, ready to commit to any repo. **`@brandcode/mcp` — Use (hosted).** Connect authorized MCP clients to the live Full Brand Runtime at `https://mcp.brandcode.studio/{slug}` with Brandcode bearer-key auth. Agents fetch the current runtime, search approved knowledge, check drafts, retrieve package-safe assets, leave append-only review feedback, and, with explicit `capture` scope, queue taste captures for human review — no per-tool guideline copy, no stale snapshots, no canonical mutation from the MCP. Tagline: *"Your brand, live in every AI tool."* Same `.brand` runtime artifact. Two consumption paths. Build authors it; Use serves it. Phase 0 for Brandcode MCP is locked in [specs/brandcode-mcp-phase-0-lock.md](specs/brandcode-mcp-phase-0-lock.md) as the original 8-tool read/append-only surface. The current hosted implementation adds `capture_taste` as a scoped contribute-tier tool: it requires explicit `capture` scope, queues a review candidate for human review, and never promotes canon. **Hosted availability:** Brandcode MCP is pre-release and available to approved clients only — it is not yet publicly launched or registry-listed. Brand data on the hosted service is client-owned; feedback is append-only; agent history is scoped and redacted. Deletion and export requests are handled through your Brandcode Studio contact. Until public launch, use `@brandsystem/mcp` for local build/sync, and Live Mode (`brand_brandcode_live`) for connected reads that refresh from the hosted runtime within a short cache TTL. Maintainers can verify a hosted deployment end-to-end with the smoke harness (`npm run smoke:hosted-mcp` with `BRANDCODE_MCP_SMOKE_URL` and scoped test keys). It verifies MCP `initialize`, `tools/list`, the locked hosted tool order, core hosted tool calls, and read-only insufficient-scope behavior. It never hardcodes keys; missing proof inputs are reported as `blocked` or `skipped`. ### Claude Design integration The `.brand/` directory is engineered as a first-class input for [Claude Design](https://www.anthropic.com/news/claude-design). Point Claude Design at a repo that contains `.brand/` — governance YAML, narrative library, proof-point files, taste notes, DTCG tokens — and it grounds on the governed brand instead of improvising from uploaded assets. This is the Deploy path: author once with `@brandsystem/mcp`, then every Anthropic surface (Claude Design, Claude Code, Chat via compile packs) consumes the same runtime. --- ## Tools Reference ### Tool Profiles (0.10+) By default the server registers the **Core profile** — 12 tools covering the complete loop: adopt → runtime/context → create → check → export, plus the Studio connector entry points and the clarify/promote path. This keeps first-tool selection sharp for agents. The **full profile** registers the entire authoring system (all tools below). Opt in via env or args: ```json { "mcpServers": { "brandsystem": { "command": "npx", "args": ["-y", "@brandsystem/mcp", "--profile=full"] } } } ``` Or set `BRANDSYSTEM_PROFILE=full`. Core tools: `brand_start`, `brand_status`, `brand_runtime`, `brand_context`, `brand_check`, `brand_preflight`, `brand_report`, `brand_export`, `brand_clarify`, `brand_compile`, `brand_brandcode_auth`, `brand_brandcode_connect`. ### Entry Points | Tool | What it does | |------|-------------| | `brand_start` | **Begin here.** Creates a brand system from a website URL in under 60 seconds. Use `mode='auto'` for one-call setup with rendered and deep-site fallback on weak JS-rendered sites. | | `brand_status` | Check progress, get next steps, or see a getting-started guide if no brand exists yet. | ### Session 1: Core Identity | Tool | What it does | |------|-------------| | `brand_extract_web` | Extract logo (SVG/PNG), colors, and fonts from any website URL. | | `brand_extract_visual` | Screenshot the rendered page in headless Chrome and extract computed colors, fonts, and visual context from JS-heavy sites. | | `brand_extract_site` | Discover representative pages, render them across desktop and mobile, capture screenshots, sample multiple components, and persist `extraction-evidence.json`. | | `brand_generate_designmd` | Generate `design-synthesis.json` and `DESIGN.md` from extracted evidence or the current brand state. | | `brand_extract_figma` | Extract from Figma design files (higher accuracy). Two-phase: plan then ingest. | | `brand_set_logo` | Add/replace logo via SVG markup, URL, or data URI. | | `brand_compile` | Generate DTCG design tokens, brand runtime contract, and interaction policy from extracted data. | | `brand_clarify` | Resolve ambiguous brand values interactively (color roles, font confirmations). | | `brand_audit` | Validate .brand/ directory for completeness and correctness. | | `brand_report` | Generate portable HTML brand report. Upload to any AI chat as instant guidelines. | | `brand_init` | Low-level directory scaffolding. Prefer `brand_start` instead. | ### Session 2: Visual Identity | Tool | What it does | |------|-------------| | `brand_deepen_identity` | Define composition rules, patterns, illustration style, and anti-patterns (6 interview sections). | | `brand_ingest_assets` | Scan and catalog brand assets with MANIFEST.yaml metadata. | | `brand_preflight` | Check HTML/CSS against brand rules -- catches off-brand colors, wrong fonts, anti-pattern violations. | ### Session 3: Messaging | Tool | What it does | |------|-------------| | `brand_extract_messaging` | Audit existing website voice -- fingerprint, vocabulary, claims, AI-isms, gaps. | | `brand_compile_messaging` | Define perspective, voice codex (tone, vocabulary, AI-ism detection), and brand story. | ### Session 4: Content Strategy | Tool | What it does | |------|-------------| | `brand_build_personas` | Build buyer personas through a 7-question guided interview. | | `brand_build_journey` | Define buyer journey stages (ships with 4 proven defaults). | | `brand_build_themes` | Define editorial content themes balanced across awareness, engagement, and conversion. | | `brand_build_matrix` | Generate messaging variants for every persona x journey stage combination. | ### Content Scoring | Tool | What it does | |------|-------------| | `brand_audit_content` | Score content against brand rules (0-100) across multiple dimensions. | | `brand_check_compliance` | Quick pass/fail compliance gate before publishing. | | `brand_audit_drift` | Detect systematic brand drift across multiple pieces of content. | ### Runtime + Utilities | Tool | What it does | |------|-------------| | `brand_runtime` | Read the compiled brand runtime contract (single-document brand context for AI agents). | | `brand_context` | Select a task-scoped slice of the runtime deterministically (task_type → sections, audience → persona match, compact budget). Returns matched selectors and explicit no-match — never silent fallback. | | `brand_write` | Load full brand context (visual + voice + strategy) for content generation. | | `brand_export` | Generate portable brand files for Chat, Code, team sharing, or email. | | `brand_feedback` | Report bugs, friction, or feature ideas to the brandsystem team. | ### Brandcode Studio Connector | Tool | What it does | |------|-------------| | `brand_brandcode_connect` | Connect a local `.brand/` directory to a hosted Brandcode Studio brand and pull the current package. | | `brand_brandcode_sync` | Pull updates from a previously connected hosted brand using sync-token-aware delta behavior. | | `brand_brandcode_status` | Inspect the current Brandcode Studio connection, sync history, and local package summary. | | `brand_brandcode_live` | Toggle connected read tools to refresh from the hosted runtime within a short cache TTL. | ### Tool Flow Tools auto-chain -- each tool's response tells the LLM what to run next: ``` Session 1: brand_start → brand_extract_web or brand_extract_visual or brand_extract_site → brand_generate_designmd → brand_compile → brand_clarify → brand_report Session 2: brand_deepen_identity (interview x 6) → brand_compile (generates VIM) Session 3: brand_extract_messaging → brand_compile_messaging (interview x 3) → brand_write Session 4: brand_build_personas → brand_build_journey → brand_build_themes → brand_build_matrix ``` `brand_status` can be called at any point. `brand_preflight` runs after any content generation. ### CLI Commands The npm package ships a CLI entrypoint for setup, diagnostics, and the hosted-brand connector: ```bash npx @brandsystem/mcp doctor # local checkup: Node, profile, .brand/ state, credential permissions, client configs npx @brandsystem/mcp install --client claude-code # write MCP config (dry-run by default; add --write to apply, existing config backed up) npx @brandsystem/mcp install --client cline --write npx @brandsystem/mcp install --client cursor --profile full npx @brandsystem/mcp inspect # version, profile, tool list, .brand/ artifact inventory npx @brandsystem/mcp brandcode connect https://brandcode.studio/start/brands/pendium npx @brandsystem/mcp brandcode sync npx @brandsystem/mcp brandcode status ``` `install` never overwrites other servers' entries: it deep-merges, backs up the existing file first, and refuses invalid JSON. For protected hosted brands, add `--share-token=TOKEN`. --- ## The `.brand/` Directory After running the full pipeline, your `.brand/` directory looks like this: ``` .brand/ brand.config.yaml # Client name, industry, source URLs, session state core-identity.yaml # Colors, typography, logos with confidence scores extraction-evidence.json # Multi-page rendered evidence bundle (optional) design-synthesis.json # Structured design synthesis (radius, shadow, layout, personality) DESIGN.md # Portable agent-facing design brief tokens.json # DTCG design tokens (compiled output) brand-runtime.json # Compiled runtime contract (single-doc brand context) interaction-policy.json # Enforceable rules (anti-patterns, voice, claims) needs-clarification.yaml # Items requiring human review brand-report.html # Portable HTML brand report visual-identity.yaml # Session 2: composition, patterns, anti-patterns visual-identity-manifest.md # Session 2: compiled VIM document system-integration.md # Session 2: CLAUDE.md / .cursorrules setup guide messaging.yaml # Session 3: perspective, voice, brand story messaging-audit.md # Session 3: voice fingerprint analysis brand-story.md # Session 3: compiled brand narrative assets/ logo/ logo-wordmark.svg # Extracted logo files illustrations/ # Brand illustrations with MANIFEST.yaml stickers/ # Brand stickers with MANIFEST.yaml patterns/ # Brand patterns with MANIFEST.yaml ``` ### File Details | File | Format | Purpose | |------|--------|---------| | `brand.config.yaml` | YAML | Project metadata: client name, industry, website URL, Figma file key, session number, schema version | | `core-identity.yaml` | YAML | All extracted brand data: colors (with roles and confidence), typography (with families and weights), logo specs (with inline SVG and data URIs), spacing | | `extraction-evidence.json` | JSON | Multi-page rendered evidence captured from representative pages and viewports. Contains screenshots, computed elements, and CSS custom properties used to ground synthesis | | `design-synthesis.json` | JSON | Structured design interpretation of the brand. Includes radius, shadow, spacing, layout, component, motion, and personality signals derived from evidence and current identity | | `DESIGN.md` | Markdown | Portable agent-facing design brief synthesized from the evidence bundle and current brand state | | `tokens.json` | JSON | [DTCG](https://tr.designtokens.org/format/) design tokens. Includes colors and typography plus synthesis-driven radius, shadow, layout, spacing, and motion groups when available | | `brand-runtime.json` | JSON | Single-document brand contract for AI agents. Merges all 4 session YAMLs into flat, fast-access format. Only medium+ confidence values. Compiled by `brand_compile`, read by `brand_runtime` | | `interaction-policy.json` | JSON | Enforceable rules engine. Visual anti-patterns, voice constraints (never-say, AI-ism patterns), and content claims policies. Used by preflight and scoring tools | | `needs-clarification.yaml` | YAML | Prioritized list of items the system could not resolve confidently: missing primary color, low-confidence values, unassigned roles | | `brand-report.html` | HTML | Self-contained brand report. Works offline, embeds all assets inline. Paste into any AI tool as brand guidelines | | `assets/logo/` | SVG/PNG | Extracted logo files. SVGs include inline path data in `core-identity.yaml` for portability | --- ## Platform Setup ### Codex Use the package installer, which delegates to Codex's official MCP configuration command: ```bash npx @brandsystem/mcp install --client codex --write ``` Start a new Codex task after installation. Codex CLI, the Codex app, and the IDE extension share the same MCP configuration. ### Cline Use the package installer, which delegates to Cline's official non-interactive MCP command: ```bash npx @brandsystem/mcp install --client cline --write ``` Start a new Cline task, then ask: **“How do I use my brand guidelines with AI?”** Cline CLI and the IDE extension share the same global configuration at `~/.cline/data/settings/cline_mcp_settings.json`. ### Claude Code Create `.mcp.json` in your project root: ```json { "mcpServers": { "brandsystem": { "command": "npx", "args": ["-y", "@brandsystem/mcp"] } } } ``` ### Cursor Create `.cursor/mcp.json` in your project root: ```json { "mcpServers": { "brandsystem": { "command": "npx", "args": ["-y", "@brandsystem/mcp"] } } } ``` ### Windsurf Create `~/.codeium/windsurf/mcp_config.json`: ```json { "mcpServers": { "brandsystem": { "command": "npx", "args": ["-y", "@brandsystem/mcp"] } } } ``` ### Claude Desktop Open Settings > Developer > Edit Config (`claude_desktop_config.json`): ```json { "mcpServers": { "brandsystem": { "command": "npx", "args": ["-y", "@brandsystem/mcp"] } } } ``` ### Compatibility at a glance Three distinct ways to get your brand into an AI tool — don't conflate them: | Path | Clients | What it takes | |------|---------|---------------| | **Direct local MCP (stdio)** | Claude Code, Claude Desktop, Cursor, Windsurf | The `.mcp.json` config above — the server runs on your machine | | **Remote hosted MCP** | ChatGPT (developer mode) and other remote-MCP clients | An approved Brandcode Studio brand + bearer key (pre-release, approved clients only). ChatGPT connects to remote MCP servers, not local stdio processes; OpenAI documents a secure-tunnel option for private servers | | **Runtime artifact copy** | Any AI tool | Upload `brand-report.html` or `brand-runtime.json` to the conversation — no MCP connection needed | ### Claude Chat (no MCP) If you are using Claude Chat without MCP support: 1. Run the pipeline in a code environment first to generate `brand-report.html` 2. Upload the HTML file to your Claude Chat conversation 3. Say: "Use this as my brand guidelines for everything we create" The report HTML is self-contained and works as a standalone brand reference in any AI tool. --- ## Troubleshooting ### "No .brand/ directory found" Every tool except `brand_start`, `brand_init`, and `brand_feedback` requires a `.brand/` directory. Run `brand_start` first. If you are using the hosted-brand flow instead of local extraction, `brand_brandcode_connect` also scaffolds `.brand/` automatically on first connect. ### Empty extraction (no colors or fonts found) This usually means the website loads CSS dynamically via JavaScript. `brand_extract_web` only parses static CSS from `