import { spawn } from 'child_process';
import { fileURLToPath } from 'url';
import { dirname, join } from 'path';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const serverPath = join(__dirname, 'dist', 'index.js');
const child = spawn('node', [serverPath], {
stdio: ['pipe', 'pipe', 'inherit'] // pipe stdin/out, inherit stderr so we see errors
});
const request = {
jsonrpc: "2.0",
id: 1,
method: "tools/call",
params: {
name: "register_project",
arguments: { name: "Test Project", rootPath: "/tmp/test-mcp-project" }
}
};
child.stdout.on('data', (data) => {
console.log('Received:', data.toString());
child.kill();
});
const json = JSON.stringify(request);
console.log('Sending:', json);
child.stdin.write(json + '\n');