Servants of the Machine God, the Adeptus Mechanicus know the mysteries of the machines and technology of the Imperium that many have forgotten. The masters of the mechanical, they serve to maintain infrastructure and tools to ensure that other forces of the Imperium are free to fight on in the Emperor's Name, secure in knowing that their homes and bases of operation will remain lit, fortified, and awaiting their safe return. Though their main purpose is not martial; this does not mean they do not see combat, merely that they do not actively seek it.
The Adeptus Mechanicus is an organisation that predates the Imperium itself. Though the Adeptus Mechanicus was formally integrated into the Imperium by the Treaty of Mars almost 10,000 years before the "present" of the 41st millennium, it retains an unparalleled degree of autonomy for an Imperial institution.
The birthplace of the Adeptus Mechanicus was the ancient Forge World Mars. Mars was colonised early in human history, and developed separately from Terra in both cultural and technological lines. The arid surface of Mars was terraformed, and under a man-made atmosphere the colony flourished. During the Golden Age of Technology, the two empires of Terra and Mars co-existed, to the mutual benefit of both. At the height of its splendour during the Golden Age, and even later in the anarchic Age of Strife, Mars dispatched hundreds of colony fleets into the void. Many perished in the terrible Warp Storms that engulfed the galaxy at that time, but others survived. Those who did founded new worlds in the name of the Machine God and built on them a likeness of the great factories and temples of their distant homeworld.
The Age of Strife brought an end to the glory and peace of the human domains. Across the galaxy mankind suddenly turned upon itself as a new breed of Warp attuned humans emerged. Civil war engulfed thousands of human worlds, even the twin Empires of Terra and Mars.
On Mars many warring factions vied for power, and a brutal war was waged using arcane and unimaginably destructive weaponry. The carefully constructed atmosphere was burned away, and once more the surface was exposed to the deadly radiations of the Sun. The terraformed environment, which had teemed with life, was rendered barren again. The combatants now fought in the same red hued wastelands that the first colonists had found. Much of the population retreated underground, as any who were not equipped with a radiation suit could not long survive on the surface.
During the Horus Heresy many Adeptus Mechanicus units declared for the Warmaster Horus and fought against those still loyal to the Emperor. The Fabricator General himself sided with the Warmaster but his deputy remained loyal. Horus swayed the Fabricator with an STC from the planet of Drakonis-Three-Eleven and a senior Adept named Regulus with STC's recovered from the Auretian Technocracy and promised much to the Adeptus Mechanicus in return for their allegiance.
With the expulsion of the Dark Mechanicus following the end of the Heresy with the other traitor forces, the loyal Adeptus Mechanicus continued their duties to the Imperium as was outlined in the Treaty of Mars. During the tumultuous Reign of Blood the Mechanicus remained neutral until the uprising of the Confederacy of Light when the Fabricator General declared for Sebastian Thor along with the Adeptus Astartes.
The Adeptus Mechanicus serve to keep the machinery and infrastructure of the Imperium running. To that end they maintain and report on barricade levels in Imperial-controlled suburbs as well as keep generators deployed, repaired, and fueled as well as Vox Casters deployed, repaired, and tuned to the appropriate frequencies. While not as obviously glorious as other agencies in their role or activities, their service is a vital one that ensures that those who fight on the front lines need not fear of the state of their strongholds and supply lines as the Mechanicum will keep the infrastructure intact and help keep the mutants and traitors who threaten it in line. Without the Mechanicum the Imperium cannot function.
The secondary duty of the Adeptus Mechanicus is the maintenance and processing of revive points. Being the most technologically adept, the Mechanicus are full aware of the needed treatments to push back the mutations. For this reason the Adeptus Mechanicus provides direct medical aid including revivification.