@@ -669,14 +669,20 @@ export const McpDebugCommand = effectCmd({
669669 const config = yield * Config . Service . use ( ( cfg ) => cfg . get ( ) )
670670 const mcp = yield * MCP . Service
671671 const auth = yield * McpAuth . Service
672+ const serverConfig = config . mcp ?. [ args . name ]
673+ const authInfo =
674+ serverConfig && isMcpRemote ( serverConfig ) && serverConfig . oauth !== false
675+ ? yield * Effect . all ( {
676+ authStatus : mcp . getAuthStatus ( args . name ) ,
677+ entry : auth . get ( args . name ) ,
678+ } )
679+ : undefined
672680 yield * Effect . promise ( async ( ) => {
673681 UI . empty ( )
674682 prompts . intro ( "MCP OAuth Debug" )
675683
676- const mcpServers = config . mcp ?? { }
677684 const serverName = args . name
678685
679- const serverConfig = mcpServers [ serverName ]
680686 if ( ! serverConfig ) {
681687 prompts . log . error ( `MCP server not found: ${ serverName } ` )
682688 prompts . outro ( "Done" )
@@ -698,13 +704,7 @@ export const McpDebugCommand = effectCmd({
698704 prompts . log . info ( `Server: ${ serverName } ` )
699705 prompts . log . info ( `URL: ${ serverConfig . url } ` )
700706
701- // Check stored auth status — services already in hand, run inline.
702- const { authStatus, entry } = await Effect . runPromise (
703- Effect . all ( {
704- authStatus : mcp . getAuthStatus ( serverName ) ,
705- entry : auth . get ( serverName ) ,
706- } ) ,
707- )
707+ const { authStatus, entry } = authInfo !
708708 prompts . log . info ( `Auth status: ${ getAuthStatusIcon ( authStatus ) } ${ getAuthStatusText ( authStatus ) } ` )
709709
710710 if ( entry ?. tokens ) {
0 commit comments