diff --git a/app/api/mcp/route.ts b/app/api/mcp/route.ts index e341f14..52a45a3 100644 --- a/app/api/mcp/route.ts +++ b/app/api/mcp/route.ts @@ -1273,7 +1273,13 @@ async function ensureServiceUp(uuid: string): Promise<{ let composeDiag = ''; try { const r = await composeUp('service', uuid, { timeoutMs: 600_000 }); - composeDiag = (r.stderr || r.stdout).trim().slice(-400); + // Strip ANSI / control chars (compose progress output uses \r and + // ANSI escapes) so the diag survives JSON serialization cleanly. + composeDiag = (r.stderr || r.stdout) + .replace(/\x1b\[[0-9;]*[a-zA-Z]/g, '') + .replace(/[\x00-\x08\x0B-\x1F]/g, '') + .trim() + .slice(-400); if (r.code === 0) { return { started: true, startMethod: 'compose-up', diag: '' }; }