Atomically ordered Rh2P nanoclusters encapsulated within a high-surface-area hollow mesoporous carbon nanoreactor are catalytically active for hydrogen production via the electrocatalytic hydrogen evolution reaction and the room-temperature dehydrogenation of ammonia borane.