It has been my experience MTP batteries generally need to be replaced about once a month. Nevertheless I understand this is new and unwelcome behavior for you. I suggest that you un-pair and reset the MTP, and pair it again. Refer to Set up your Magic Keyboard, Magic Mouse, or Magic Trackpad with your Mac - Apple Support.
Don't attempt any of that without having a wired USB mouse on hand first; as it states:
"To set them up, you need a wired or wireless mouse or trackpad that is already connected to your Mac."
If that doesn't help, "forget" the MTP in BT Preferences and start over from the beginning.
First be sure to use a good pair of quality alkaline batteries, which should go without saying, but rechargeable batteries and some no-name batteries just don't work.
Connect your alternate input device and verify its operation. Then,
- Power down the MTP by pressing and holding its power button until it shuts down. That takes four or five seconds. Its little LED will extinguish. If in doubt just remove the end cap, and replace it. The idea is to begin from a power off condition.
- Then, open Bluetooth Preferences by selecting that option in the Mac's Bluetooth menu icon. If that icon is not present, open System Preferences > Bluetooth. Keep that Preference pane open.
- Press and hold the MTP power button and keep it depressed. Do not release it.
- The MTP should appear in Bluetooth Preferences with a Connect button adjacent to it.
- Release the MTP power button, then Connect.
That should do it.