To shut down a Mac server remotely, you first need to connect to that server, you can use ssh to do that.

Once you are connected turn off your Mac remotely is easy. Enter this command.

sudo -h shutdown now

That is it, your Mac server should be turning off now.