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 || ''}` }, },