diff --git a/tests/test_litellm/test_chat_ui_responses_session.py b/tests/test_litellm/test_chat_ui_responses_session.py index 6ff1f06fa7d..09ef003ebdb 100644 --- a/tests/test_litellm/test_chat_ui_responses_session.py +++ b/tests/test_litellm/test_chat_ui_responses_session.py @@ -12,7 +12,8 @@ import os import sys import unittest.mock as mock -sys.path.insert(0, os.path.abspath("../..")) +# Use __file__ so the import path is correct regardless of the pytest working directory. +sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..", "..")) import httpx import pytest diff --git a/ui/litellm-dashboard/src/components/playground/llm_calls/responses_api.tsx b/ui/litellm-dashboard/src/components/playground/llm_calls/responses_api.tsx index 923c613d77b..8b83b4824ed 100644 --- a/ui/litellm-dashboard/src/components/playground/llm_calls/responses_api.tsx +++ b/ui/litellm-dashboard/src/components/playground/llm_calls/responses_api.tsx @@ -105,13 +105,16 @@ export async function makeOpenAIResponsesRequest( // Individual servers selected - create one entry per server selectedMCPServers.forEach((serverId) => { const server = mcpServers?.find((s) => s.server_id === serverId); - const serverName = server?.alias || server?.server_name || serverId; + // Use server_name for URL routing (proxy registers by name, not alias). + const routeName = server?.server_name || serverId; + // Use alias as the human-readable label when available. + const serverLabel = server?.alias || routeName; const allowedTools = mcpServerToolRestrictions?.[serverId] || []; tools.push({ type: "mcp", - server_label: serverName, // unique label per server so tool calls route correctly - server_url: `${proxyBaseUrl}/mcp/${serverName}`, + server_label: serverLabel, // unique human-readable label per server + server_url: `${proxyBaseUrl}/mcp/${encodeURIComponent(routeName)}`, require_approval: "never", ...(allowedTools.length > 0 ? { allowed_tools: allowedTools } : {}), });