7. As shown in Figure 3, quadrilateral $ABCD$ is a right trapezoid $\left(\angle B=\angle C=90^{\circ}\right)$, and $AB=BC$. If there exists a point $M$ on side $BC$ such that $\triangle AMD$ is an equilateral triangle, then the value of $\frac{CD}{AB}$ is $\qquad$
7. $\sqrt{3}-1$.

Let $A B=B C=a, A M=M D=D A=x, C D=y$. Then
$$
\left\{\begin{array}{l}
\sqrt{x^{2}-a^{2}}+\sqrt{x^{2}-y^{2}}=a, \\
(a-y)^{2}+a^{2}=x^{2} .
\end{array}\right.
$$

From equation (2), we know $x^{2}-a^{2}=(a-y)^{2}$, then
$$
x^{2}-y^{2}=2 a^{2}-2 a y.
$$

From Figure 3, it is clear that $x>y>0$.
Thus, $2 a^{2}-2 a y>0, a>y>0$. Substituting into equation (1), we get
$$
\begin{array}{l}
a-y+\sqrt{2 a^{2}-2 a y}=a \Leftrightarrow \sqrt{2 a^{2}-2 a y}=y \\
\Leftrightarrow y^{2}+2 a y-2 a^{2}=0 .
\end{array}
$$

Taking the positive root, $y=(\sqrt{3}-1) a$, i.e., $\frac{C D}{A B}=\sqrt{3}-1$.