Server = Deployment (defines what to run + desired replicas) Instance = Pod (ephemeral, auto-created by reconciliation) Backend: - Add replicas field to McpServer schema - Add reconcile() to InstanceService (scales instances to match replicas) - Remove manual start/stop/restart - instances are auto-managed - Cascade: deleting server stops all containers then cascades DB - Server create/update auto-triggers reconciliation CLI: - Add top-level delete command (servers, instances, profiles, projects) - Add top-level logs command - Remove instance compound command (use get/delete/logs instead) - Clean up project command (list/show/delete → top-level get/describe/delete) - Enhance describe for instances with container inspect info - Add replicas to apply command's ServerSpec Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
30 lines
879 B
TypeScript
30 lines
879 B
TypeScript
import { Command } from 'commander';
|
|
import type { ApiClient } from '../api-client.js';
|
|
|
|
export interface LogsCommandDeps {
|
|
client: ApiClient;
|
|
log: (...args: unknown[]) => void;
|
|
}
|
|
|
|
export function createLogsCommand(deps: LogsCommandDeps): Command {
|
|
const { client, log } = deps;
|
|
|
|
return new Command('logs')
|
|
.description('Get logs from an MCP server instance')
|
|
.argument('<instance-id>', 'Instance ID')
|
|
.option('-t, --tail <lines>', 'Number of lines to show')
|
|
.action(async (id: string, opts: { tail?: string }) => {
|
|
let url = `/api/v1/instances/${id}/logs`;
|
|
if (opts.tail) {
|
|
url += `?tail=${opts.tail}`;
|
|
}
|
|
const logs = await client.get<{ stdout: string; stderr: string }>(url);
|
|
if (logs.stdout) {
|
|
log(logs.stdout);
|
|
}
|
|
if (logs.stderr) {
|
|
process.stderr.write(logs.stderr);
|
|
}
|
|
});
|
|
}
|