Presumably the ESPs will be connecting to a WiFi access point (AP) and will get IP address using DHCP. A decent AP will provide DNS and will give each connecting ESP a hostname, and that hostname is likely to include the ESP's MAC address.
A separate problem: if you're going to have hundreds of ESPs, you'll likely exhaust the AP's DHCP range. And if you want to access them from outside that WiFi network (e.g. from elsewhere on the Internet), you also have a problem of routing connections into the ESPs' internal addresses.