How can I wire my WIFI thermostat to control my millivolt fireplace?
You'll need a transformer to step down mains voltage, to 24 volts that the thermostat can use.  And you'll need a relay that can work with 24 volts.

You'll wire it up something like this.



When the thermostat calls for heat, the relay contact will be pulled closed.  This will signal the fireplace to turn on.

NOTE: the three contacts used on the thermostat are R, W, and C.  In the drawing the C may or may not look like a C, so I just wanted to make that clear.