fix: Docker stdio communication for Claude Desktop compatibility
Fixed the initialization timeout issue with minimal changes: 1. Added stdout flush after server connection to combat Docker buffering 2. Fixed docker-entrypoint.sh to not output to stdout in stdio mode 3. Added process.stdin.resume() to keep server alive 4. Added IS_DOCKER environment variable for future use 5. Updated README to prioritize Docker with correct -i flag configuration The core issue was Docker's block buffering preventing immediate JSON-RPC responses. The -i flag maintains stdin connection, and explicit flushing ensures responses reach Claude Desktop immediately. Also fixed "Shutting down..." message that was breaking JSON-RPC protocol by redirecting it to stderr in stdio mode. Docker is now the recommended installation method as originally intended. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -912,6 +912,17 @@ Full documentation is being prepared. For now, use get_node_essentials for confi
|
||||
|
||||
const transport = new StdioServerTransport();
|
||||
await this.server.connect(transport);
|
||||
|
||||
// Force flush stdout for Docker environments
|
||||
// Docker uses block buffering which can delay MCP responses
|
||||
if (!process.stdout.isTTY) {
|
||||
// Write empty string to force flush
|
||||
process.stdout.write('', () => {});
|
||||
}
|
||||
|
||||
logger.info('n8n Documentation MCP Server running on stdio transport');
|
||||
|
||||
// Keep the process alive and listening
|
||||
process.stdin.resume();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user