Logitech MX Keys connects to dock but does not connect to mac
The Logitech MX Keys is a wireless keyboard that uses either Bluetooth LE (low energy) or the Logitech Unifying wireless receiver. The USB cable is for charging only. 

So, excluding the USB connection from your question, this comes down to the following possibilities:


Bluetooth Issue
Defective Keyboard


You might have interference issues with your BT (AirPort card) on your Mac. To isolate, remove the dock and try pairing. If that doesn’t work, try pairing with the USB receiver. But to get a solid diagnosis of your BT adapter, try a different device to ensure it connects as it should 

As for your keyboard, try pairing with another computer. If the symptoms persist, it’s the keyboard and it should be returned.   If they don’t, then you’ve definitely narrowed it down to your Mac.