Bob,
The IMO number was introduced by the International Maritime Organisation as an aid to enhancing safety and as a measure to combat maritime fraud. The IMO has given LR Fairplay (now IHS Fairplay) sole authority for issuing IMO numbers which are based on the old Lloyds Register (LR) unique numbering system. The IMO number applies only to merchant vessels, hence there is no requirement for military vessels to be issued with them. However, LR and LR Fairplay did go through a phase of issuing LR numbers to military ships but, although LR numbers follow exactly the same pattern as IMO numbers, they are not strictly 'IMO numbers'. Although issued (though I don't believe it is comprehensively) it is rare to see 'LR numbers' published for military ships.
The MMSI number is a non-unique number issued to vessels for satellite radio telephony. It applies to both merchant and military vessels as well as leisure craft. However, MMSI numbers do not remain constant when ships change flag and can be re-used. Hence, it is not a good way of accurately identifying vessels. Most vessels transmitting an AIS signal will display their MMSI number, so sites such as marinetraffic.com and vesseltracker.com are one way to source an MMSI number.
Brgds
Phil.