@@ -158,20 +158,24 @@ async function openProjectSettings(canvasElement: HTMLElement): Promise<void> {
158158 mcpHeading . scrollIntoView ( { block : "start" } ) ;
159159}
160160
161- /** Open the workspace MCP modal */
162- async function openWorkspaceMCPModal ( canvasElement : HTMLElement ) : Promise < void > {
161+ /** Open project settings by clicking MCP button in workspace header */
162+ async function openProjectSettingsViaMCPButton ( canvasElement : HTMLElement ) : Promise < void > {
163163 const canvas = within ( canvasElement ) ;
164164 const body = within ( canvasElement . ownerDocument . body ) ;
165165
166166 // Wait for workspace header to load
167167 await canvas . findByTestId ( "workspace-header" , { } , { timeout : 10000 } ) ;
168168
169- // Click the MCP server button in the header
169+ // Click the MCP server button in the header - now opens project settings
170170 const mcpButton = await canvas . findByTestId ( "workspace-mcp-button" ) ;
171171 await userEvent . click ( mcpButton ) ;
172172
173- // Wait for dialog
173+ // Wait for settings dialog
174174 await body . findByRole ( "dialog" ) ;
175+
176+ // Scroll to MCP Servers section
177+ const mcpHeading = await body . findByText ( "MCP Servers" ) ;
178+ mcpHeading . scrollIntoView ( { behavior : "instant" , block : "start" } ) ;
175179}
176180
177181// ═══════════════════════════════════════════════════════════════════════════════
@@ -283,11 +287,11 @@ export const ProjectSettingsWithToolAllowlist: AppStory = {
283287} ;
284288
285289// ═══════════════════════════════════════════════════════════════════════════════
286- // WORKSPACE MCP MODAL STORIES
290+ // MCP BUTTON NAVIGATION STORIES
287291// ═══════════════════════════════════════════════════════════════════════════════
288292
289- /** Workspace MCP modal with servers from project (no overrides) */
290- export const WorkspaceMCPNoOverrides : AppStory = {
293+ /** MCP button in header opens project settings with MCP servers visible */
294+ export const MCPButtonOpensProjectSettings : AppStory = {
291295 render : ( ) => (
292296 < AppWithMocks
293297 setup = { ( ) =>
@@ -306,48 +310,18 @@ export const WorkspaceMCPNoOverrides: AppStory = {
306310 />
307311 ) ,
308312 play : async ( { canvasElement } : { canvasElement : HTMLElement } ) => {
309- await openWorkspaceMCPModal ( canvasElement ) ;
313+ await openProjectSettingsViaMCPButton ( canvasElement ) ;
310314
311315 const body = within ( canvasElement . ownerDocument . body ) ;
312316
313- // Both servers should be shown and enabled
317+ // Both servers should be shown in project settings
314318 await body . findByText ( "mux" ) ;
315319 await body . findByText ( "posthog" ) ;
316320 } ,
317321} ;
318322
319- /** Workspace MCP modal - server disabled at project level, can be enabled */
320- export const WorkspaceMCPProjectDisabledServer : AppStory = {
321- render : ( ) => (
322- < AppWithMocks
323- setup = { ( ) =>
324- setupMCPStory ( {
325- servers : {
326- mux : { command : "npx -y @anthropics/mux-server" , disabled : false } ,
327- posthog : { command : "npx -y posthog-mcp-server" , disabled : true } ,
328- } ,
329- testResults : {
330- mux : MOCK_TOOLS ,
331- posthog : POSTHOG_TOOLS ,
332- } ,
333- preCacheTools : true ,
334- } )
335- }
336- />
337- ) ,
338- play : async ( { canvasElement } : { canvasElement : HTMLElement } ) => {
339- await openWorkspaceMCPModal ( canvasElement ) ;
340-
341- const body = within ( canvasElement . ownerDocument . body ) ;
342-
343- // posthog should show "(disabled at project level)" but switch should still be toggleable
344- await body . findByText ( "posthog" ) ;
345- await body . findByText ( / d i s a b l e d a t p r o j e c t l e v e l / i) ;
346- } ,
347- } ;
348-
349- /** Workspace MCP modal - server disabled at project level, enabled at workspace level */
350- export const WorkspaceMCPEnabledOverride : AppStory = {
323+ /** MCP button opens project settings with disabled server */
324+ export const MCPButtonWithDisabledServer : AppStory = {
351325 render : ( ) => (
352326 < AppWithMocks
353327 setup = { ( ) =>
@@ -356,44 +330,6 @@ export const WorkspaceMCPEnabledOverride: AppStory = {
356330 mux : { command : "npx -y @anthropics/mux-server" , disabled : false } ,
357331 posthog : { command : "npx -y posthog-mcp-server" , disabled : true } ,
358332 } ,
359- workspaceOverrides : {
360- enabledServers : [ "posthog" ] ,
361- } ,
362- testResults : {
363- mux : MOCK_TOOLS ,
364- posthog : POSTHOG_TOOLS ,
365- } ,
366- preCacheTools : true ,
367- } )
368- }
369- />
370- ) ,
371- play : async ( { canvasElement } : { canvasElement : HTMLElement } ) => {
372- await openWorkspaceMCPModal ( canvasElement ) ;
373-
374- const body = within ( canvasElement . ownerDocument . body ) ;
375-
376- // posthog should be enabled despite project-level disable
377- await body . findByText ( "posthog" ) ;
378- await body . findByText ( / d i s a b l e d a t p r o j e c t l e v e l / i) ;
379-
380- // The switch should be ON (enabled at workspace level)
381- } ,
382- } ;
383-
384- /** Workspace MCP modal - server enabled at project level, disabled at workspace level */
385- export const WorkspaceMCPDisabledOverride : AppStory = {
386- render : ( ) => (
387- < AppWithMocks
388- setup = { ( ) =>
389- setupMCPStory ( {
390- servers : {
391- mux : { command : "npx -y @anthropics/mux-server" , disabled : false } ,
392- posthog : { command : "npx -y posthog-mcp-server" , disabled : false } ,
393- } ,
394- workspaceOverrides : {
395- disabledServers : [ "posthog" ] ,
396- } ,
397333 testResults : {
398334 mux : MOCK_TOOLS ,
399335 posthog : POSTHOG_TOOLS ,
@@ -404,54 +340,21 @@ export const WorkspaceMCPDisabledOverride: AppStory = {
404340 />
405341 ) ,
406342 play : async ( { canvasElement } : { canvasElement : HTMLElement } ) => {
407- await openWorkspaceMCPModal ( canvasElement ) ;
343+ await openProjectSettingsViaMCPButton ( canvasElement ) ;
408344
409345 const body = within ( canvasElement . ownerDocument . body ) ;
410346
411- // mux should be enabled, posthog should be disabled
347+ // Both servers should be visible
412348 await body . findByText ( "mux" ) ;
413349 await body . findByText ( "posthog" ) ;
414350 } ,
415351} ;
416352
417- /** Workspace MCP modal with tool allowlist filtering */
418- export const WorkspaceMCPWithToolAllowlist : AppStory = {
419- render : ( ) => (
420- < AppWithMocks
421- setup = { ( ) =>
422- setupMCPStory ( {
423- servers : {
424- posthog : { command : "npx -y posthog-mcp-server" , disabled : false } ,
425- } ,
426- workspaceOverrides : {
427- toolAllowlist : {
428- posthog : [ "docs-search" , "error-details" , "list-errors" ] ,
429- } ,
430- } ,
431- testResults : {
432- posthog : POSTHOG_TOOLS ,
433- } ,
434- preCacheTools : true ,
435- } )
436- }
437- />
438- ) ,
439- play : async ( { canvasElement } : { canvasElement : HTMLElement } ) => {
440- await openWorkspaceMCPModal ( canvasElement ) ;
441-
442- const body = within ( canvasElement . ownerDocument . body ) ;
443- await body . findByText ( "posthog" ) ;
444-
445- // Should show filtered tool count
446- await body . findByText ( / 3 o f 1 4 t o o l s e n a b l e d / i) ;
447- } ,
448- } ;
449-
450353// ═══════════════════════════════════════════════════════════════════════════════
451354// INTERACTION STORIES
452355// ═══════════════════════════════════════════════════════════════════════════════
453356
454- /** Interact with tool selector - click All/None buttons */
357+ /** Interact with tool selector in project settings - click All/None buttons */
455358export const ToolSelectorInteraction : AppStory = {
456359 render : ( ) => (
457360 < AppWithMocks
@@ -469,7 +372,7 @@ export const ToolSelectorInteraction: AppStory = {
469372 />
470373 ) ,
471374 play : async ( { canvasElement } : { canvasElement : HTMLElement } ) => {
472- await openWorkspaceMCPModal ( canvasElement ) ;
375+ await openProjectSettingsViaMCPButton ( canvasElement ) ;
473376
474377 const body = within ( canvasElement . ownerDocument . body ) ;
475378
@@ -489,7 +392,7 @@ export const ToolSelectorInteraction: AppStory = {
489392 } ,
490393} ;
491394
492- /** Toggle server enabled state in workspace modal */
395+ /** Toggle server enabled state in project settings */
493396export const ToggleServerEnabled : AppStory = {
494397 render : ( ) => (
495398 < AppWithMocks
@@ -509,7 +412,7 @@ export const ToggleServerEnabled: AppStory = {
509412 />
510413 ) ,
511414 play : async ( { canvasElement } : { canvasElement : HTMLElement } ) => {
512- await openWorkspaceMCPModal ( canvasElement ) ;
415+ await openProjectSettingsViaMCPButton ( canvasElement ) ;
513416
514417 const body = within ( canvasElement . ownerDocument . body ) ;
515418
0 commit comments