diff --git a/infrastructure/tools/src/main/kotlin/com/correx/infrastructure/tools/mcp/McpStdioClient.kt b/infrastructure/tools/src/main/kotlin/com/correx/infrastructure/tools/mcp/McpStdioClient.kt index 6c959db1..d71fecf1 100644 --- a/infrastructure/tools/src/main/kotlin/com/correx/infrastructure/tools/mcp/McpStdioClient.kt +++ b/infrastructure/tools/src/main/kotlin/com/correx/infrastructure/tools/mcp/McpStdioClient.kt @@ -97,7 +97,15 @@ internal class McpClient( */ suspend fun spawn(serverId: String, command: List, env: Map): McpClient { val process = withContext(Dispatchers.IO) { - ChildProcess.builder(command).apply { environment().putAll(env) }.start() + ChildProcess.builder(command) + .apply { + environment().putAll(env) + // ChildProcess defaults stdin to /dev/null (so scaffolders fail fast instead of + // hanging). MCP stdio is the opposite: the server READS requests from stdin, so + // it needs a live pipe or it sees EOF and exits immediately. Restore the pipe. + redirectInput(ProcessBuilder.Redirect.PIPE) + } + .start() } val client = McpClient(serverId, StdioTransport(process)) client.initialize()