2. Let $M$ be a moving point on the ellipse $\frac{x^{2}}{4}+\frac{y^{2}}{3}=1$. Given points $F(1,0)$ and $P(3,1)$. Then the maximum value of $2|M F|-|M P|$ is $\qquad$.
2.1.

Notice that $F$ is the right focus of the ellipse, and the right directrix of the ellipse is $l: x=4$. Then $2|M F|$ is the distance from point $M$ to $l$.

Draw a perpendicular line $M A$ from point $M$ to $l$, and draw a perpendicular line $P B$ from point $P$ to $M A$, where $A$ and $B$ are the feet of the perpendiculars, respectively. Therefore,
$$
\begin{array}{l}
2|M F|-|M P|=|M A|-|M P| \\
\leqslant|M A|-|M B|=|A B|,
\end{array}
$$

where $|A B|$ is the distance from point $P$ to the right directrix, which equals 1.
Thus, when the y-coordinate of point $M$ is 1, the maximum value of $2|M F|-|M P|$ is 1.