@openeryc/pi-coding-agent 0.75.52 → 0.75.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1701,13 +1701,15 @@ export class AgentSession {
1701
1701
  this._mcpManager = null;
1702
1702
  }
1703
1703
  this._mcpManager = new MCPManager();
1704
+ // Suppress per-server refresh during bulk startup; refresh once after
1705
+ let batchInit = true;
1704
1706
  this._mcpManager.onStatusChange = (_serverName, status) => {
1705
- if (status === "connected") {
1706
- // A server reconnected — refresh the tool registry
1707
+ if (!batchInit && status === "connected") {
1707
1708
  this._refreshMcpTools();
1708
1709
  }
1709
1710
  };
1710
1711
  await this._mcpManager.start(mcpServers);
1712
+ batchInit = false;
1711
1713
  this._refreshMcpTools();
1712
1714
  }
1713
1715
  _refreshMcpTools() {
@@ -1719,8 +1721,24 @@ export class AgentSession {
1719
1721
  this._refreshToolRegistry();
1720
1722
  }
1721
1723
  }
1722
- /** Reload MCP servers after config changes (e.g. toggle enabled). */
1723
- async reloadMcp() {
1724
+ /** Reload MCP servers after config changes (e.g. toggle enabled).
1725
+ * If changedServer is provided, only that server is started/stopped
1726
+ * instead of restarting all servers. */
1727
+ async reloadMcp(changedServer) {
1728
+ if (changedServer && this._mcpManager) {
1729
+ const configs = this.settingsManager.getMcpServers();
1730
+ const config = configs?.[changedServer];
1731
+ if (!config || config.enabled === false) {
1732
+ // Server was disabled — stop it
1733
+ await this._mcpManager.stopServer(changedServer);
1734
+ }
1735
+ else {
1736
+ // Server was enabled — start it
1737
+ await this._mcpManager.startServer(changedServer, config);
1738
+ }
1739
+ this._refreshMcpTools();
1740
+ return;
1741
+ }
1724
1742
  await this._initMcp();
1725
1743
  }
1726
1744
  /** Get MCP connection statuses (for UI display) */