Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/quiet-rivers-connect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@storybook/addon-mcp": minor
---
Comment thread
kasperpeulen marked this conversation as resolved.

Add an optional MCP endpoint setting for the addon dev server.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ You can start Storybook with:
pnpm storybook
```

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.
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` (or your configured addon endpoint) and try it out.

### Working with the MCP App

Expand Down
144 changes: 72 additions & 72 deletions apps/internal-storybook/pnpm-lock.yaml

Large diffs are not rendered by default.

98 changes: 49 additions & 49 deletions eval/pnpm-lock.yaml

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions packages/addon-mcp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,24 @@ Storybook addon for MCP-powered UI development workflows.

See [documentation](https://storybook.js.org/docs/next/ai/mcp/overview/?ref=readme) for installation instructions, usage examples, APIs, and more.

## Configuration

By default, the addon exposes its MCP server at `/mcp`. You can configure a
different literal endpoint path in `.storybook/main.ts`:

```ts
export default {
addons: [
{
name: '@storybook/addon-mcp',
options: {
endpoint: '/custom-mcp',
},
},
],
};
```

The endpoint must be a URL pathname such as `/custom-mcp` or `/tools/mcp`.

Learn more about Storybook at [storybook.js.org](https://storybook.js.org/?ref=readme).
44 changes: 22 additions & 22 deletions packages/addon-mcp/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion packages/addon-mcp/src/auth/composition-auth.test.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import { describe, it, expect, vi, beforeEach } from 'vitest';
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { CompositionAuth, extractBearerToken } from './composition-auth.ts';

describe('CompositionAuth', () => {
beforeEach(() => {
vi.restoreAllMocks();
});

afterEach(() => {
vi.unstubAllGlobals();
});

describe('extractBearerToken', () => {
it('extracts token from valid Bearer header', () => {
expect(extractBearerToken('Bearer abc123')).toBe('abc123');
Expand Down
Loading
Loading