Add notification log for created MCPs

This commit is contained in:
root
2026-03-12 11:15:03 +00:00
parent 91a2f1b602
commit a55e65dae6

View File

@@ -66,6 +66,16 @@ async function createSystemdService(repoName: string, repoDir: string, seedPath:
return serviceName; return serviceName;
} }
function appendNotification(payload: { serviceName: string; description: string }) {
const file = '/root/.meta-mcp/notifications.jsonl';
const dir = path.dirname(file);
fs.mkdirSync(dir, { recursive: true });
fs.appendFileSync(file, JSON.stringify({
ts: new Date().toISOString(),
...payload,
}) + '\n');
}
function run(cmd: string, args: string[], cwd?: string): Promise<string> { function run(cmd: string, args: string[], cwd?: string): Promise<string> {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const child = spawn(cmd, args, { cwd, stdio: ['ignore', 'pipe', 'pipe'] }); const child = spawn(cmd, args, { cwd, stdio: ['ignore', 'pipe', 'pipe'] });
@@ -210,7 +220,10 @@ export async function runPipeline(jobId: string, request: MetaRequest): Promise<
}); });
// create a systemd service to keep the MCP alive // create a systemd service to keep the MCP alive
await createSystemdService(repoName, repoDir, repoSeedPath); const serviceName = await createSystemdService(repoName, repoDir, repoSeedPath);
const desc = request.requirements[0]?.description ?? repoName;
appendNotification({ serviceName, description: desc });
return { return {
status: 'running', status: 'running',