Join live: Storybook 11 AMA with the team
Docs
Storybook Docs

Use a published Storybook

Your agent can look up components from a Storybook that doesn't run on your machine, such as your team's published design system. A published Storybook can serve an MCP server with the docs tools, so agents anywhere can find your components and their props and usage.

When to use it

  • Teams that build apps with your design system want their agents to reuse its components.
  • Your agent works in a repository that doesn't have the Storybook with the components it needs.

A published Storybook shares only the component docs. To write stories, run tests, and create reviews, your agent needs a local Storybook with skills or the MCP server.

If the app's own Storybook can compose the published one, you can use composition instead. Your agent then finds the components of both Storybooks with the /component-docs skill.

Publish with Chromatic

When you publish your Storybook with Chromatic, Chromatic also publishes its MCP server. The server is at your published Storybook's URL, followed by /mcp.

Each build has its own URL. For a URL that always points to your latest Storybook, use the permalink of your default branch:

https://<branch>--<app-id>.chromatic.com/mcp

For example, https://main--642d765a7e8afcfb104268dc.chromatic.com/mcp.

Before you publish, make sure that the components manifest is on.

The published MCP server has the same access as your Storybook. If your Storybook is private, people sign in to Chromatic the first time their agent connects, and only people with access to your Chromatic project can use it. If your Storybook is public, anyone with the URL can use it.

To add the server to an agent, follow Add the MCP server to your agent with the published URL.

Self-host with @storybook/mcp

To control the hosting, security, and updates of your MCP server, you can host it yourself.

@storybook/mcp is a library that creates a tmcp-based MCP server. The server serves your components and docs from your Storybook's manifests.

Prerequisites

  • Node.js 22.12+
  • A manifest source that contains:
    • components.json (required)
    • docs.json (optional)

API

See the package README for the full API of @storybook/mcp.

Example implementation

This is a minimal server that uses @storybook/mcp:

server.ts
import { createStorybookMcpHandler } from '@storybook/mcp';
 
const storybookMcpHandler = await createStorybookMcpHandler();
 
export async function handleRequest(request: Request): Promise<Response> {
  if (new URL(request.url).pathname === '/mcp') {
    return storybookMcpHandler(request);
  }
 
  return new Response('Not found', { status: 404 });
}

For a Node example, see serve.ts in the Storybook repository.

More AI resources