Magoki-Attori Mosque is a historical mosque in Bukhara, Uzbekistan. It forms a part of the historical religious complex of Lyabi Khauz. The mosque is located in the historical center of Bukhara, about 300 meters southwest of Poi-Kalyan, 100 meters southwest of the Toqi Telpak Furushon trading dome and 100 meters east of Lyabi Khauz.

It is part of the UNESCO World Heritage Site Historic Centre of Bukhara. Today, the mosque is used as a carpet museum. It is speculated to have been built in the 9th to 10th century on the remains of a Zoroastrian temple from the pre-Islamic era. Before the Arab conquest, there was a bazaar on the site of Magoki Attori. It was a market for idols, potions, perfumes (attar), and other goods.
There was also formerly a Temple of the Moon (Mokh) close to this place. Before the construction of the first synagogue, Jews in Bukhara shared a place in a mosque with Muslims. Some say that Bukharian Jews and Muslims worshipped alongside each other at the same time, while other sources insist that Jews worshipped after Muslims.
The mosque is notable for being one of the oldest surviving mosques in Central Asia and one of the few surviving buildings in Bukhara from the time before the Mongolian invasion. In the 12th century, during the Kara-Khanid rule, the mosque was substantially rebuilt and re-dressed. It also received a new main facade in the south. In the middle of the 15th century, it was restored and a new portal with an iwan was built on the eastern side. At the beginning of the 1930s, the mosque underwent another restoration.
The building has a rectangular ground plan measuring 12 by 7.5 meters. In the main axis, the flat roof carries two octagonal tholobates with latticed arched windows and octagonal domes. The floor of the mosque is about 4.50 meters below the earth's surface, which explains the name addition "Magok-i," meaning "in the hole" or "in the subsoil."
Another subsoil mosque is the Magok-i-Kurpa Mosque, located about 150 meters northwest. Narshakhi, in his History of Bukhara around 950, referred to the mosque built on the site of the former temple as "magok," meaning "in a pit," because even then half of it was concealed from view by the rising soil level. The southern facade, once the main entrance, is the most richly decorated part of the building.
Ornaments are primarily created through the arrangement of cut and carved bricks and terracotta tiles with floral motifs. The pointed arch of the iwan rests on two-quarter columns set into the walls, which are decorated with a woven pattern. On each side of the iwan, three rectangular frames with decorative patterns are arranged one above the other.