feat(network): centralize proxy settings and add MCP routing (NAN-315) (#6372)

* feat(network): share proxy settings across features and MCP (NAN-315)

* fix(network): address shared proxy review regressions

* test(network): align rebased OAuth fixtures with runtime admission

* fix(webui): configure shared proxy without leaving connection drafts

* feat(webui): add optional shared proxy authentication editor

* fix(webui): align proxy save tests and loading skeleton
This commit is contained in:
chengyongru authored and GitHub committed 2026-10-22 15:49:27 +08:00
1 parent 872a83340d
commit 084b6bb394
181 files changed
+3740 -807

No files matched your search

+15 -3
View File
@@ -841,7 +841,7 @@ describe("webui API helpers", () => {
it("serializes OAuth provider advanced settings", async () => {
await updateProviderSettings(mutationTransport, {
provider: "xai_grok",
proxy: "http://127.0.0.1:7890",
use_proxy: true,
extraBody: '{"tools":[]}',
});
@@ -849,7 +849,7 @@ describe("webui API helpers", () => {
"settings.provider.update",
{
provider: "xai_grok",
proxy: "http://127.0.0.1:7890",
use_proxy: true,
extraBody: '{"tools":[]}',
},
20_000,
@@ -864,7 +864,7 @@ describe("webui API helpers", () => {
extraHeaders: '{"X-Tenant":"engineering"}',
extraBody: '{"service_tier":"priority"}',
extraQuery: '{"api-version":"2026-01-01"}',
proxy: "http://127.0.0.1:7890",
use_proxy: true,
thinkingStyle: "enable_thinking",
};
await createProviderSettings(mutationTransport, update);
@@ -1182,6 +1182,18 @@ describe("webui API helpers", () => {
);
});
it.each(["true", "false"])("preserves explicit MCP proxy flag %s across setup and edits", async (use_proxy) => {
await runMcpPresetAction(mutationTransport, "enable", "notion", { use_proxy });
expect(requestMutation).toHaveBeenLastCalledWith("settings.mcp.enable", { name: "notion", use_proxy }, 20_000);
await startMcpOAuth(mutationTransport, "notion", false, { use_proxy });
expect(requestMutation).toHaveBeenLastCalledWith("settings.mcp.oauth_start", { name: "notion", use_proxy }, 30_000);
await runMcpPresetAction(mutationTransport, "proxy", "notion", { use_proxy });
expect(requestMutation).toHaveBeenLastCalledWith("settings.mcp.proxy", { name: "notion", use_proxy }, 20_000);
const custom = { name: "docs", transport: "sse", url: "https://example.com/sse", use_proxy };
await saveCustomMcpServer(mutationTransport, custom);
expect(requestMutation).toHaveBeenLastCalledWith("settings.mcp.custom", custom, 20_000);
});
it("serializes custom MCP, mcp.json import, and tool allowlist actions", async () => {
const custom = {
name: "docs",