A Model Context Protocol (MCP) server that provides access to the Macmillan Design System tokens and component guidelines. This server follows the ITCSS (Inverted Triangle CSS) architecture and exposes design tokens, component guidelines, and code generation capabilities.
- Node.js (v16 or higher)
- TypeScript (for development)
-
Clone and build the server:
git clone <repository-url> cd mcp-design-system npm install npm run build
-
Test the server:
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | node build/index.js
-
Configure your MCP client (see Client Configuration)
The server exposes its own documentation! Any MCP client can immediately discover how to use it:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "get_usage_instructions",
"arguments": {"format": "markdown"}
}
}This means AI assistants can automatically learn how to use your design system without external documentation!
Retrieve design tokens from the Macmillan design system following ITCSS architecture.
Parameters:
layer(optional, default: "all"):"settings"- Primitive tokens from SCSS variables"tokens"- Semantic tokens mapped to CSS custom properties"all"- Both layers
category(optional, default: "all"):"colors"- Color palette and semantic colors"spacing"- Spacing scale and semantic spacing"typography"- Font families, sizes, weights, line heights"radius"- Border radius values"shadows"- Box shadow definitions"borders"- Border width definitions"all"- All categories
Example Request:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "get_design_tokens",
"arguments": {
"layer": "tokens",
"category": "colors"
}
}
}Example Response:
{
"result": {
"content": [{
"type": "text",
"text": "{\n \"foreground\": {\n \"hero\": \"var(--mac-color-fg-hero)\",\n \"primary\": \"var(--mac-color-fg-primary)\",\n ...\n }\n}"
}]
}
}Get comprehensive usage guidelines, variants, and examples for a specific component.
Parameters:
componentName(required): Component name- Available:
"button","card","input","heading","link"
- Available:
Example Request:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "get_component_guidelines",
"arguments": {
"componentName": "button"
}
}
}List all available components in the design system with their variants and descriptions.
Parameters: None
Example Request:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "list_available_components",
"arguments": {}
}
}Generate a React component with TypeScript interfaces and SCSS implementation using design system tokens.
Parameters:
componentType(required): Type of component (e.g., "button", "card", "input")variant(optional): Component variant (e.g., "primary", "secondary")props(optional): Additional props objectincludeAccessibility(optional, default: true): Include ARIA attributes
Get comprehensive documentation and usage instructions for this MCP server.
Parameters:
format(optional, default: "json"): Output format ("json"or"markdown")
Example Request:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "get_usage_instructions",
"arguments": {
"format": "markdown"
}
}
}Example Request:
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "generate_component",
"arguments": {
"componentType": "button",
"variant": "primary",
"includeAccessibility": true
}
}
}Complete design system tokens in JSON format.
Example Request:
{
"jsonrpc": "2.0",
"id": 1,
"method": "resources/read",
"params": {
"uri": "design-system://tokens"
}
}Complete component guidelines in JSON format.
Example Request:
{
"jsonrpc": "2.0",
"id": 1,
"method": "resources/read",
"params": {
"uri": "design-system://guidelines"
}
}Complete server documentation and usage instructions in JSON format.
Example Request:
{
"jsonrpc": "2.0",
"id": 1,
"method": "resources/read",
"params": {
"uri": "design-system://documentation"
}
}Add this to your claude_desktop_config.json:
{
"mcpServers": {
"macmillan-design-system": {
"command": "node",
"args": ["D:/CODE/AI/mcp-servers/mcp-design-system/build/index.js"],
"env": {}
}
}
}Configuration file locations:
- Windows:
%APPDATA%\Claude\claude_desktop_config.json - macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
import { spawn } from "child_process";
const client = new Client(
{ name: "design-system-client", version: "1.0.0" },
{ capabilities: {} }
);
const serverProcess = spawn("node", ["./build/index.js"]);
const transport = new StdioClientTransport({
reader: serverProcess.stdout,
writer: serverProcess.stdin,
});
await client.connect(transport);
// Example: Get color tokens
const result = await client.request(
{ method: "tools/call" },
{
name: "get_design_tokens",
arguments: { layer: "tokens", category: "colors" }
}
);The design system follows ITCSS (Inverted Triangle CSS) architecture:
Raw, unprocessed design tokens:
- Brand colors (brand5, brand20, brand40, etc.)
- Spacing primitives (xs1-4, s1-4, m1-4, l1-4)
- Typography primitives (font families, weights, sizes)
- Border and radius primitives
Semantic tokens mapped to CSS custom properties:
- Foreground colors (
var(--mac-color-fg-*)) - Background colors (
var(--mac-color-bg-*)) - Spacing tokens (
var(--mac-spacing-*)) - Typography tokens (
var(--mac-fontsize-*))
| Component | Variants | Sizes | Description |
|---|---|---|---|
| Button | primary, secondary, outline, ghost, hero | small, medium, large | Interactive buttons with semantic tokens |
| Card | elevated, outlined, filled, hero | - | Content containers with elevation |
| Input | text, email, password, number, textarea, select | - | Form inputs with validation states |
| Heading | h1, h2, h3, h4, h5, h6, h7 | - | Hierarchical headings following typography scale |
| Link | default, hero, button-style | large, medium, small, xsmall | Styled links with hover/focus states |
echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_design_tokens","arguments":{"layer":"settings","category":"spacing"}}}' | node build/index.jsecho '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_component_guidelines","arguments":{"componentName":"button"}}}' | node build/index.jsecho '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"generate_component","arguments":{"componentType":"button","variant":"hero","includeAccessibility":true}}}' | node build/index.jsecho '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_design_tokens","arguments":{"category":"typography"}}}' | node build/index.jsecho '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | node build/index.js# Test tools listing
echo '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}' | node build/index.js
# Test resources listing
echo '{"jsonrpc":"2.0","id":1,"method":"resources/list","params":{}}' | node build/index.js
# Test token retrieval
echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_design_tokens","arguments":{"layer":"tokens","category":"colors"}}}' | node build/index.js
# Test component generation
echo '{"jsonrpc":"2.0","id":1,"method":"tools/call","parameters":{"name":"generate_component","arguments":{"componentType":"button","variant":"primary"}}}' | node build/index.jsnpm run buildnpm run watchsrc/
βββ index.ts # Main MCP server implementation
βββ tokens/
β βββ tokens.scss # CSS custom properties
β βββ settings/ # ITCSS Settings layer (primitives)
β β βββ colors.scss
β β βββ spacing.scss
β β βββ typography.scss
β β βββ ...
β βββ ...
build/
βββ index.js # Compiled server
- Fork the repository
- Create a feature branch
- Make your changes
- Build and test:
npm run build && npm test - Submit a pull request
[Add your license information here]
Server won't start:
- Ensure Node.js version is 16 or higher
- Run
npm installandnpm run build - Check that all dependencies are installed
Claude Desktop can't find the server:
- Verify the path in
claude_desktop_config.jsonis correct - Ensure the server builds without errors
- Restart Claude Desktop after configuration changes
Token queries return empty results:
- Check that the
layerandcategoryparameters are valid - Use
"all"for both parameters to see all available tokens
For more help, please create an issue in the repository.