Let $F$ be the focus of parabola $y^2=2px(p>0)$, with directrix $l$ and two points $A,B$ on it. Knowing that $\angle AFB=\frac{\pi}{3}$, find the maximal value of $\frac{|MN|}{|AB|}$, where $M$ is the midpoint of $AB$ and $N$ is the projection of $M$ to $l$.
1. **Identify the focus and directrix of the parabola:**
   The given parabola is \( y^2 = 2px \) with \( p > 0 \). The focus \( F \) of this parabola is at \( (p/2, 0) \), and the directrix \( l \) is the line \( x = -p/2 \).

2. **Define the points \( A \) and \( B \) on the parabola:**
   Let \( A = (x_1, y_1) \) and \( B = (x_2, y_2) \) be points on the parabola. Since these points lie on the parabola, they satisfy the equation \( y_1^2 = 2px_1 \) and \( y_2^2 = 2px_2 \).

3. **Use the definition of the parabola:**
   By the definition of a parabola, the distance from any point on the parabola to the focus is equal to the distance from that point to the directrix. Therefore, for points \( A \) and \( B \):
   \[
   FA = AX \quad \text{and} \quad FB = BY
   \]
   where \( X \) and \( Y \) are the orthogonal projections of \( A \) and \( B \) on the directrix \( l \).

4. **Calculate the distances \( FA \) and \( FB \):**
   The distance from \( A \) to the focus \( F \) is:
   \[
   FA = \sqrt{(x_1 - p/2)^2 + y_1^2}
   \]
   Since \( y_1^2 = 2px_1 \), we have:
   \[
   FA = \sqrt{(x_1 - p/2)^2 + 2px_1}
   \]
   Similarly, for point \( B \):
   \[
   FB = \sqrt{(x_2 - p/2)^2 + y_2^2} = \sqrt{(x_2 - p/2)^2 + 2px_2}
   \]

5. **Calculate the midpoint \( M \) and its projection \( N \):**
   The midpoint \( M \) of \( AB \) is:
   \[
   M = \left( \frac{x_1 + x_2}{2}, \frac{y_1 + y_2}{2} \right)
   \]
   The projection \( N \) of \( M \) onto the directrix \( l \) is:
   \[
   N = \left( -\frac{p}{2}, \frac{y_1 + y_2}{2} \right)
   \]

6. **Calculate the length \( MN \):**
   The distance \( MN \) is the horizontal distance between \( M \) and \( N \):
   \[
   MN = \left| \frac{x_1 + x_2}{2} + \frac{p}{2} \right|
   \]

7. **Calculate the length \( AB \):**
   The distance \( AB \) is:
   \[
   AB = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}
   \]

8. **Use the given angle \( \angle AFB = \frac{\pi}{3} \):**
   Given \( \angle AFB = \frac{\pi}{3} \), we use the cosine rule in \( \triangle AFB \):
   \[
   AB^2 = FA^2 + FB^2 - 2 \cdot FA \cdot FB \cdot \cos \frac{\pi}{3}
   \]
   Since \( \cos \frac{\pi}{3} = \frac{1}{2} \), we have:
   \[
   AB^2 = FA^2 + FB^2 - FA \cdot FB
   \]

9. **Calculate the ratio \( \frac{MN}{AB} \):**
   Using the median formula for the right trapezoid \( AXYB \):
   \[
   MN = \frac{1}{2}(AX + BY) = \frac{1}{2}(FA + FB)
   \]
   Therefore:
   \[
   \left( \frac{MN}{AB} \right)^2 = \frac{\left( \frac{1}{2}(FA + FB) \right)^2}{FA^2 + FB^2 - FA \cdot FB}
   \]
   Simplifying:
   \[
   \left( \frac{MN}{AB} \right)^2 = \frac{FA^2 + FB^2 + 2 \cdot FA \cdot FB}{4(FA^2 + FB^2 - FA \cdot FB)}
   \]

10. **Apply the RMS-GM inequality:**
    By the RMS-GM inequality, we have:
    \[
    FA^2 + FB^2 \ge 2 \cdot FA \cdot FB
    \]
    Therefore:
    \[
    FA^2 + FB^2 + 2 \cdot FA \cdot FB \le 4(FA^2 + FB^2 - FA \cdot FB)
    \]
    Hence:
    \[
    \frac{MN}{AB} \le 1
    \]
    Equality holds when \( FA = FB \), i.e., \( \triangle FAB \) is equilateral.

The final answer is \( \boxed{1} \)