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

@@ -45,7 +45,7 @@ describe('config claude', () => {
const written = JSON.parse(readFileSync(outPath, 'utf-8'));
expect(written.mcpServers['homeautomation']).toEqual({
command: 'mcpctl',
args: ['mcp', '--project', 'homeautomation'],
args: ['mcp', '-p', 'homeautomation'],
});
expect(output.join('\n')).toContain('1 server(s)');
});
@@ -60,7 +60,7 @@ describe('config claude', () => {
const parsed = JSON.parse(output[0]);
expect(parsed.mcpServers['myproj']).toEqual({
command: 'mcpctl',
args: ['mcp', '--project', 'myproj'],
args: ['mcp', '-p', 'myproj'],
});
});
@@ -80,7 +80,7 @@ describe('config claude', () => {
expect(written.mcpServers['existing--server']).toBeDefined();
expect(written.mcpServers['proj-1']).toEqual({
command: 'mcpctl',
args: ['mcp', '--project', 'proj-1'],
args: ['mcp', '-p', 'proj-1'],
});
expect(output.join('\n')).toContain('2 server(s)');
});
@@ -96,7 +96,7 @@ describe('config claude', () => {
const written = JSON.parse(readFileSync(outPath, 'utf-8'));
expect(written.mcpServers['proj-1']).toEqual({
command: 'mcpctl',
args: ['mcp', '--project', 'proj-1'],
args: ['mcp', '-p', 'proj-1'],
});
});