Qwen-code (#430)
This commit is contained in:
@@ -553,20 +553,25 @@ export const templatesApi = {
|
||||
|
||||
// MCP Servers APIs
|
||||
export const mcpServersApi = {
|
||||
load: async (executor: string): Promise<any> => {
|
||||
const response = await makeRequest(
|
||||
`/api/mcp-config?base_coding_agent=${encodeURIComponent(executor)}`
|
||||
);
|
||||
load: async (executor: string, mcpConfigPath?: string): Promise<any> => {
|
||||
const params = new URLSearchParams();
|
||||
params.set('base_coding_agent', executor);
|
||||
if (mcpConfigPath) params.set('mcp_config_path', mcpConfigPath);
|
||||
const response = await makeRequest(`/api/mcp-config?${params.toString()}`);
|
||||
return handleApiResponse<any>(response);
|
||||
},
|
||||
save: async (executor: string, serversConfig: any): Promise<void> => {
|
||||
const response = await makeRequest(
|
||||
`/api/mcp-config?base_coding_agent=${encodeURIComponent(executor)}`,
|
||||
{
|
||||
method: 'POST',
|
||||
body: JSON.stringify(serversConfig),
|
||||
}
|
||||
);
|
||||
save: async (
|
||||
executor: string,
|
||||
mcpConfigPath: string | undefined,
|
||||
serversConfig: any
|
||||
): Promise<void> => {
|
||||
const params = new URLSearchParams();
|
||||
params.set('base_coding_agent', executor);
|
||||
if (mcpConfigPath) params.set('mcp_config_path', mcpConfigPath);
|
||||
const response = await makeRequest(`/api/mcp-config?${params.toString()}`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(serversConfig),
|
||||
});
|
||||
if (!response.ok) {
|
||||
const errorData = await response.json();
|
||||
console.error('[API Error] Failed to save MCP servers', {
|
||||
|
||||
@@ -63,8 +63,11 @@ export function McpServers() {
|
||||
setMcpConfigPath('');
|
||||
|
||||
try {
|
||||
// Load MCP servers for the selected profile's base agent
|
||||
const result = await mcpServersApi.load(profile.agent);
|
||||
// Load MCP servers for the selected profile/agent
|
||||
const result = await mcpServersApi.load(
|
||||
profile.agent,
|
||||
profile.mcp_config_path || undefined
|
||||
);
|
||||
// Handle new response format with servers and config_path
|
||||
const data = result || {};
|
||||
const servers = data.servers || {};
|
||||
@@ -160,7 +163,11 @@ export function McpServers() {
|
||||
// Extract just the servers object for the API - backend will handle nesting/format
|
||||
const mcpServersConfig = strategy.extractServersForApi(fullConfig);
|
||||
|
||||
await mcpServersApi.save(selectedProfile.agent, mcpServersConfig);
|
||||
await mcpServersApi.save(
|
||||
selectedProfile.agent,
|
||||
mcpConfigPath || undefined,
|
||||
mcpServersConfig
|
||||
);
|
||||
|
||||
// Show success feedback
|
||||
setSuccess(true);
|
||||
|
||||
Reference in New Issue
Block a user