fix: correct MCP config snippet - add type:url, use port 3001 directly
This commit is contained in:
@@ -6,17 +6,20 @@ type Project = { id: string; name: string };
|
|||||||
|
|
||||||
export default function McpIntegration({ project }: { project: Project }) {
|
export default function McpIntegration({ project }: { project: Project }) {
|
||||||
const [apiKey, setApiKey] = useState<string | null>(null);
|
const [apiKey, setApiKey] = useState<string | null>(null);
|
||||||
const mcpBaseUrl = window.location.origin;
|
const mcpHost = window.location.hostname;
|
||||||
const mcpUrl = `${mcpBaseUrl}/mcp/${project.id}`;
|
const mcpUrl = `http://${mcpHost}:3001/mcp/${project.id}`;
|
||||||
|
|
||||||
const rotateMutation = useMutation({
|
const rotateMutation = useMutation({
|
||||||
mutationFn: () => apiFetch<{ apiKey: string }>(`/projects/${project.id}/api-key/rotate`, { method: 'POST' }),
|
mutationFn: () => apiFetch<{ apiKey: string }>(`/projects/${project.id}/api-key/rotate`, { method: 'POST' }),
|
||||||
onSuccess: (data) => setApiKey(data.apiKey),
|
onSuccess: (data) => setApiKey(data.apiKey),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const serverName = project.name.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/(^-|-$)/g, '');
|
||||||
|
|
||||||
const configSnippet = JSON.stringify({
|
const configSnippet = JSON.stringify({
|
||||||
mcpServers: {
|
mcpServers: {
|
||||||
[project.name.toLowerCase().replace(/\s+/g, '-')]: {
|
[serverName]: {
|
||||||
|
type: 'url',
|
||||||
url: mcpUrl,
|
url: mcpUrl,
|
||||||
headers: { Authorization: `Bearer ${apiKey || '<your-api-key>'}` },
|
headers: { Authorization: `Bearer ${apiKey || '<your-api-key>'}` },
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user