@sobagu/mcp
v0.1.2
Published
Sobagu CSS MCP server: lets AI coding assistants look up Sobagu props and tokens, make themes and check Sobagu code
Maintainers
Readme
@sobagu/mcp
An MCP (Model Context Protocol) server that helps AI coding assistants write correct Sobagu code.
It reads everything from @sobagu/core, so its answers always match the version you have installed.
Tools
| Tool | Input | What it returns |
|---|---|---|
| list_props | filter? (text in a prop name or CSS property) | Style props with their CSS properties, tokens and what a number means |
| get_tokens | kind? (colors, space, sizes, radii, fontSizes, shadows, breakpoints…) | Design tokens, name → CSS value |
| list_conditions | | Conditions (hover, md, dark, groupHover, cqMd…) and the selector or at-rule each produces |
| list_shortcuts | | Boolean shortcuts (card, center, row…) and what they expand to |
| explain | style (a style object, or JSON text) | The class names, the exact CSS generated, and any problems |
| check | source (JSX / TSX / Vue / HTML) | Unknown props, tokens and colours, with line numbers and "did you mean" suggestions |
| create_theme | brand (hex or hue), accent?, name? | createTheme() output: palette, generated CSS, WCAG contrast numbers and warnings, and the code that applies it |
| check_contrast | fg, bg, use? (text, large-text, ui) | WCAG contrast ratio with AA / AAA results; semantic colours are checked in light and dark mode |
| migrate_classes | classes, element? | Utility classes → Sobagu props, a <Box> tag and a css() call, using the same rules as sobagu migrate |
| search_ui | Search the Sobagu UI catalogue: components, charts, blocks, patterns and templates, with Free/Pro tier, page link and import line |
| get_ui_item | One item by id: free items come with props and example code (free blocks: the full source); Pro items return the page link only |
check scans <Box>, <Stack>, <Grid> and <Text> attributes (JSX and Vue, including :bound values and
kebab-case), css({...}) calls, sb="…" / data-sb="…" attributes and v-sb="{…}". It is a fast heuristic scan,
not a full parser: values built at runtime (variables, function calls) are skipped, but string literals inside an
expression (bg={on ? 'primary' : 'muted'}) are checked.
Setup
The server talks over stdio. The command is npx -y @sobagu/mcp.
From the command line
claude mcp add sobagu -- npx -y @sobagu/mcpAdd --scope project to share it with your team through .mcp.json.
Project config file, one editor
.cursor/mcp.json in your project (or ~/.cursor/mcp.json for every project):
{
"mcpServers": {
"sobagu": { "command": "npx", "args": ["-y", "@sobagu/mcp"] }
}
}Project config file, another editor
.vscode/mcp.json in your project:
{
"servers": {
"sobagu": { "type": "stdio", "command": "npx", "args": ["-y", "@sobagu/mcp"] }
}
}Other clients
Any MCP client that can start a stdio server works: run npx -y @sobagu/mcp (or sobagu-mcp when the package
is installed).
Your own tokens
If your project adds tokens with extendTokens(), put the same object in a sobagu.tokens.json file in the
project root, so check and explain know names like bg="brand.500" or p="huge" instead of reporting them:
{ "palette": { "brand": "#7c3aed" }, "semantic": { "highlight": ["amber.200", "amber.800"] }, "space": { "huge": "200px" } }Another file name: set SOBAGU_TOKENS (a path, relative to the project). An assistant can also pass the object as
the tokens argument of check and explain.
Components, blocks, patterns and templates
search_ui and get_ui_item read the catalogue published with the Sobagu UI site (https://sobagucss.com/ui/mcp/).
To use another copy, such as a local build, set SOBAGU_UI_URL to its URL or to a folder that holds mcp/index.json.
Pro items are listed with their page link; their code is only for Sobagu Pro licence holders.
Docs
- AI assistants: setup for each editor and what the tools return
Sobagu is in 0.x: the tools and their output can still change between minor versions.
Working on this package
From the root of the Sobagu repository:
npm run build -w @sobagu/mcp # → packages/mcp/dist/server.js
node packages/mcp/scripts/smoke.mjs node packages/mcp/dist/server.js # initialize + tools/list + two calls
npx tsx packages/mcp/src/server.ts # run from source without building
npx vitest run packages/mcp # unit tests for src/tools.tsThe tool logic lives in src/tools.ts as plain functions; src/server.ts only wires them
to MCP, and src/tool-names.ts lists the tools for scripts such as the llms.txt generator.
The build bundles @sobagu/core, sobagu, the class converter of @sobagu/cli into
dist/server.js, so the answers match the packages of
the same release.
Licence
MIT © 2026 Sobagu contributors
