A Model Context Protocol (MCP) server for the Optics Design System, enabling LLMs to understand and work with design tokens, components, and documentation from https://docs.optics.rolemodel.design.
This MCP server provides tools and resources for querying the Optics design system, including:
- Design Tokens: Colors, spacing, typography, borders, and shadows
- Components: Reusable UI components with their token dependencies
- Documentation: Design system guidelines and best practices
- Token Usage Tracking: Statistics and analysis of token usage across components
The easiest way to use Optics MCP - no installation required!
Add to your MCP configuration:
{
"mcpServers": {
"optics": {
"command": "npx",
"args": ["-y", "@rolemodel/optics-mcp"]
}
}
}Add with a single command:
claude mcp add optics -- npx -y @rolemodel/optics-mcpOther useful commands:
# List all MCP servers
claude mcp list
# Remove the Optics server
claude mcp remove optics
# View server details
claude mcp get optics
# Test the connection
claude mcp test opticsThat's it! The server runs automatically whenever your MCP client needs it.
If you want to modify the server or contribute:
git clone https://github.com/RoleModel/optics-mcp.git
cd optics-mcp
npm install
npm run buildThen configure with the local path:
{
"mcpServers": {
"optics": {
"command": "node",
"args": ["/absolute/path/to/optics-mcp/dist/index.js"]
}
}
}npm startGet detailed information about a specific design token.
Parameters:
tokenName(required): The name of the token (e.g., "color-primary", "spacing-md")
Example:
{
"tokenName": "color-primary"
}Search for design tokens by category or name pattern.
Parameters:
category(optional): Filter by category (color, spacing, typography, border, shadow)namePattern(optional): Search pattern for token names (case-insensitive)
Example:
{
"category": "color",
"namePattern": "primary"
}Get statistics about design token usage across the system.
Returns: Total token count and breakdown by category.
Get detailed information about a component including its design token dependencies.
Parameters:
componentName(required): The name of the component (e.g., "Button", "Card")
Example:
{
"componentName": "Button"
}List all available components in the design system.
Returns: Array of components with names, descriptions, and token counts.
Get all design tokens used by a specific component.
Parameters:
componentName(required): The name of the component
Search through Optics documentation.
Parameters:
query(required): Search query for documentation content
The server exposes the following resources via the optics:// URI scheme:
optics://documentation/introduction- Overview of Opticsoptics://documentation/getting-started- Getting started guideoptics://documentation/design-tokens- Design token documentationoptics://documentation/color-system- Color system guideoptics://documentation/spacing- Spacing system guideoptics://documentation/typography- Typography guideoptics://documentation/components- Component library overviewoptics://documentation/accessibility- Accessibility guidelines
optics://tokens/all- All design tokensoptics://tokens/color- Color tokens onlyoptics://tokens/spacing- Spacing tokens onlyoptics://tokens/typography- Typography tokens only
optics://components/all- All components
- Colors (25 tokens): HSL-based color system with primary, neutral, and alert colors
- Spacing (11 tokens): calc-based rem units with base-10 scale (2px to 80px)
- Typography (32 tokens): Noto Sans/Serif fonts with sizes, weights, and line heights
- Borders (10 tokens): Border radius (small to pill) and widths
- Shadows (5 tokens): Elevation system (x-small to x-large)
All components extracted from real Optics SCSS with accurate token dependencies:
- Accordion: Collapsible content panel
- Alert: Notification messages (warning, danger, info, notice)
- Avatar: User profile pictures
- Badge: Status indicators and labels
- Breadcrumbs: Navigation hierarchy
- Button: Interactive buttons with variants
- ButtonGroup: Grouped button container
- Card: Content containers with elevation
- ConfirmDialog: Action confirmation modals
- Divider: Content separators
- Form: Input fields, textareas, selects
- Icon: Material Symbols icons
- Modal: Overlay dialogs
- Navbar: Top navigation
- Pagination: Page navigation
- SidePanel: Sliding side panels
- Sidebar: Side navigation
- Spinner: Loading indicators
- Switch: Toggle switches
- Tab: Tabbed interfaces
- Table: Data tables
- Tag: Categorization labels
- TextPair: Label-value pairs
- Tooltip: Contextual information
Each component specifies which Optics design tokens it uses, making it easy to understand dependencies and maintain consistency.
npm run buildnpm run watchoptics-mcp/
├── src/
│ ├── index.ts # MCP server implementation
│ └── optics-data.ts # Design tokens and component data
├── dist/ # Compiled JavaScript
├── package.json
├── tsconfig.json
└── README.md
The server tracks which design tokens are used by each component, enabling:
- Dependency Analysis: Understand which tokens a component relies on
- Impact Analysis: See which components are affected by token changes
- Usage Statistics: Get insights into token usage patterns
To add new design tokens or components:
- Edit
src/optics-data.ts - Add tokens to the
designTokensarray - Add components to the
componentsarray, specifying their token dependencies - Rebuild the project:
npm run build
MIT