Magic Mouse Battery Plug In
The Magic Mouse battery level is shown under the device name in the Bluetooth menu. You can install an app such as iStat Menus for easier access to such information directly in the menu bar. Software development questions are off-topic here.