From 5d4936346e6d00fb4add7b0db8f3867e30dbed9c Mon Sep 17 00:00:00 2001 From: Mark Henderson Date: Thu, 23 Apr 2026 17:09:00 -0700 Subject: [PATCH] fix: remove duplicate getService, fix project uuid check for services Made-with: Cursor --- app/api/mcp/route.ts | 7 ++++--- lib/coolify.ts | 4 ---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/app/api/mcp/route.ts b/app/api/mcp/route.ts index 65be40e..bcbe3bf 100644 --- a/app/api/mcp/route.ts +++ b/app/api/mcp/route.ts @@ -49,7 +49,6 @@ import { listAllServices, listServiceEnvs, upsertServiceEnv, - type ServiceEnvVar, updateApplication, deleteApplication, setApplicationDomains, @@ -446,8 +445,10 @@ async function toolAppsDeploy(principal: Principal, params: Record) try { const svc = await getService(appUuid); // Verify it belongs to this workspace's project - const proj = (svc.project as Record | undefined); - if (proj?.uuid !== projectUuid) { + const svcProjectUuid = svc.project_uuid + ?? svc.environment?.project_uuid + ?? svc.environment?.project?.uuid; + if (svcProjectUuid !== projectUuid) { return NextResponse.json({ error: 'Service not found in this workspace' }, { status: 404 }); } await startService(appUuid); diff --git a/lib/coolify.ts b/lib/coolify.ts index 69c76b9..c95efce 100644 --- a/lib/coolify.ts +++ b/lib/coolify.ts @@ -556,10 +556,6 @@ export async function stopService(uuid: string): Promise { await coolifyFetch(`/services/${uuid}/stop`, { method: 'POST' }); } -export async function getService(uuid: string): Promise> { - return coolifyFetch(`/services/${uuid}`); -} - export interface ServiceEnvVar { key: string; value: string; is_preview?: boolean; is_literal?: boolean; } export async function listServiceEnvs(uuid: string): Promise {