@@ -234,6 +234,7 @@ interface AuthResult {
234234// --- Effect Service ---
235235
236236interface State {
237+ config : Record < string , ConfigMCP . Info >
237238 status : Record < string , Status >
238239 clients : Record < string , MCPClient >
239240 defs : Record < string , MCPToolDef [ ] >
@@ -525,6 +526,7 @@ export const layer = Layer.effect(
525526 const bridge = yield * EffectBridge . make ( )
526527 const config = cfg . mcp ?? { }
527528 const s : State = {
529+ config : { } ,
528530 status : { } ,
529531 clients : { } ,
530532 defs : { } ,
@@ -619,6 +621,10 @@ export const layer = Layer.effect(
619621 result [ key ] = s . status [ key ] ?? { status : "disabled" }
620622 }
621623
624+ for ( const key of Object . keys ( s . config ) ) {
625+ result [ key ] = s . status [ key ] ?? { status : "disabled" }
626+ }
627+
622628 return result
623629 } )
624630
@@ -642,8 +648,9 @@ export const layer = Layer.effect(
642648 } )
643649
644650 const add = Effect . fn ( "MCP.add" ) ( function * ( name : string , mcp : ConfigMCP . Info ) {
645- yield * createAndStore ( name , mcp )
646651 const s = yield * InstanceState . get ( state )
652+ s . config [ name ] = mcp
653+ yield * createAndStore ( name , mcp )
647654 return { status : s . status }
648655 } )
649656
@@ -677,7 +684,7 @@ export const layer = Layer.effect(
677684 ( [ clientName , client ] ) =>
678685 Effect . gen ( function * ( ) {
679686 const mcpConfig = config [ clientName ]
680- const entry = mcpConfig && isMcpConfigured ( mcpConfig ) ? mcpConfig : undefined
687+ const entry = mcpConfig && isMcpConfigured ( mcpConfig ) ? mcpConfig : s . config [ clientName ]
681688
682689 const listed = s . defs [ clientName ]
683690 if ( ! listed ) {
@@ -756,6 +763,9 @@ export const layer = Layer.effect(
756763 } )
757764
758765 const getMcpConfig = Effect . fnUntraced ( function * ( mcpName : string ) {
766+ const s = yield * InstanceState . get ( state )
767+ if ( s . config [ mcpName ] ) return s . config [ mcpName ]
768+
759769 const cfg = yield * cfgSvc . get ( )
760770 const mcpConfig = cfg . mcp ?. [ mcpName ]
761771 if ( ! mcpConfig || ! isMcpConfigured ( mcpConfig ) ) return undefined
0 commit comments