Skip to main content
Glama
README.md
# Storybook Compass MCP

[![CI](https://github.com/MartyMcFly9597/storybook-compass-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/MartyMcFly9597/storybook-compass-mcp/actions/workflows/ci.yml)
[![Node 20+](https://img.shields.io/badge/node-%3E%3D20-3C873A?logo=node.js&logoColor=white)](https://nodejs.org/)
[![pnpm](https://img.shields.io/badge/pnpm-workspace-F69220?logo=pnpm&logoColor=white)](https://pnpm.io/)
[![MCP](https://img.shields.io/badge/MCP-stdio-1f6feb)](https://modelcontextprotocol.io/)
[![MIT License](https://img.shields.io/badge/license-MIT-green)](LICENSE)
[![TypeScript](https://img.shields.io/badge/TypeScript-5.x-3178C6?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)

Compass is a read-only MCP server that turns any published Storybook into an AI-queryable component catalog. Point it at a Storybook URL and MCP-compatible assistants can discover components, get metadata-grounded recommendations, and build UX planning matrices — no Storybook addon, build flag, or code change required on the Storybook side.

## 🧰 Tools

These are the primary tools exposed by this MCP server to MCP-compatible clients for fast, metadata-based Compass Storybook querying.

- 🧠 `recommend_component`: Recommend the best Compass component or pattern for a plain-language use case.
- 🧩 `create_component_recommendation_matrix`: Build a multi-need recommendation matrix for UX planning.
- 🔎 `search_components`: Search by path, story/docs id, tags, import paths, and entry names.
- 📚 `get_component_docs`: Return compact metadata-derived component guidance, availability, ids, examples metadata, and usage caveats.
- 📋 `list_components`: List Compass components from normalized Storybook metadata.
- 🏗️ `discover_foundation_entries`: Return metadata-derived discovery guidance for foundation-related entries only.
- 🎨 `get_design_tokens`: Return design token guidance from metadata signals.
- 🌈 `get_color_palette`: Return color guidance with explicit unavailable handling.
- ✍️ `get_typography_guidance`: Return typography guidance with source evidence.
- 📐 `get_spacing_guidance`: Return spacing guidance with source evidence.
- 🧱 `get_base_style_guidance`: Return base/global style guidance from metadata.
- 🌓 `get_theme_usage_examples`: Return theme usage guidance and examples from metadata.
- 🔗 `get_component_style_dependencies`: Return metadata-derived discovery guidance for style dependency hints only.
- 📊 `get_catalog_quality_report`: Return metadata coverage and limitations summary.

Supporting utilities and resources:

- ♻️ `refresh_metadata_cache`: Force in-memory metadata refresh with stale fallback details.
- ✅ `smoke_test`: Verify server wiring and basic contract behavior.
- 📦 `compass://components`: Component resource listing.
- ❓ `compass://server/help`: Help resource for server usage.
- 📝 `use_compass_components`: Prompt resource for Compass-first prompting.

## MCP Output Compatibility

- `recommend_component`, `get_component_docs`, `discover_foundation_entries`, `get_component_style_dependencies`, and `get_catalog_quality_report` now publish MCP `outputSchema` and return additive `structuredContent` on successful calls.
- Existing `content[0].text` remains JSON text so current text-consuming clients can continue parsing responses without migration.
- Error responses remain unchanged: `isError: true` plus JSON text error envelopes, with no `structuredContent`.

## Recommendation Alias Rules

- `recommend_component` uses a small, deterministic, query-side alias expansion step to improve recall for common UX phrasing.
- Alias behavior is maintained in `src/recommendation/constants.ts` via `QUERY_TERM_ALIAS_RULES` and `ALIAS_MATCH_SCORE_MULTIPLIER`.
- Rules are directional and curated (kept intentionally small) to limit false positives; direct metadata matches should continue to outrank alias-only matches.

## 💬 Sample Prompts

### UX Team

```md
Use the storybook-compass-mcp server.

For a booking listing screen, create a recommendation matrix for:

- result cards
- filters
- sorting
- alerts
- details drawer

Return: UI need, recommended Compass component/pattern, match type, confidence, composition hints, and UX notes.
Use Compass tools first and do not invent components.
```

### UI Designers

```md
Use the storybook-compass-mcp server.

Find Compass patterns for a multi-step form with:

- primary action
- secondary action
- date selection
- quantity selector
- validation alert

For strongest candidates, inspect docs/examples and call out direct matches vs likely compositions.
```

### Code Developers

```md
Use the storybook-compass-mcp server.

I am implementing a Vue 3 travel-date flow.
Recommend the best Compass component or pattern, inspect docs/examples, and suggest an implementation approach.

Return: recommendation, confidence, useful examples, implementation notes, and caveats.
Do not suggest external UI libraries or invented Compass components.
```

## 🧭 Quick Start

Choose the path that matches how you want to use Compass:

1. **VS Code or another MCP client**: run the server directly with Node.
2. **SEA executable**: use the packaged binary if you do not want to install Node.
3. **ChatGPT in a browser**: use the browser workflow guide if your ChatGPT workspace can connect to MCP tools.

### VS Code or MCP Client

Run locally:

```bash
corepack enable
pnpm install
pnpm build
pnpm smoke-test
```

Connect from VS Code MCP:

```json
{
  "servers": {
    "storybook-compass-mcp": {
      "type": "stdio",
      "command": "node",
      "args": ["dist/index.js"],
      "cwd": "${workspaceFolder}",
      "env": {
        "STORYBOOK_BASE_URL": "https://react.carbondesignsystem.com"
      }
    }
  }
}
```

`STORYBOOK_BASE_URL` is required. Point it at the base URL of any published Storybook that serves `/index.json` (Storybook 7+). The example above uses IBM's public Carbon Design System Storybook so you can try the tools immediately.

### SEA Executable

If you want to use the MCP server without installing Node, use the built SEA executable.

Use the built SEA executable as the server process in your MCP client or agent:

1. Build the executable once with `pnpm package:sea`.
2. Point your MCP client at the executable in `dist/sea/`.
3. Start the client or agent and ask it to use the Compass tools.

For a quick example in MCP Inspector or another stdio client:

```json
{
  "command": "dist/sea/storybook-compass-mcp-v0.1.0-win-x64.exe",
  "args": [],
  "cwd": "${workspaceFolder}"
}
```

Set `STORYBOOK_BASE_URL` in your MCP client's environment configuration for the
executable, the same as the Node setup above.

More detailed build, signing, and Windows policy notes live in [docs/sea-executable-usage.md](docs/sea-executable-usage.md).

### SEA Artifacts In CI

The SEA workflow now packages executables on every push to `main` (plus manual dispatch) for:

- Windows x64: `storybook-compass-mcp-v<version>-win-x64.exe`
- Linux x64: `storybook-compass-mcp-v<version>-linux-x64`
- macOS x64: `storybook-compass-mcp-v<version>-macos-x64`
- macOS arm64: `storybook-compass-mcp-v<version>-macos-arm64`

Each run uploads these binaries as Actions artifacts and also updates a mutable GitHub release tag `sea-latest` with convenient aliases:

- `storybook-compass-mcp-latest-win-x64.exe`
- `storybook-compass-mcp-latest-linux-x64`
- `storybook-compass-mcp-latest-macos-x64`
- `storybook-compass-mcp-latest-macos-arm64`

### ChatGPT in a Browser

If you use ChatGPT in a browser for UX/UI work, see [docs/using-compass-with-chatgpt-browser.md](docs/using-compass-with-chatgpt-browser.md).

## 🆚 How This Compares To The Official Storybook MCP

Storybook ships an official MCP integration, [`@storybook/addon-mcp`](https://storybook.js.org/docs/ai/mcp/overview) (moved into the [storybookjs/storybook](https://github.com/storybookjs/storybook) monorepo as of v10.6). The two solve different problems:

|                            | Official `@storybook/addon-mcp`                                     | Storybook Compass MCP (this project)                            |
| -------------------------- | ------------------------------------------------------------------- | --------------------------------------------------------------- |
| Where it runs              | Inside the Storybook dev server (addon), HTTP `/mcp` endpoint       | Standalone stdio process you point at any URL                   |
| Storybook-side setup       | Install addon + enable `componentsManifest` feature flag            | None — works against any already-published Storybook            |
| Data source                | Components manifest (`/manifests/components.json`) built via docgen | Standard `/index.json` (+ legacy `/stories.json` when present)  |
| Data richness              | Props, descriptions, code snippets                                  | Titles, ids, tags, import paths, docs/story inventory           |
| Remote/deployed Storybooks | Chromatic-hosted or self-hosted `@storybook/mcp` with a manifest    | Any reachable published Storybook 7+                            |
| Framework coverage         | Manifest limited to React frameworks, `angular-vite`, `vue3-vite`   | Framework-agnostic (reads the index every Storybook emits)      |
| Focus                      | Story development, testing, docs inside the repo                    | Cross-repo component discovery, recommendation, and UX planning |

Use the official addon when you develop _inside_ the Storybook repo and want rich props/snippets. Use Compass when you _consume_ a design system from other codebases, UX workflows, or AI agents, and only have its published Storybook URL.

## 🖼️ Architecture

```mermaid
flowchart LR
  A[AI Client] --> B[Storybook Compass MCP Server]
  B --> C[Storybook Metadata JSON]
  C --> D[Catalog + Cache]
  D --> E[Tool Responses]
  E --> A
```

## 🧩 Framework Note

Many design-system Storybooks target a single framework (Angular, React, Vue, or Web Components). This server provides framework-agnostic discovery with Vue-flavored implementation guidance; recommended patterns can be adapted for other frameworks when no framework-compatible package or Web Component exists.

See [Using Compass with Vue and UX](docs/using-compass-with-vue-and-ux.md).

## 🛠️ Setup For Maintainers

```bash
corepack enable
pnpm install
pnpm build
pnpm smoke-test
```

Equivalent npm flow:

```bash
npm install
npm run build
npm run smoke-test
```

- Node.js >=20
- pnpm remains the maintainer default path
- npm is a supported compatibility path for install and script execution
- Use `node dist/index.js` for MCP clients.
- Use `pnpm start` or `npm start` only for manual local terminal runs.
- `npx storybook-compass-mcp` is not supported because this repository is not published as an npm package.

## ⚠️ Known Limits

- Storybook metadata may not include full rendered docs.
- This reads structured Storybook JSON, not iframe HTML.
- `discover_foundation_entries`, specialized foundation guidance tools, `get_component_style_dependencies`, and `get_catalog_quality_report` return metadata-derived signals and guidance only.
- These tools do not return authoritative design token values, color values, spacing scales, or generated CSS.
- For authoritative values and confirmed dependencies, verify in the design system docs/source.
- Framework-specific examples are design guidance when working in other frameworks unless compatible packages exist.
- Raw Storybook inspection (#12) is deferred until there is a real debugging need.
- Any future raw iframe or rendered-doc inspection should remain opt-in, bounded, and lower-trust than structured metadata.

## How To Interpret Results

- Structured metadata is the primary source for this server.
- Inferred metadata/path signals are lower-confidence guidance.
- Deeper docs/source inspection is not available in the current version and is deferred unless added later under explicit guardrails.

## 📚 Docs

- [Using Compass with Vue and UX](docs/using-compass-with-vue-and-ux.md)
- [Storybook Audit](docs/storybook-audit.md)
- [MCP Inspector Smoke Test](docs/mcp-inspector-smoke-test.md)
- [What Is MCP? (Plain-English)](docs/what-is-mcp.md)
- [Decision Records](docs/decisions/README.md)

## 📄 License

[MIT](LICENSE) © 2026 Martin Kilmartin

TDQS

B3.1/5.0

Scored across 16 tools

Disambiguation3/5

The component-facing tools (list, search, get_component_docs, recommend_component, create_component_recommendation_matrix) are reasonably distinct, but the foundation/guidance cluster overlaps heavily: get_design_tokens, get_color_palette, get_typography_guidance, discover_foundation_entries, get_base_style_guidance and get_theme_usage_examples all read as 'get guidance about a foundation category' with unclear boundaries. An agent could easily pick color_palette when design_tokens or foundation_entries was intended. get_component_style_dependencies versus get_component_docs is also a subtle distinction.

Naming Consistency4/5

The set follows a clear verb_noun convention (list_components, search_components, get_*_guidance, recommend_component, refresh_metadata_cache). Deviations are minor: smoke_test lacks an action verb and create_component_recommendation_matrix is unusually long but still follows the pattern.

Tool Count3/5

16 tools is at the upper edge for a metadata/guidance server, and the count is inflated by six near-adjacent foundation guidance endpoints that could plausibly be consolidated into one parameterized tool. Each tool is small, so it is borderline rather than clearly over-scoped.

Completeness4/5

The surface covers discovery (list/search), detail retrieval (docs), recommendation (single and matrix), foundation guidance across spacing, color, typography, tokens and theming, plus cache refresh and a quality report. Gaps are minor, e.g. no explicit per-component prop/API or story enumeration beyond get_component_docs, but core lifecycle is covered.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues