This is an expansion of my comment above: You can view the modular curve of level $K$ over $\mathbb{C}$ as the double coset space
$$GL_2(\mathbb{Q})\backslash\mathbb{H}^{\pm}\times GL_2(\mathbb{A}_f)/K.$$
Here, $\mathbb{H}^{\pm}$ is the union of the half planes. This set is in bijection with isogeny classes of elliptic curves over $\mathbb{C}$ with $K$-level structure, and the bijection is obtained as follows: A point $\tau\in\mathbb{H}^{\pm}$ gives us an isomorphism of vector spaces $\mathbb{R}^2\xrightarrow{\simeq}\mathbb{C}$, which in turn equips $\mathbb{Q}^2$ with a Hodge structure of weights $(0,-1),(-1,0)$. This allows us to interpret it as the $\mathbb{Q}$-homology of an elliptic curve $E_{\tau}$ (This is just a fancier way of saying that $E_{\tau}=\mathbb{C}/(\mathbb{Z}+\mathbb{Z}\tau)$). So, given a point $[(\tau,g)]$ in the double coset space, we attach to it the elliptic curve (up to isogeny) $E_{\tau}$, with the $K$-level structure given by the $K$-orbit of the isomorphism
$$\mathbb{A}_f^2\xrightarrow{g}\mathbb{A}_f^2= H_1(E_{\tau},\mathbb{A}_f).$$
Let $\alpha$ be some generator of $F$ over $\mathbb{Q}$: it allows us to identify $F$ with $\mathbb{Q}^2$. Choose an embedding $F$ in $\mathbb{C}$, so that $\alpha$ can be viewed as an element of $\mathbb{H}$. Let $H$ be the rank $2$ torus over $\mathbb{Q}$ attached to $F$: we can view it as the sub-group of $GL_2$ that commutes with the action of $F$. We then get a map
$$\eta:H(\mathbb{Q})\backslash H(\mathbb{A}_f)\rightarrow GL_2(\mathbb{Q})\backslash\mathbb{H}^{\pm}\times GL_2(\mathbb{A}_f)/K$$
$$\;\;\;\;[h]\mapsto [(\alpha,h)].$$
The image of this map consists exactly of those elliptic curves admitting CM by $F$, whose level structures admit an $F$-equivariant representative. (One subtlety is that, if $E$ is an elliptic curve in the image, then you can also look at the curve $\overline{E}$, where you twist the action of $F$ by complex conjugation. This won't show up in the image of $\eta$).
Now, we have the global reciprocity isomorphism
$$Gal(\overline{F}/F)^{ab}\xrightarrow{\simeq}H(\mathbb{Q}\backslash H(\mathbb{A}_f),$$
which equips $H(\mathbb{Q})\backslash H(\mathbb{A}_f)$ with the structure of a pro-finite $Gal(\overline{F}/F)$-set. The main theorem of CM for elliptic curves says that, if we identify the right hand side of $\eta$ with the set of $\overline{\mathbb{Q}}$-points of the modular curve, then $\eta$ is in fact Galois-equivariant.
There is a slight sign issue here, since there are two possible choices for the reciprocity map (arithmetic or geometric Frobenius), but this is the general shape.

