Basecoat UI MCP
io.github.zygiu-zygis/basecoat-ui-mcp · 46 stars · TypeScript · MIT
MCP server Offline Basecoat UI MCP: templates, macro layouts, theming contract, and static validation.
Install
The repo has no one-line install. Follow its README.
Published as
- npm
@intellmedia/basecoat-ui-mcpstdio
From the server's entry in the official MCP Registry.
Configuration
| Name | Set as | What it is |
|---|---|---|
BASECOAT_PROJECT_ROOTOptional | Env var | Optional host application directory for basecoat://project/context (overridden by --project-root) |
Files
Basecoat UI MCP
Offline Model Context Protocol server for Basecoat UI (shadcn/ui look without bundling or requiring React).
Curated templates, macro layouts, rhythm tokens, and static validation for Astro, Next.js, HTML, and Tailwind CSS 4.
The server exposes a deterministic, offline registry for AI coding agents instead of requiring clients to scrape documentation. It runs over local stdio with zero runtime network requests, bounded < 2 KB responses, and bounded lexical/heuristic static source validation. The host application remains responsible for rendering, data access, authentication, sessions, credentials, OAuth, captcha, and other runtime behavior.
Install
Requires Node.js 22.14.0 or newer.
Quick Start by Client
Cursor (.cursor/mcp.json)
{
"mcpServers": {
"basecoat-ui": {
"command": "npx",
"args": ["-y", "@intellmedia/basecoat-ui-mcp", "--project-root", "${workspaceFolder}"]
}
}
}
Claude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"basecoat-ui": {
"command": "npx",
"args": ["-y", "@intellmedia/basecoat-ui-mcp", "--project-root", "/absolute/path/to/your/application"]
}
}
}
Claude Code (CLI)
claude mcp add basecoat-ui -- npx -y @intellmedia/basecoat-ui-mcp --project-root $(pwd)
Generic npx (no install)
{
"mcpServers": {
"basecoat-ui": {
"command": "npx",
"args": ["-y", "@intellmedia/basecoat-ui-mcp", "--project-root", "/absolute/path/to/your/application"]
}
}
}
npm
npm install --global @intellmedia/basecoat-ui-mcp
Add the server to an MCP client. Use an absolute path for the host application so design context and persistent sessions belong to the intended project:
{
"mcpServers": {
"basecoat-ui": {
"command": "basecoat-ui-mcp",
"args": ["--project-root", "/absolute/path/to/your/application"]
}
}
}
The compiled entry can also be invoked directly:
{
"mcpServers": {
"basecoat-ui": {
"command": "node",
"args": [
"/absolute/path/to/node_modules/@intellmedia/basecoat-ui-mcp/dist/server/stdio.js",
"--project-root",
"/absolute/path/to/your/application"
]
}
}
}
Published packages include prebuilt dist/ and the immutable semantic snapshot
under src/semantics/. Server startup reads that snapshot and does not write
inside the installed package. The package contract test builds first, creates
and extracts an actual npm tarball, marks the extracted package tree read-only,
starts its dist/server/stdio.js under a network tripwire, completes MCP
initialize and tool-list requests, and closes the connection. A source checkout
does not include dist/.
From source
git clone https://github.com/zygiu-zygis/basecoat-ui-mcp.git cd basecoat-ui-mcp npm ci npm run build npm start -- --project-root /absolute/path/to/your/application
--project-root takes precedence over BASECOAT_PROJECT_ROOT, which takes precedence over the launch directory. The selected directory is the host project, not the MCP installation directory. The server exposes stdio only.
Project-root configuration
The configured root controls two things:
DESIGN.mdis read from that directory bybasecoat://project/context.- Persistent macro sessions are stored under
<project-root>/.basecoat/designer/. .basecoat/rhythm.jsonis an optional strict override. It must live under a real.basecoatdirectory inside the project root, be a regular non-symlink file no larger than 65,536 UTF-8 bytes, and resolve inside that root; missing or rejected files leave the packaged profile unchanged. Matching mapping IDs replace in place and keep packaged order.
Only that exact directory is used. The server does not walk parent directories. Keep .basecoat/ in the host project and back it up if design sessions are part of your workflow. The MCP server never writes host application source files.
Basecoat MCP tools
The server exposes three component tools, six macro tools, and two semantic tools. Every macro and semantic result is a bounded MCP packet of at most 1,999 UTF-8 bytes. Larger result sets use cursors; responses are not sliced mid-JSON.
Component tools
search_componentsreturns up to 8 compact{id, name, intent}summaries and never returns markup.intentandqueryare optional; an empty search returns an empty list.get_component_detailsreturns one Astro or HTML template with dependencies and composition guidance. Oversized entries fail closed.theme-toggleresolves totheme-switcher.validate_compositionstatically checks up to 256 KiB (262,144 UTF-8 bytes) of HTML or Astro source and returns at most 24 issues. Passcodeorhtml, and optionalsemanticProfileordensityProfile(comfortable|compact). It does not render, execute, resolve application modules, or certify accessibility.
Macro tools
The macro layer is this project's curated, project-specific composition system for shells, auth flows, data workspaces, slots, ports, rules, and recipes. It is compiled into a pinned registry snapshot. These layout contracts are not supplied automatically by shadcn or by MCP.
search_macro_blocks- find compatible blueprint blocks by query, role, family, or tag.get_macro_block- read a block section such asmanifest,structure,slots,ports,rules,dependencies, orprovenance.begin_design- create a persistent design session and pin its profile and registry revision. Pinned registries are hash-verified on load.get_design_context- read session lists or focused views such asoverview,graph,rules,focus, andnext.apply_design_patch- apply atomic graph changes withexpectedRevisionand an idempotentoperationId. A committed mutation always returns a success acknowledgement; oversized optional payload may be omitted withtruncated: true.validate_design- validate a draft or complete design graph and page its diagnostics.
Design sessions persist under <project-root>/.basecoat/designer/. Registry revisions are content-addressed; a session keeps using its pinned revision even after the package snapshot changes. Design snapshots use the form d:<designId>@<revision>.
Curated block blueprints:
- Shells & Navigation:
app-shell,sidebar-dashboard-shell,sidebar-inset-shell,sidebar-collapsible-icon,sidebar-mobile-flyout,page-header. - Authentication:
auth-recovery,auth-reset,auth-sign-in,auth-sign-up,auth-split-screen. - Application & Workspace:
dashboard-workspace,dashboard-main,dashboard-activity,data-workspace,data-table,data-table-detail-layout,detail-drawer-panel,product-detail-layout,settings-workspace. - Forms & Data:
data-bulk-actions,data-filters,data-pager,form-section. - Navigation & Utility:
sidebar-nav,empty-state,error-boundary,newsletter-waitlist,pricing-tiers,segmented-toggle,svg-area-chart.
Multi-block recipes:
workspace-dashboard- full analytics dashboard (KPI cards, activity chart, records table).workspace-settings- application shell with navigation, header, and settings workspace tabs.workspace-detail- data table workspace with slide-over detail inspection drawer.auth-flow- bidirectional authentication flow between sign-in and sign-up cards.auth-split-flow- split-screen auth frame pairing sign-in and sign-up with hero media.data-records- records page with filters, table, and pager.marketing-pricing- 3-tier pricing table paired with newsletter/waitlist banner.
Semantic tools
The semantic layer provides compiled rhythm profiles and finite state machine recipes:
get_rhythm_rules- access approved spacing, typography, surfaces, borders, and layout patterns by profile and family filters.get_fsm_recipe- read interaction states, events, transitions, guards, and actions fordialog,navigation(collapsible-navigation),auth-flow, andtabs.
Semantic tools use the same bounded pagination as macro tools. Each rhythm record keeps the semantic token ID separate from its approved Tailwind utility. Put the utility in class; keep the semantic ID in design metadata and agent reasoning. Project overrides from <project-root>/.basecoat/rhythm.json are reflected in an effective content ref and revision. FSM recipes are structural metadata, not runtime implementations.
End-to-end example
A dashboard page can follow this sequence:
get_design_context(view="sessions")
begin_design(designId="admin", profile="app-default", operationId="begin-admin")
get_rhythm_rules(profile="default", family="density")
search_macro_blocks(q="shell", limit=8)
apply_design_patch(
designId="admin",
expectedRevision=0,
operationId="add-dashboard",
operations=[{ op: "instantiate_recipe",
recipe: "workspace-dashboard",
pagePrefix: "admin" }]
)
get_design_context(view="overview", designId="admin")
get_macro_block(idOrRef="app-shell", section="structure", designId="admin")
get_fsm_recipe(recipe="dialog", section="transitions")
Implement the selected component leaves in the host project, then record completed regions with apply_design_patch(record_written). Finish with validate_design(mode="complete") and validate_composition on the generated Astro or HTML source. After a conflict or restart, reread the session and use the returned revision and cursors.
Copy templates/cursor/basecoat-designer.mdc into a host project's .cursor/rules for agent guidance. The MCP server does not write consumer application source files.
Auditing or restyling an existing UI
No design session is needed. Read basecoat://design/theming and basecoat://design/rhythm, call get_component_details for each control you change, then run validate_composition on the rendered layout source including <head> scripts and <style>. Theme rules:
theme-strategy-mixed-@media (prefers-color-scheme: dark)combined with the.darkclass strategy (dark tokens leak into light mode).theme-storage-key- a theme script persists under a key other than Basecoat'sthemeMode, creating a second resolver that drifts fromwindow.basecoat.theme.
Check light and dark screenshots with an OS dark preference and empty localStorage before deploying.
Source adaptation and offline import
The macro importer is intentionally local-first. It accepts a checked-out or otherwise
locally saved shadcn-style registry-item.json, a reviewed mapping, and a local
dependency lock:
npm run import:blocks -- \ --item=/path/to/registry-item.json \ --mapping=/path/to/mapping.json \ --lock=/path/to/dependency-lock.json \ --dry-run
This command does not fetch live shadcn registry items, install packages, execute upstream code, or make runtime network requests. Unknown, unlocked, or explicitly unsupported dependencies produce diagnostics instead of guesses. Omitted OAuth, captcha, session, credential, and other application features are reported as obligations. The importer emits only the curated structural block; the host application must implement the runtime behavior.
The mapping and resulting provenance make the boundary explicit: shadcn-style source is an input reference, while layout contracts, slots, ports, rules, and recipes are curated adaptations owned by this project's macro layer. They are not features provided by shadcn or by MCP. Upstream refreshes are separate maintainer authoring operations and never occur from the MCP server.
Basecoat design resources
basecoat://design/rhythmprovides content hierarchy, spacing, typography, component-family, and structural composition rules.basecoat://design/themingprovides the Basecoat token contract, all 8 official style packs (Vega, Nova, Maia, Lyra, Mira, Luma, Sera, Rhea), class-based dark mode viawindow.basecoat.theme(themeModekey), no-flash bootstrap, and form-control/autofill pitfalls. Read it before restyling or auditing an existing UI.basecoat://integration/frameworksprovides Astro, Next.js, Express, Vite, Tailwind CSS 4 (including style pack imports like@import "basecoat-css/vega";), selective Basecoat JavaScript, and native dialog setup.basecoat://project/contextreads the configured host project'sDESIGN.mdon demand. Output is capped at 6,000 UTF-8 bytes and truncates on a newline or sentence boundary when possible. Symlinks and non-regular files are refused.
Recommended flow:
- Read the rhythm and project-context resources.
- Decide content hierarchy and layout.
- Search summaries, then request details only for selected components.
- Read the integration resource when connecting production assets.
- Validate the final source.
Minimal HTML example
The host application supplies its compiled Tailwind and Basecoat stylesheet:
<link rel="stylesheet" href="/assets/basecoat.css"> <button type="button" class="btn" data-variant="default">Save changes</button>
Header Control Cluster (Style Preset Selector + Theme Switcher)
<div class="flex items-center gap-2">
<select id="style-variant-select" class="select h-8 w-28 text-sm leading-none" aria-label="Style pack">
<option value="vega">Vega</option>
<option value="nova">Nova</option>
<option value="maia">Maia</option>
<option value="lyra">Lyra</option>
<option value="mira">Mira</option>
<option value="luma">Luma</option>
<option value="sera">Sera</option>
<option value="rhea">Rhea</option>
</select>
<button type="button" aria-label="Toggle dark mode" data-tooltip="Toggle dark mode" data-side="bottom" onclick="window.basecoat.theme.toggle()" class="btn size-8" data-variant="outline" data-size="icon">
<span class="hidden dark:block" aria-hidden="true"><svg class="lucide lucide-sun size-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="12" cy="12" r="4"/><path d="M12 2v2m0 16v2m-7.07-2.93 1.41-1.41m11.32-11.32 1.41-1.41M2 12h2m16 0h2m-2.93 7.07-1.41-1.41M6.34 6.34 4.93 4.93"/></svg></span>
<span class="block dark:hidden" aria-hidden="true"><svg class="lucide lucide-moon size-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401"/></svg></span>
</button>
</div>
Basecoat 1.x uses btn with data-variant and data-size. Interactive components list the granular JavaScript modules the host must load.
Macro-Driven Dashboard Generation
The MCP server provides a robust set of macro layouts (search_macro_blocks) that enable connected LLMs to predictably assemble complex layouts (like Shadcn dashboards) out-of-the-box.
- Layout Neutrality: Supports both sidebar (
sidebar-dashboard-shell,sidebar-inset-shell) and top-bar architectures (topbar-shell,topbar-nav). - Strict Validation: The
validate_compositiontool ensures that generated layouts adhere to the Basecoat CSS theming contracts, strict spacing rhythm scales (0, 2, 4, 6, 8, 12), and proper landmark accessibility. - Agent Guidance: LLMs are encouraged to use
search_macro_blocksto find ashell(layout wrapper), anddashboard-mainordashboard-workspaceto populate themaincontainer, guaranteeing deterministic, pixel-perfect Shadcn/ui parody without React runtime artifacts.
Registry and exclusions
The checked-in registry contains 41 searchable templates: 39 curated from
the Basecoat 1.0.2 upstream inventory and two MCP-only templates
(segmented-toggle and svg-area-chart):
accordion, alert, alert-dialog, avatar, badge, breadcrumb, button, button-group, card, chart, checkbox, combobox, command, dialog, drawer, dropdown-menu, empty, field, input, input-group, item, kbd, label, native-select, popover, progress, radio-group, scroll-area, segmented-toggle, select, sidebar, skeleton, slider, svg-area-chart, switch, table, tabs, textarea, theme-switcher, toast, tooltip
The maintenance snapshot records 41 discovered upstream components. pagination and spinner remain excluded from search and details until manually curated. Slider uses basecoat-css/range, not a slider module.
The runtime has no network client, remote documentation dependency, frontend framework runtime, remote media analysis, or bundled host assets. Generated templates may not use basecoat-css/all; each controller is imported explicitly. Search results do not contain markup, newly discovered components are never auto-promoted, and JSON or HTML is never sliced to fit a response budget.
Astro and static HTML use cases
In Astro, use the integration resource for Vite, Tailwind CSS 4, CSS ordering, selective controller imports, native <dialog> wiring, and ClientRouter hooks. In static HTML, copy the listed built controller files from basecoat-css into the host application's asset directory and preserve dependency order. Chart templates require host-supplied Chart.js.
Maintainers can refresh the pinned Basecoat snapshot only with an explicit immutable
commit source, for example npm run sync -- --ref <40-character-commit-sha>.
This is the only command that uses HTTPS. It validates schema, exports, notices,
response budgets, version direction, and atomic replacement before changing the
registry. It does not refresh shadcn mappings or macro blocks.
Development and verification
Install dependencies with npm ci, then run the focused checks:
npm run check npm pack --dry-run npm audit --omit=dev
npm run check type-checks, verifies both compiled snapshots, builds and runs
the Node test suite, and checks the branch diff for whitespace errors. The test
suite also exercises the packed read-only MCP bin offline. npm pack --dry-run
checks the package file allowlist without retaining a tarball.
npm audit --omit=dev checks production dependencies against the npm advisory
database and therefore requires network access. Maintainers can
verify the pinned Basecoat source with:
For release parity evidence, run the local-only routine before and after any approved publication:
npm run release:check -- --phase=pre-release --write=tmp/release-pre.json npm run release:check -- --phase=post-release --write=tmp/release-post.json
The routine discovers surfaces from current repository metadata, compares local
authoritative values, and records current, expected, correction, status,
and verification. It checks package identity, server manifest parity, stdio
transport, advertised capabilities, install metadata, and restrained
discoverability copy. It never performs network requests or external writes;
GitHub, npm, the MCP Registry, and directory/catalog corrections remain
explicitly approved manual actions. Do not treat badges, download counts,
upstream references, or search-result snippets as release authority.
npm run sync -- --ref <40-character-commit-sha> --check
The sync command is the only network boundary. Macro authoring changes require
npm run compile:blocks; review the generated
src/macros/registry.snapshot.json and then run
npm run compile:blocks:check.
Contributing
- Create a focused branch from the default branch.
- Keep component templates, macro contracts, and documentation aligned with checked-in source.
- Run
npm run typecheck,npm run compile:semantics:check,npm run compile:blocks:check, andnpm run test. - Run
npm pack --dry-runwhen package contents or metadata change. - Describe behavior changes, bounded-output effects, and any required host application work in the pull request.
Do not add GitHub Actions workflows. Upstream registry refreshes and macro authoring are maintainer-reviewed changes, not server startup tasks.
Troubleshooting
- The server starts but reads the wrong project: set an absolute
--project-rootorBASECOAT_PROJECT_ROOT. The fallback is the process launch directory. DESIGN.mdis not available: place a regular file at the configured root. Parent directories and symlinks are not followed.- A source checkout cannot start: run
npm run buildbeforenpm start. - A macro result has a cursor: request the next page with that cursor; do not concatenate or parse partial JSON. Changed registry, design, or effective rhythm revisions make prior cursors stale.
- An apply acknowledgement includes
truncated: true: the mutation committed; reread context or validation tools for the omitted detail. - An importer diagnostic mentions OAuth, captcha, or an unsupported dependency: implement or resolve it in the host application or reviewed mapping. The importer does not guess runtime behavior.
- A design patch conflicts: reread
get_design_context, use its current revision, and send a new uniqueoperationId.
See ARCHITECTURE.md for runtime boundaries, persistence, packet limits, and sync policy. Report reproducible defects in the issue tracker.
Author, license, and upstream attribution
Created and maintained by Žygimantas Jasiulionis / Intellmedia under the MIT License.
Basecoat UI is an independent MIT-licensed project by Ronan Berder. Adapted templates and metadata retain the complete Basecoat notice in THIRD_PARTY_NOTICES.md. Basecoat adapts design patterns from shadcn/ui; the notice preserves that attribution. No Basecoat CSS or shadcn source is vendored here.
Facts
- Kind
- MCP server
- Group
- Uncategorized
- Stars
- 46
- License
- MIT
- Language
- TypeScript
- Last push
- 2026-10-07
- MCP Registry
- io.github.zygiu-zygis/basecoat-ui-mcp
- Topics
- ai-agents-mcp, astrojs, basecoatui, design-systems, html5, mcp-servers, model-context-protocol-server, static-analysis-tool, tailwindcss-v4, dark-mode, mcp, nextjs, shadcn-ui, typescript, claude, cursor, mcp-server, offline, tailwind, windsurf
- 1REAio.github.morluto/reaReverse engineer anything from your terminal or agent with one CLI and MCP server.125.3k
- 2com.browser-use/browser-usecom.browser-use/browser-useControl a real Chrome browser to complete any task: fill forms, extract data, book flights.117.7k
- 3World Monitorapp.worldmonitor/mcpLive markets, conflicts, country risk, chokepoints, energy, and China decision signals. 93 tools.88.3k
- 4Scrapling MCP Serverd4vinci/scrapling🕷️ An adaptive Web Scraping framework that handles everything from a single request to a full-scale crawl! Don't be shy, join here: https://discord.gg/EMgGbDceNQ and follow here for daily tips and tricks: https://x.com/Scraplingdev86.9k
- 5Everythingmodelcontextprotocol/serversThis MCP server attempts to exercise all the features of the MCP protocol. It is not intended to be a useful server, but rather a test server for builders of MCP clients. It implements prompts, tools, resources, sampling, and more to showcase MCP capabilities.85.8k
- 6Fetchmodelcontextprotocol/serversA Model Context Protocol server that provides web content fetching capabilities. This server enables LLMs to retrieve and process content from web pages, converting HTML to markdown for easier consumption.85.8k