add rpc server, improve stdin producer