@@ -19,8 +19,6 @@ import path from "path"
1919import { Global } from "@opencode-ai/core/global"
2020import { modify , applyEdits } from "jsonc-parser"
2121import { Filesystem } from "@/util/filesystem"
22- import { EventV2Bridge } from "@/event-v2-bridge"
23- import { EventV2 } from "@opencode-ai/core/event"
2422import { Effect } from "effect"
2523
2624function getAuthStatusIcon ( status : MCP . AuthStatus ) : string {
@@ -258,21 +256,13 @@ export const McpAuthCommand = effectCmd({
258256 const spinner = prompts . spinner ( )
259257 spinner . start ( "Starting OAuth flow..." )
260258
261- // Subscribe to browser open failure events to show URL for manual opening
262- const events = yield * EventV2Bridge . Service
263- const unsubscribe = yield * events . listen ( ( event ) => {
264- if ( event . type !== MCP . BrowserOpenFailed . type ) return Effect . void
265- const data = event . data as EventV2 . Data < typeof MCP . BrowserOpenFailed >
266- if ( data . mcpName === serverName ) {
267- spinner . stop ( "Could not open browser automatically" )
268- prompts . log . warn ( "Please open this URL in your browser to authenticate:" )
269- prompts . log . info ( data . url )
259+ yield * MCP . Service . use ( ( mcp ) =>
260+ mcp . authenticate ( serverName , ( url ) => {
261+ spinner . stop ( "Authorize in your browser:" )
262+ prompts . log . info ( url )
270263 spinner . start ( "Waiting for authorization..." )
271- }
272- return Effect . void
273- } )
274-
275- yield * MCP . Service . use ( ( mcp ) => mcp . authenticate ( serverName ) ) . pipe (
264+ } ) ,
265+ ) . pipe (
276266 Effect . tap ( ( status ) =>
277267 Effect . sync ( ( ) => {
278268 if ( status . status === "connected" ) {
@@ -307,7 +297,6 @@ export const McpAuthCommand = effectCmd({
307297 prompts . log . error ( error instanceof Error ? error . message : String ( error ) )
308298 } ) ,
309299 ) ,
310- Effect . ensuring ( unsubscribe ) ,
311300 )
312301
313302 prompts . outro ( "Done" )
0 commit comments