2026-01-24 22:33:29 +08:00
|
|
|
import { getBackendBaseURL } from "@/core/config";
|
2026-01-20 23:43:21 +08:00
|
|
|
|
|
|
|
|
import type { MCPConfig } from "./types";
|
|
|
|
|
|
|
|
|
|
export async function loadMCPConfig() {
|
2026-01-24 22:33:29 +08:00
|
|
|
const response = await fetch(`${getBackendBaseURL()}/api/mcp/config`);
|
2026-01-20 23:43:21 +08:00
|
|
|
return response.json() as Promise<MCPConfig>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export async function updateMCPConfig(config: MCPConfig) {
|
2026-01-24 22:33:29 +08:00
|
|
|
const response = await fetch(`${getBackendBaseURL()}/api/mcp/config`,
|
2026-01-20 23:43:21 +08:00
|
|
|
{
|
|
|
|
|
method: "PUT",
|
|
|
|
|
headers: {
|
|
|
|
|
"Content-Type": "application/json",
|
|
|
|
|
},
|
|
|
|
|
body: JSON.stringify(config),
|
|
|
|
|
},
|
|
|
|
|
);
|
|
|
|
|
return response.json();
|
|
|
|
|
}
|