From ea1aff7200e2cea81cea7ee9502de6cf2e56eab0 Mon Sep 17 00:00:00 2001 From: YANG JIANKUAN Date: Thu, 2 Apr 2026 15:12:37 +0800 Subject: [PATCH] fix: correct MCP config snippet - add type:url, use port 3001 directly --- packages/web/src/pages/tabs/McpIntegration.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/web/src/pages/tabs/McpIntegration.tsx b/packages/web/src/pages/tabs/McpIntegration.tsx index a273e6e..4671e79 100644 --- a/packages/web/src/pages/tabs/McpIntegration.tsx +++ b/packages/web/src/pages/tabs/McpIntegration.tsx @@ -6,17 +6,20 @@ type Project = { id: string; name: string }; export default function McpIntegration({ project }: { project: Project }) { const [apiKey, setApiKey] = useState(null); - const mcpBaseUrl = window.location.origin; - const mcpUrl = `${mcpBaseUrl}/mcp/${project.id}`; + const mcpHost = window.location.hostname; + const mcpUrl = `http://${mcpHost}:3001/mcp/${project.id}`; const rotateMutation = useMutation({ mutationFn: () => apiFetch<{ apiKey: string }>(`/projects/${project.id}/api-key/rotate`, { method: 'POST' }), onSuccess: (data) => setApiKey(data.apiKey), }); + const serverName = project.name.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/(^-|-$)/g, ''); + const configSnippet = JSON.stringify({ mcpServers: { - [project.name.toLowerCase().replace(/\s+/g, '-')]: { + [serverName]: { + type: 'url', url: mcpUrl, headers: { Authorization: `Bearer ${apiKey || ''}` }, },