4. For the parabola $y^{2}=2 p x(p>0)$, the focus is $F$, and the directrix is $l$. Points $A$ and $B$ are two moving points on the parabola, and they satisfy $\angle A F B=\frac{\pi}{3}$. Let $M$ be the midpoint of segment $A B$, and let $N$ be the projection of $M$ on $l$. Then the maximum value of $\frac{|M N|}{|A B|}$ is $\qquad$.
4. 1 .

Solution 1 Let $\angle A B F=\theta\left(0<\theta<\frac{2 \pi}{3}\right)$. Then by the Law of Sines, we have
$$
\frac{|A F|}{\sin \theta}=\frac{|B F|}{\sin \left(\frac{2 \pi}{3}-\theta\right)}=\frac{|A B|}{\sin \frac{\pi}{3}} .
$$

Thus, $\frac{|A F|+|B F|}{\sin \theta+\sin \left(\frac{2 \pi}{3}-\theta\right)}=\frac{|A B|}{\sin \frac{\pi}{3}}$, which means
$$
\begin{array}{l}
\frac{|A F|+|B F|}{|A B|}=\frac{\sin \theta+\sin \left(\frac{2 \pi}{3}-\theta\right)}{\sin \frac{\pi}{3}} \\
=2 \cos \left(\theta-\frac{\pi}{3}\right) .
\end{array}
$$

As shown in Figure 5, by the definition of a parabola and the midline theorem of a trapezoid, we get
$$
\begin{array}{l}
|M N| \\
=\frac{|A F|+|B F|}{2} .
\end{array}
$$

Thus, $\frac{|M N|}{|A B|}$
$$
=\cos \left(\theta-\frac{\pi}{3}\right) \text {. }
$$

Therefore, when $\theta=\frac{\pi}{3}$, $\frac{|M N|}{|A B|}$ reaches its maximum value of 1.
Solution 2 Similarly to Solution 1, we obtain equation (1).
In $\triangle A F B$, by the Law of Cosines, we have
$$
\begin{array}{l}
|A B|^{2}=|A F|^{2}+|B F|^{2}-2|A F||B F| \cos \frac{\pi}{3} \\
=(|A F|+|B F|)^{2}-3|A F||B F| \\
\geqslant(|A F|+|B F|)^{2}-3\left(\frac{|A F|+|B F|}{2}\right)^{2} \\
=\left(\frac{|A F|+|B F|}{2}\right)^{2}=|M N|^{2} .
\end{array}
$$

Equality holds if and only if $|A F|=|B F|$.
Therefore, the maximum value of $\frac{|M N|}{|A B|}$ is 1.