mirror of
https://github.com/davidkaya/aryx.git
synced 2026-08-28 05:43:57 +02:00
fix: only probe OAuth for newly enabled MCP servers
Previously, every tooling update re-probed all enabled HTTP MCP servers for OAuth requirements. Now it compares the new selection against the previous one and only probes servers that were just enabled. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -1009,16 +1009,24 @@ export class AryxAppService extends EventEmitter<AppServiceEvents> {
|
|||||||
selection,
|
selection,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const previousEnabledMcpServerIds = new Set(session.tooling?.enabledMcpServerIds ?? []);
|
||||||
session.tooling = selection;
|
session.tooling = selection;
|
||||||
session.updatedAt = nowIso();
|
session.updatedAt = nowIso();
|
||||||
const result = await this.persistAndBroadcast(workspace);
|
const result = await this.persistAndBroadcast(workspace);
|
||||||
|
|
||||||
// Proactively authenticate HTTP MCP servers that need OAuth
|
// Proactively authenticate only newly enabled HTTP MCP servers
|
||||||
void this.probeAndAuthenticateHttpMcpServers(
|
const newlyEnabledIds = selection.enabledMcpServerIds.filter((id) => !previousEnabledMcpServerIds.has(id));
|
||||||
sessionId,
|
if (newlyEnabledIds.length > 0) {
|
||||||
resolveProjectToolingSettings(workspace.settings, project.discoveredTooling),
|
const selectionForNewServers = normalizeSessionToolingSelection({
|
||||||
selection,
|
enabledMcpServerIds: newlyEnabledIds,
|
||||||
);
|
enabledLspProfileIds: [],
|
||||||
|
});
|
||||||
|
void this.probeAndAuthenticateHttpMcpServers(
|
||||||
|
sessionId,
|
||||||
|
resolveProjectToolingSettings(workspace.settings, project.discoveredTooling),
|
||||||
|
selectionForNewServers,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user