Closest point on circle edge from point outside/inside the circle
$$ \vec C = \vec A + r\frac{(\vec B - \vec A)}{||\vec B - \vec A||} $$ Where $r$ is the radius of the circle. Works for points both inside and outside the circle. Imagine $(\vec B - \vec A)$ to be a vector in the direction of $\vec B$ and $\frac{(\vec B - \vec A)}{||\vec B - \vec A||}$ thus is the same vector but with a length of $1$. By multiplying it with $r$, you "walk in that direction" a total distance of $r$, thus reaching the circle.
With coordinats $\vec A = (A_x, A_y)$ etc. this reads $$ C_x = A_x + r\frac{B_x-A_x}{\sqrt{(B_x-A_x)^2+(B_y-A_y)^2}} $$ $$ C_y = A_y + r\frac{B_y-A_y}{\sqrt{(B_x-A_x)^2+(B_y-A_y)^2}} $$