1977
1978
async startMcpServer(id: string): Promise<void> {
1980
>
if (!serverName) {
1981
this._logService.warn(`[Copilot:${this.sessionId}] Cannot start unknown MCP server customization ${id}`);
1982
return;
1983
}
1984
>
// stopServer leaves inline session MCP servers not_configured; disable->enable is the validated restart path.
copilotAgentSession.ts
1985
>
await this._disableMcpServer(serverName);
1986
>
// The SDK reconnects in the background on enable with no live "starting"
1987
>
// event, so surface Starting optimistically until the seed below settles it.
1988
>
this._mcpCustomizations.markStarting([serverName]);
1989
>
try {
1990
>
await this._wrapper.session.rpc.mcp.enable({ serverName });
1991
>
await this._wrapper.session.rpc.mcp.listTools({ serverName });
1992
>
} finally {
1993
>
// Always reconcile against the SDK's real state -- on success this
1994
>
// settles Starting -> Ready/AuthRequired, and on failure it clears the
1995
>
// optimistic Starting instead of leaving the UI stuck.
1996
>
this._seedMcpServersFromRpc();
1997
>
}
1998
>
}
1999
2000
private async _reconcileMcpServerEnablement(): Promise<void> {