Skip to content

Commit 91c99e5

Browse files
authored
chore: clean up ConnectionManager.connect (#588)
1 parent 2d3abee commit 91c99e5

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

src/common/connectionManager.ts

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,6 @@ export class MCPConnectionManager extends ConnectionManager {
132132
let serviceProvider: Promise<NodeDriverServiceProvider>;
133133
let connectionInfo: ConnectionInfo;
134134
let connectionStringAuthType: ConnectionStringAuthType = "scram";
135-
let isOidcConnection: boolean = false;
136135

137136
try {
138137
settings = { ...settings };
@@ -166,7 +165,6 @@ export class MCPConnectionManager extends ConnectionManager {
166165
connectionInfo
167166
);
168167

169-
isOidcConnection = connectionStringAuthType.startsWith("oidc");
170168
serviceProvider = NodeDriverServiceProvider.connect(
171169
connectionInfo.connectionString,
172170
{
@@ -189,23 +187,22 @@ export class MCPConnectionManager extends ConnectionManager {
189187
}
190188

191189
try {
192-
if (!isOidcConnection) {
193-
return this.changeState("connection-success", {
194-
tag: "connected",
195-
connectedAtlasCluster: settings.atlas,
196-
serviceProvider: await serviceProvider,
197-
connectionStringAuthType,
198-
});
199-
} else {
200-
this.changeState("connection-request", {
190+
if (connectionStringAuthType.startsWith("oidc")) {
191+
return this.changeState("connection-request", {
201192
tag: "connecting",
202193
serviceProvider,
203194
connectedAtlasCluster: settings.atlas,
204195
connectionStringAuthType,
205196
oidcConnectionType: connectionStringAuthType as OIDCConnectionAuthType,
206197
});
207-
return this.currentConnectionState;
208198
}
199+
200+
return this.changeState("connection-success", {
201+
tag: "connected",
202+
connectedAtlasCluster: settings.atlas,
203+
serviceProvider: await serviceProvider,
204+
connectionStringAuthType,
205+
});
209206
} catch (error: unknown) {
210207
const errorReason = error instanceof Error ? error.message : `${error as string}`;
211208
this.changeState("connection-error", {

0 commit comments

Comments
 (0)