2. For the hyperbola $\frac{x^{2}}{a^{2}}-\frac{y^{2}}{b^{2}}=1$, the right focus is $F$, and the eccentricity is $e$. A line passing through point $F$ with an inclination angle of $\frac{\pi}{3}$ intersects the hyperbola at points $A, B$. If the midpoint of $A B$ is $M$, and $|F M|$ equals the semi-focal distance, then $e=$ $\qquad$.
Given the line $l:\left\{\begin{array}{l}x=c+\frac{1}{2} t, \\ y=\frac{\sqrt{3}}{2} t,\end{array}\right.$ substituting into $b^{2} x^{2}-a^{2} y^{2}=a^{2} b^{2}$ yields
$$
\left(\frac{1}{4} b^{2}-\frac{3}{4} a^{2}\right) t^{2}+b^{2} c t+b^{2} c^{2}-b^{2} a^{2}=0 \Rightarrow \frac{t_{1}+t_{2}}{2}=\frac{2 b^{2} c}{3 a^{2}-b^{2}},
$$

If $3 a^{2}>b^{2}$, then $\frac{2 b^{2} c}{3 a^{2}-b^{2}}=c \Rightarrow a^{2}=b^{2} \Rightarrow e=\sqrt{1+\frac{b^{2}}{a^{2}}}=\sqrt{2}$; if $3 a^{2}<b^{2}$, then $\frac{2 b^{2} c}{b^{2}-3 a^{2}}=c \Rightarrow 3 a^{2}=-b^{2}$, which is a contradiction. Therefore, $e=\sqrt{2}$.