From c76c7c9be7e768a1f9b9ea73d678dfb03c16f2f0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 1 Dec 2025 04:28:48 +0000 Subject: [PATCH] Fix tool and prompt description update not calling API The issue was that toolService.ts and promptService.ts were setting Authorization: Bearer header manually, but the backend expects the x-auth-token header. The auth interceptor already handles adding x-auth-token automatically, so the fix is to remove the manual header and let the interceptor do its job. Co-authored-by: samanhappy <2755122+samanhappy@users.noreply.github.com> --- frontend/src/services/promptService.ts | 6 +----- frontend/src/services/toolService.ts | 19 ++++--------------- mcp_settings.json | 2 +- 3 files changed, 6 insertions(+), 21 deletions(-) diff --git a/frontend/src/services/promptService.ts b/frontend/src/services/promptService.ts index 6ad917a..60b0499 100644 --- a/frontend/src/services/promptService.ts +++ b/frontend/src/services/promptService.ts @@ -126,14 +126,10 @@ export const updatePromptDescription = async ( ): Promise<{ success: boolean; error?: string }> => { try { // URL-encode server and prompt names to handle slashes (e.g., "com.atlassian/atlassian-mcp-server") + // Auth header is automatically added by the interceptor const response = await apiPut( `/servers/${encodeURIComponent(serverName)}/prompts/${encodeURIComponent(promptName)}/description`, { description }, - { - headers: { - Authorization: `Bearer ${localStorage.getItem('mcphub_token')}`, - }, - }, ); return { diff --git a/frontend/src/services/toolService.ts b/frontend/src/services/toolService.ts index e480899..a4c6828 100644 --- a/frontend/src/services/toolService.ts +++ b/frontend/src/services/toolService.ts @@ -30,11 +30,8 @@ export const callTool = async ( ? `/tools/${encodeURIComponent(server)}/${encodeURIComponent(request.toolName)}` : '/tools/call'; - const response = await apiPost(url, request.arguments, { - headers: { - Authorization: `Bearer ${localStorage.getItem('mcphub_token')}`, // Add bearer auth for MCP routing - }, - }); + // Auth header is automatically added by the interceptor + const response = await apiPost(url, request.arguments); if (response.success === false) { return { @@ -66,14 +63,10 @@ export const toggleTool = async ( ): Promise<{ success: boolean; error?: string }> => { try { // URL-encode server and tool names to handle slashes (e.g., "com.atlassian/atlassian-mcp-server") + // Auth header is automatically added by the interceptor const response = await apiPost( `/servers/${encodeURIComponent(serverName)}/tools/${encodeURIComponent(toolName)}/toggle`, { enabled }, - { - headers: { - Authorization: `Bearer ${localStorage.getItem('mcphub_token')}`, - }, - }, ); return { @@ -99,14 +92,10 @@ export const updateToolDescription = async ( ): Promise<{ success: boolean; error?: string }> => { try { // URL-encode server and tool names to handle slashes (e.g., "com.atlassian/atlassian-mcp-server") + // Auth header is automatically added by the interceptor const response = await apiPut( `/servers/${encodeURIComponent(serverName)}/tools/${encodeURIComponent(toolName)}/description`, { description }, - { - headers: { - Authorization: `Bearer ${localStorage.getItem('mcphub_token')}`, - }, - }, ); return { diff --git a/mcp_settings.json b/mcp_settings.json index ede0dd4..35f9ea5 100644 --- a/mcp_settings.json +++ b/mcp_settings.json @@ -12,7 +12,7 @@ "tools": { "amap-maps_regeocode": { "enabled": true, - "description": "My custom description" + "description": "Updated via UI test" } } },