Skip to content

Commit 2440718

Browse files
authored
Merge pull request #202 from storybookjs/shilman/add-registry-server-json
Add MCP registry metadata for @storybook/addon-mcp
2 parents 9881af9 + 1a41f74 commit 2440718

File tree

5 files changed

+97
-0
lines changed

5 files changed

+97
-0
lines changed

.changeset/neat-otters-reflect.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+
Add MCP registry metadata for `@storybook/addon-mcp`.

.github/workflows/release.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,43 @@ jobs:
4444
commitMode: github-api
4545
env:
4646
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
47+
48+
# See: https://modelcontextprotocol.io/registry/github-actions
49+
- name: Install mcp-publisher
50+
if: steps.changesets.outputs.published == 'true' && contains(steps.changesets.outputs.publishedPackages, '@storybook/addon-mcp')
51+
working-directory: packages/addon-mcp
52+
run: |
53+
curl -L "https://github.com/modelcontextprotocol/registry/releases/latest/download/mcp-publisher_$(uname -s | tr '[:upper:]' '[:lower:]')_$(uname -m | sed 's/x86_64/amd64/;s/aarch64/arm64/').tar.gz" | tar xz mcp-publisher
54+
55+
- name: Authenticate to MCP Registry
56+
if: steps.changesets.outputs.published == 'true' && contains(steps.changesets.outputs.publishedPackages, '@storybook/addon-mcp')
57+
working-directory: packages/addon-mcp
58+
run: ./mcp-publisher login github-oidc
59+
60+
- name: Sync addon MCP registry version with jq
61+
if: steps.changesets.outputs.published == 'true' && contains(steps.changesets.outputs.publishedPackages, '@storybook/addon-mcp')
62+
working-directory: packages/addon-mcp
63+
run: |
64+
# Pull the published addon version directly from Changesets output.
65+
# The output is a JSON array like:
66+
# [{"name":"@storybook/addon-mcp","version":"0.4.1"}, ...]
67+
ADDON_MCP_VERSION="$(jq -r '.[] | select(.name == "@storybook/addon-mcp") | .version' <<< '${{ steps.changesets.outputs.publishedPackages }}')"
68+
69+
# Fail fast if the package was expected to publish but no version was found.
70+
test -n "$ADDON_MCP_VERSION"
71+
72+
# Update only the server.json fields that need to match the published package version:
73+
# 1. the top-level MCP server version
74+
# 2. the local npm package entry version used for installation metadata
75+
jq --tab --arg version "$ADDON_MCP_VERSION" '
76+
.version = $version |
77+
.packages[0].version = $version
78+
' server.json > server.json.tmp
79+
80+
# Replace the original file only after jq succeeds, to avoid partial writes.
81+
mv server.json.tmp server.json
82+
83+
- name: Publish addon MCP to MCP Registry
84+
if: steps.changesets.outputs.published == 'true' && contains(steps.changesets.outputs.publishedPackages, '@storybook/addon-mcp')
85+
working-directory: packages/addon-mcp
86+
run: ./mcp-publisher publish

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,5 @@ test-report.junit.xml
1313
trials/
1414
orchestration-logs/
1515
CLAUDE.local.md
16+
.mcpregistry_github_token
17+
.mcpregistry_registry_token

packages/addon-mcp/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"license": "MIT",
1111
"author": "Storybook Core Team",
1212
"repository": {
13+
"type": "git",
1314
"url": "git+https://github.com/storybookjs/mcp.git",
1415
"directory": "packages/addon-mcp"
1516
},
@@ -58,6 +59,7 @@
5859
"optional": true
5960
}
6061
},
62+
"mcpName": "io.github.storybookjs/addon-mcp",
6163
"storybook": {
6264
"displayName": "Addon MCP",
6365
"supportedFrameworks": [

packages/addon-mcp/server.json

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3+
"name": "io.github.storybookjs/addon-mcp",
4+
"title": "Storybook MCP Addon",
5+
"description": "Help agents automatically write and test stories for your UI components.",
6+
"websiteUrl": "https://storybook.js.org/docs/ai/mcp/overview",
7+
"icons": [
8+
{
9+
"src": "https://raw.githubusercontent.com/storybookjs/brand/main/icon/icon-storybook-default.svg",
10+
"mimeType": "image/svg+xml",
11+
"sizes": ["any"],
12+
"theme": "light"
13+
},
14+
{
15+
"src": "https://raw.githubusercontent.com/storybookjs/brand/main/icon/icon-storybook-inverse.svg",
16+
"mimeType": "image/svg+xml",
17+
"sizes": ["any"],
18+
"theme": "dark"
19+
}
20+
],
21+
"repository": {
22+
"url": "https://github.com/storybookjs/mcp",
23+
"source": "github",
24+
"id": "1042284426",
25+
"subfolder": "packages/addon-mcp"
26+
},
27+
"version": "0.4.1",
28+
"packages": [
29+
{
30+
"registryType": "npm",
31+
"identifier": "@storybook/addon-mcp",
32+
"version": "0.4.1",
33+
"transport": {
34+
"type": "streamable-http",
35+
"url": "http://localhost:{--port}/mcp"
36+
},
37+
"packageArguments": [
38+
{
39+
"type": "named",
40+
"name": "--port",
41+
"description": "Port of the Storybook dev server exposing the MCP endpoint.",
42+
"default": "6006",
43+
"format": "number"
44+
}
45+
]
46+
}
47+
]
48+
}

0 commit comments

Comments
 (0)