42
/** @inheritdoc */
43
public async start(methods: IMcpClientMethods): Promise<McpConnectionState> {
45
>
if (!McpConnectionState.canBeStarted(currentState.state)) {
46
return this._waitForState(McpConnectionState.Kind.Running, McpConnectionState.Kind.Error);
47
}
49
>
this._launch.value = undefined;
50
>
this._state.set({ state: McpConnectionState.Kind.Starting }, undefined);
51
>
this._logger.info(localize('mcpServer.starting', 'Starting server {0}', this.definition.label));
52
>
53
>
try {
54
>
const launch = this._delegate.start(this._collection, this.definition, this.launchDefinition, { errorOnUserInteraction: this._errorOnUserInteraction });
55
>
this._launch.value = this.adoptLaunch(launch, methods);
56
>
return this._waitForState(McpConnectionState.Kind.Running, McpConnectionState.Kind.Error);
57
>
} catch (e) {
58
const errorState: McpConnectionState = {
59
state: McpConnectionState.Kind.Error,