Montecarlo rises on a hilly area, between the Valdinievole and the plane of Lucca; it is a "young" town: in fact its origins coincide with the realization of the fortress (XIV century).
It was founded in 1333 by the future Emperor Carlo IV of Boemia, who transformed the stronghold into one of his strategic bases during the battles between the most important Tuscan cities in the XIV century. It was built for the ihabitants of Vivinaia, town destroyed by Florence in 1331.
The Collegiata church of Sant’Andrea was realised together with the fortress between 1332 and 1334, with the same name of the church of Vivinaia, taking also its font. The planning of the Collegiata in its original architecture met the needs of Montecarlo, a fortified village that had been raised for purely military purposes. Therefore, the lower and original part of the façade was quite low.
Since the Collegiata was the tallest building in the village, an edict was issued and forbade any citizen to climb its roof, from where it would have been possible to spy the interior of the castle. For the same reasons, the church's bell tower had been carried out in such a way that its height did not exceed the roof. It was raised to its definitive height in 1903.
The Pieve of San Piero, already mentioned in a document dated 846, exercised its jurisdition for many years on Vivinaia, before, and Montecarlo, later. It eas built on an ancient early-Christian church, whose remains are still visible, despite the construction in serena stone in the XII century.