fix: STDIO transport stdout flush and MCP notification handling

- Wait for stdout.write callback before process.exit in STDIO transport
  to prevent truncation of large responses (e.g. grafana tools/list)
- Handle MCP notification methods (notifications/initialized, etc.) in
  router instead of returning "Method not found" error
- Use -p shorthand in config claude output

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Michal
2026-02-24 19:09:47 +00:00
parent 316f122605
commit 6df56b21d3
4 changed files with 20 additions and 8 deletions

View File

@@ -61,9 +61,10 @@ proc.stdout.on('data', d => {
const msg = JSON.parse(line);
if (msg.id === 2) {
responded = true;
process.stdout.write(JSON.stringify(msg));
proc.kill();
process.exit(0);
process.stdout.write(JSON.stringify(msg), () => {
proc.kill();
process.exit(0);
});
}
} catch {}
}