@@ -177,16 +177,6 @@ export class MCPConnectionManager extends ConnectionManager {
177177 undefined ,
178178 this . bus
179179 ) ;
180-
181- if ( isOidcConnection ) {
182- this . changeState ( "connection-request" , {
183- tag : "connecting" ,
184- serviceProvider,
185- connectedAtlasCluster : settings . atlas ,
186- connectionStringAuthType,
187- oidcConnectionType : connectionStringAuthType as OIDCConnectionAuthType ,
188- } ) ;
189- }
190180 } catch ( error : unknown ) {
191181 const errorReason = error instanceof Error ? error . message : `${ error as string } ` ;
192182 this . changeState ( "connection-error" , {
@@ -207,6 +197,13 @@ export class MCPConnectionManager extends ConnectionManager {
207197 connectionStringAuthType,
208198 } ) ;
209199 } else {
200+ this . changeState ( "connection-request" , {
201+ tag : "connecting" ,
202+ serviceProvider,
203+ connectedAtlasCluster : settings . atlas ,
204+ connectionStringAuthType,
205+ oidcConnectionType : connectionStringAuthType as OIDCConnectionAuthType ,
206+ } ) ;
210207 return this . currentConnectionState ;
211208 }
212209 } catch ( error : unknown ) {
@@ -226,22 +223,6 @@ export class MCPConnectionManager extends ConnectionManager {
226223 return this . currentConnectionState ;
227224 }
228225
229- if ( this . currentConnectionState . tag === "connected" || this . currentConnectionState . tag === "connecting" ) {
230- try {
231- if ( this . currentConnectionState . tag === "connected" ) {
232- await this . currentConnectionState . serviceProvider ?. close ( ) ;
233- }
234- if ( this . currentConnectionState . tag === "connecting" ) {
235- const serviceProvider = await this . currentConnectionState . serviceProvider ;
236- await serviceProvider . close ( ) ;
237- }
238- } finally {
239- this . changeState ( "connection-close" , {
240- tag : "disconnected" ,
241- } ) ;
242- }
243- }
244-
245226 return { tag : "disconnected" } ;
246227 }
247228
0 commit comments