Why is the host name in the shell prompt "MacBook-2" instead of "MacBook"?
This is because there can't be two devices on the network with the same name. MacBook becomes MacBook-1, then MacBook-2.

You can check this with:

scutil --get ComputerName


This could be because there are two other devices with the name MacBook, or because Bonjour hasn't forgotten that the device disconnected. It's nothing to worry about, and you can change the computer name from System Preferences → Sharing or use scutil to ask for a name change.

scutil --set ComputerName MacBook