Is the mach number of an aircraft measured with respect to stagnation speed of sound?
The Mach number is defined with respect to the static speed of sound.
Note however that the Mach number is not measured by somehow measuring the TAS (True AirSpeed) and dividing it by the known speed of sound because this would require knowing the static speed of sound, which is temperature dependent. Instead, we derive the Mach number from the ram air pressure $p_0$ measured by the pitot tube and the static air pressure $p$ measured by the static port:

$$ M^2 = \frac{2}{\gamma - 1} \left[ \left( \frac{p_0}{p} \right)^{(\gamma - 1) / \gamma} - 1 \right] $$
[...]
The velocity can be determined from
$$ V^2 = a^2 M^2 = \frac{a_0^2 M^2}{1 + \frac{\gamma - 1}{2} M^2} $$
but this requires knowing either the static speed of sound $a$, or the stagnation speed of sound $a_o$.

(MIT Lecture Notes on Subsonic Pitot Tubes)
You can see in the velocity equation that the Mach number $ M = V / a $ is defined via the static speed of sound $a$ instead of the stagnation speed of sound $a_0$.
The above equations are only valid for subsonic flow. If you want to determine the Mach number in supersonic flow, you have to solve the following equation iteratively:
$$ M \approx 0.88128485 \sqrt{\left( \frac{p_0}{p} + 1 \right) \left( 1 - \frac{1}{7 M^2} \right)^{2.5}} $$
(Wikipedia - Mach Number)