Skip to content

Commit 7d88582

Browse files
authored
Merge pull request #35 from storybookjs/improve-readmes
Improve READMEs
2 parents 65d6caa + 373741b commit 7d88582

File tree

5 files changed

+94
-41
lines changed

5 files changed

+94
-41
lines changed

.changeset/deep-ways-dress.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@storybook/addon-mcp': patch
3+
---
4+
5+
Improve documentation around tool usage and setup

.changeset/wide-candies-build.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@storybook/addon-mcp': patch
3+
---
4+
5+
Specify that only Storybook 9 or above is supported

README.md

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,6 @@ pnpm --filter @storybook/mcp build
105105

106106
### Testing
107107

108-
Currently, only the `mcp` package has automated tests:
109-
110108
```bash
111109
# Watch tests
112110
pnpm test
@@ -118,8 +116,6 @@ pnpm test run
118116
pnpm test run --coverage
119117
```
120118

121-
The `addon-mcp` package relies on manual testing via the internal Storybook instance.
122-
123119
### Debugging MCP Servers
124120

125121
Use the MCP Inspector to debug and test MCP server functionality:
@@ -131,6 +127,45 @@ pnpm inspect
131127

132128
This uses the configuration in `.mcp.inspect.json` to connect to your local MCP servers.
133129

130+
Alternatively, you can also use these `curl` comamnds to check that everything works:
131+
132+
```bash
133+
# test that the mcp server is running
134+
# use port 6006 to test the addon-mcp server instead
135+
curl -X POST \
136+
http://localhost:13316/mcp \
137+
-H "Content-Type: application/json" \
138+
-d '{
139+
"jsonrpc": "2.0",
140+
"id": 1,
141+
"method": "tools/list",
142+
"params": {}
143+
}'
144+
145+
# test a specific tool call
146+
curl -X POST http://localhost:13316/mcp \
147+
-H "Content-Type: application/json" \
148+
-d '{
149+
"jsonrpc": "2.0",
150+
"id": 2,
151+
"method": "tools/call",
152+
"params": {
153+
"name": "list-all-components",
154+
"arguments": {}
155+
}
156+
}'
157+
```
158+
159+
### Debugging with Storybook
160+
161+
You can start the Storybook with
162+
163+
```bash
164+
pnpm storybook
165+
```
166+
167+
This will build everything and start up Storybook with addon-mcp, and you can then connect your coding agent to it at `http://localhost:6006/mcp` and try it out.
168+
134169
### Formatting
135170

136171
```bash

packages/addon-mcp/README.md

Lines changed: 44 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This Storybook addon runs an MCP (Model Context Protocol) server to help develop
44

55
It enables a workflow where for each UI component created, the agent will automatically generate and link to example stories. These stories let you visually verify the new UI in each of its key states, and provide documentation and component tests.
66

7-
The server currently exposes two tools: one to provide UI development instructions to the agent, and the other to retrieve story URLs directly from your running Storybook.
7+
The addon provides tools to improve agents' UI development capabilities, retrieve story URLs, and access component documentation.
88

99
> [!IMPORTANT]
1010
> This addon currently only supports Vite-based Storybook setups, such as [`@storybook/react-vite`](https://storybook.js.org/docs/get-started/frameworks/react-vite), [`@storybook/nextjs-vite`](https://storybook.js.org/docs/get-started/frameworks/nextjs#with-vite), and [`@storybook/sveltekit`](https://storybook.js.org/docs/get-started/frameworks/sveltekit).
@@ -17,6 +17,9 @@ The server currently exposes two tools: one to provide UI development instructio
1717

1818
### Installation and Setup
1919

20+
> [!NOTE]
21+
> This addon requires Storybook 9.0 or higher.
22+
2023
Use Storybook's CLI to automatically install and configure the addon:
2124

2225
```bash
@@ -36,7 +39,7 @@ The MCP server will be available at `<your_storybook_dev_server_origin>/mcp` whe
3639
### Configuring Your Agent
3740

3841
> [!NOTE]
39-
> This addon is primarily tested with Claude Code. While it should work with other MCP clients, Claude Code is our main target for compatibility and testing.
42+
> This addon is primarily tested with Claude Code and GitHub Copilot. While it should work with other MCP clients, Claude Code is our main target for compatibility and testing.
4043
4144
#### Claude Code Setup
4245

@@ -64,6 +67,8 @@ Before doing any UI, frontend or React development, ALWAYS call the storybook MC
6467

6568
#### Other MCP Clients
6669

