You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/copilot-instructions.md
+51-25Lines changed: 51 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,21 +2,21 @@
2
2
3
3
## Architecture Overview
4
4
5
-
This is a **pnpm monorepo** with two distinct MCP implementations:
5
+
This is a **pnpm monorepo** with two MCP implementations:
6
6
7
-
-**`packages/addon-mcp`**: Storybook addon using `@modelcontextprotocol/sdk`, exposes MCP server at `/mcp` via Vite middleware
7
+
-**`packages/addon-mcp`**: Storybook addon using `tmcp`, exposes MCP server at `/mcp` via Vite middleware
8
8
-**`packages/mcp`**: Standalone MCP library using `tmcp`, reusable outside Storybook
9
9
-**`apps/internal-storybook`**: Test environment for addon integration
10
10
11
-
**Critical distinction**: The two packages use **different MCP libraries** (`@modelcontextprotocol/sdk` vs `tmcp`). Don't confuse their APIs or patterns.
11
+
**Both packages use `tmcp`** with HTTP transport and Valibot schema validation for consistent APIs.
12
12
13
13
### Addon Architecture
14
14
15
15
The addon uses a **Vite plugin workaround** to inject middleware (see `packages/addon-mcp/src/preset.ts`):
16
16
17
17
- Storybook doesn't expose an API for addons to register server middleware
18
18
- Solution: Inject a Vite plugin via `viteFinal` that adds `/mcp` endpoint
19
-
- Handler in `mcp-handler.ts` creates session-based MCP servers using `StreamableHTTPServerTransport`
19
+
- Handler in `mcp-handler.ts` creates MCP servers using `tmcp` with HTTP transport
20
20
21
21
### MCP Library Architecture
22
22
@@ -39,17 +39,26 @@ The `@storybook/mcp` package (in `packages/mcp`) is framework-agnostic:
39
39
- Run `pnpm dev` at root for parallel development
40
40
- Run `pnpm storybook` to test addon (starts internal-storybook + addon dev mode)
0 commit comments