Files
lcbp3/scripts/start-mcp.js
admin 9ab41058d8
Some checks failed
Spec Validation / validate-markdown (push) Has been cancelled
Spec Validation / validate-diagrams (push) Has been cancelled
Spec Validation / check-todos (push) Has been cancelled
251220:1705 On going update to 1.7.0: Revise Schema
2025-12-20 17:05:08 +07:00

33 lines
977 B
JavaScript

// scripts/start-mcp.js
const { spawn } = require('child_process');
const path = require('path');
const os = require('os');
// Resolve the external config file (outside the repo)
const configPath = path.resolve(os.homedir(), '.gemini', 'antigravity', 'mcp_config.json');
// Load the JSON config (will throw if invalid)
const config = require(configPath);
function runServer(name, command, args, env = {}) {
console.log(`▶️ Starting ${name}`);
const fullCmd = process.platform === 'win32' ? `${command}.cmd` : command;
const proc = spawn(fullCmd, args, {
stdio: 'inherit',
env: { ...process.env, ...env },
cwd: process.cwd(),
shell: true,
});
proc.on('close', (code) => {
if (code !== 0) {
console.error(`${name} exited with code ${code}`);
} else {
console.log(`${name} finished`);
}
});
}
Object.entries(config.mcpServers).forEach(([name, srv]) => {
runServer(name, srv.command, srv.args, srv.env);
});