6. $\frac{5 \sqrt{2}}{6}$.

By symmetry, without loss of generality, assume point $M$ is inside $\triangle E F G$ (including the boundary).

Unfold the square $A B F E$ and the square $E F G H$ into a plane, as shown in Figure 3. Then point $M$ lies on the perpendicular bisector of $A G$.

When $M$ is the intersection of the perpendicular bisector of $A G$ and $E G$, $l(M, G)$ is maximized.
Since $M A = M G$, we have,
$$
\begin{aligned}
& \left(2-\frac{\sqrt{2}}{2} M G\right)^{2}+\left(1-\frac{\sqrt{2}}{2} M G\right)^{2}=M G^{2} \\
\Rightarrow & M G=\frac{5 \sqrt{2}}{6} .
\end{aligned}
$$

Therefore, the maximum value of $l(M, G)$ is $\frac{5 \sqrt{2}}{6}$.
6. As shown in Figure 1, the cube $A B C D-E F G H$ has an edge length of 1, and point $M$ is on the surface $E F G H$ of the cube. Define a path as a route where every point lies on the surface of the cube. It is known that the shortest path length from point $M$ to $A$, $l(M, A)$, is equal to the shortest path length from point $M$ to $G$, $l(M, G)$. Then the maximum value of $l(M, G)$ is . $\qquad$