Depending on your state, there may be a building code that determines the minimum distance from the top of the opening to the bottom of the mantel or flammable material. Here is part of what I found on the web that should get a design start:
ational Building Code. The following is a reprint from the Standard Building Code.
2114.3 MASONRY FIREPLACES 2114.36 Fireplace hearth extensions shall be of approved noncombustible materials for all fireplaces. Where the fireplace opening is less than 6 sq.ft. (0.56m?), the hearth extension shall extend at least 16 inches (406mm) in front of the facing material and at least 8 inches (203mm) beyond each side of fireplace opening. Where fireplace opening is 6 sq.ft. (0.56m?) or larger, the hearth extension shall extend at least 20 inches (508mm) in front of the facing materials and at least 12 inches (305mm) beyond each side of the fireplace opening. Where a fireplace is elevated above or overhangs a floor, the hearth extension shall also extend over the area under the fireplace. 2114.3.7 Fireplaces constructed of masonry or reinforced concrete shall have hearth extensions of brick, concrete, stone, tile, or other approved noncombustible material properly supported and with no combustible material against the underside thereof. Wooden form or centers used during the construction of a hearth and hearth extensions shall be removed when construction is completed. EXCEPTION: A header of combustible material may be used to support the hearth extension provided that it is located more than 12 inches (305mm) from the face of the fireplace. 2114.3.8 All combustible wood beams, joist, and studs shall be maintained a minimum of 2 inches (51mm) from the outside face of the chimney or fireplace masonry. Headers supporting trimmer arches at fireplaces shall be not less than 20 inches (508mm) from the face of the chimney breast. Trimmers shall be not less than 6 inches (152mm) from the inside face of face of the nearest flue lining. 2114.3.9 Woodwork shall not be placed within 4 inches (102mm) of the back of the fireplace, but shall not prevent plastering directly on the masonry or metal lath and metal furring. 2114.3.10 All combustible mantels and similar trim shall be kept at least 6 inches from fireplace opening. Parts of the mantel assembly located along the sides of the fireplace opening, which project more than 1-1/2 inches (38mm) from the face of the fireplace, shall have additional clearance equal to he projection. Parts of the mantel assembly located above and projecting more than 1-1/2 inches (38mm) from the fireplace opening shall not be placed less than 12 inches (305mm) from the top of the fireplace opening. - 2806 FIREPLACES FACTORY BUILT 2086.1 Factory- Built Fireplace 2806.1.1 Factory built fireplaces shall be listed and shall be installed in accordance with the conditions of the listing. 2806.1.2 Factory built fireplaces shall be tested in accordance with and meet the requirements of UL 127 2806.1.3 Hearth extensions of approved factory-built fireplace stoves shall be installed in accordance with the listing. Masonry hearth extensions if used with factory-built fireplaces shall be installed as required in 2144.3.8. The hearth extension shall be readily distinguished from the surrounding area. 2806.1.4 Factory built fireplace shall be installed in accordance with 2114.3.12 2806.2 Factory-Built Fireplace Stoves and Solid Fuel Room Heaters 2806.2.1 Factory built fireplace stoves and solid fuel type room heaters shall be listed and shall be installed in accordance with the conditions of the listing. The factory-built fireplace stoves shall be tested in accordance with and meet requirements of UL737. The solid fuel type room heaters shall be tested in accordance with and meet requirements of UL1482. 2862.2.2 Factory-built fireplace stoves shall also be installed in accordance with 2806.12 and 2114.3.12 - 2806 FIREPLACES FACTORY BUILT False fireplaces may be used in connection with listed gas or electric heaters, provided such fireplaces are constructed of noncombustible materials. "
So my guess is at least 12 inches above the opening to start. Others can offer other advice. You might want to determine the thickness of the shelf as well as the projection from the wall so that better mounting advice can be given. Hope I didn't miss anything.
Peter