In this paper, we consider a wireless machine-to-machine network composed of end-devices with energy harvesters that periodically transmit data to a gateway. While energy harvesting allows for perpetual operation, the uncertain amount of harvested energy may not guarantee fully continuous operation due to temporary energy shortages. This fact needs to be addressed at the medium access control layer. We thus investigate the performance of an energy harvesting-aware contention tree-based access (EH-CTA) protocol, which uses a tree-splitting algorithm to resolve collisions and takes energy availability into account. We derive a theoretical model to compute the <italic>probability of delivery</italic> and the <italic>time efficiency</italic>. In addition, we conduct a performance comparison of EH-CTA using an EH-aware dynamic frame slotted-ALOHA (EH-DFSA) as a benchmark. We determine the parameters that maximize performance and analyze how it is influenced by the amount of harvested energy and the number of end-devices. Results reveal the superior performance of EH-CTA over EH-DFSA. While EH-DFSA requires an estimate of the number of contending end-devices per frame to adapt the frame length, EH-CTA uses short and fixed frame lengths, which enables scalability and facilitates synchronization as the network density increases.