70+
[![Install MCP Server](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en-US/install-mcp?name=storybook-mcp&config=eyJ1cmwiOiJodHRwOi8vbG9jYWxob3N0OjYwMDYvbWNwIn0%3D)
71+
6772
This addon should work with any MCP-compatible client that supports the `tool` capability and the `streamable-http` transport. Here are setup guides for other popular clients:
6873

6974
- [GitHub Copilot](https://docs.github.com/en/copilot/how-tos/provide-context/use-mcp/extend-copilot-chat-with-mcp)
@@ -82,11 +87,15 @@ For clients not listed above, consult their documentation for MCP server configu
8287

8388
## Usage
8489

85-
This addon provides two main MCP tools that your agent can use. The goal is that the agent uses these tools automatically when doing UI development, but agents are unreliable and unpredictable, so sometimes you might need to explicitly tell it to use the tools.
90+
This addon provides MCP tools that your agent can use. The goal is that the agent uses these tools automatically when doing UI development, but agents are unreliable and unpredictable, so sometimes you might need to explicitly tell it to use the tools.
8691

8792
**If you are prompting from an IDE like VSCode or Cursor, be sure to use `Agent` mode and `sonnet-4.5` or better.**
8893

89-
### 1. UI Building Instructions (`get_ui_building_instructions`)
94+
### Core Tools
95+
96+
These tools are always available when the addon is installed:
97+
98+
#### 1. UI Building Instructions (`get_ui_building_instructions`)
9099

91100
Provides agents with standardized instructions for UI component development within your project. This tool returns guidelines for:
92101

@@ -96,7 +105,7 @@ Provides agents with standardized instructions for UI component development with
96105

97106
The instructions ensure agents follow your project's conventions when creating or modifying UI components and their corresponding stories.
98107

99-
### 2. Get Story URLs (`get_story_urls`)
108+
#### 2. Get Story URLs (`get_story_urls`)
100109

101110
Allows agents to retrieve direct URLs to specific stories in your Storybook. The agent can request URLs for multiple stories by providing:
102111

@@ -113,50 +122,49 @@ Agent calls tool, gets response:
113122
http://localhost:6006/?path=/story/example-button--primary
114123
```
115124

116-
## Contributing
125+
### Component Documentation Tools (Experimental)
117126

118-
We welcome contributions to improve Storybook's agent integration, within or outside of this addon! Here's how you can help:
127+
These additional tools are available when the **experimental** component manifest feature is enabled. They provide agents with detailed documentation about your UI components.
119128

120-
1. **Ideas and feature requests**: If you have ideas for what else we could do to improve the Storybook experience when using agents, please [start a discussion](https://github.com/storybookjs/mcp/discussions/new?category=ideas) in this repository.
129+
**Requirements:**
121130

122-
2. **Report Issues**: If you find bugs, please open an issue on our [GitHub repository](https://github.com/storybookjs/mcp), but keep in mind that this is currently highly experimental, explorative and probably filled with bugs.
131+
- Storybook v10.1 or later (prereleases), currently available as [canary version `0.0.0-pr-32810-sha-af0645cd`](https://www.npmjs.com/package/storybook/v/0.0.0-pr-32810-sha-af0645cd)
132+
- React-based framework (`react-vite`, `nextjs-vite`)
133+
- Feature flag `features.experimentalComponentsManifest` set to `true` in `.storybook/main.js`
123134

124-
3. **Development Setup**:
135+
**To enable:**
125136

126-
This repository uses a monorepo structure with [pnpm workspaces](https://pnpm.io/workspaces) and [Turborepo](https://turborepo.com) for task orchestration.
137+
```javascript
138+
// .storybook/main.js
139+
export default {
140+
// ... other config
141+
features: {
142+
experimentalComponentsManifest: true,
143+
},
144+
};
145+
```
127146

128-
```bash
129-
# Clone the repository
130-
git clone https://github.com/storybookjs/mcp.git
131-
cd addon-mcp
147+
#### 3. List All Components (`list-all-components`)
132148

133-
# Install dependencies (installs for all packages in the workspace)
134-
pnpm install
149+
Returns a list of all available UI components in your component library. Useful for the LLM as discovery and understanding what components are available to use.
135150

136-
# Build all packages
137-
pnpm build
151+
#### 4. Get Component Documentation (`get-component-documentation`)
138152

139-
# Start development (runs the addon-mcp package)
140-
pnpm start
141-
```
153+
Retrieves detailed documentation for specific components, including:
142154

143-
The main addon package is located in `packages/addon-mcp`.
155+
- Component documentation
156+
- Usage examples
144157

145-
4. **Testing**: Run the MCP inspector to test the server functionality (requires that the Storybook dev server is running):
158+
The agent provides component IDs to retrieve their documentation.
146159

147-
```bash
148-
pnpm run inspect
149-
```
160+
## Contributing
161+
162+
We welcome contributions to improve Storybook's agent integration, within or outside of this addon! Here's how you can help:
150163

151-
Run the unit test suite:
164+
1. **Ideas and feature requests**: If you have ideas for what else we could do to improve the Storybook experience when using agents, please [start a discussion](https://github.com/storybookjs/mcp/discussions/new?category=ideas) in this repository.
152165

153-
```bash
154-
# Run tests in watch mode
155-
pnpm test
166+
2. **Report Issues**: If you find bugs, please open an issue on our [GitHub repository](https://github.com/storybookjs/mcp), but keep in mind that this is currently highly experimental, explorative and probably filled with bugs.
156167

157-
# Run tests once
158-
pnpm test run
168+
3. **Development**:
159169

160-
# Run tests with coverage
161-
pnpm test run --coverage
162-
```
170+
See [the monorepo readme](https://github.com/storybookjs/mcp#-quick-start).

packages/addon-mcp/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"vitest": "catalog:"
5252
},
5353
"peerDependencies": {
54-
"storybook": "*"
54+
"storybook": ">=9.0.0"
5555
},
5656
"publishConfig": {
5757
"access": "public"

0 commit comments

Comments
 (0)