About the microscopic form of magnetocrystalline anisotropy

Currently people write magnetocrystalline anisotropy as $H_{an}=-K s_x^2$ from its classical counterpart: $H_{an}=-K ( \sin \theta)^2$ where $K$ is the anisotropy constant, but for spin 1/2, $s_x^2$ is just the identity matrix, which shows no anisotropy, so how to write the correct form of microscopic Hamiltonian?

I also heard that magnetocrystalline anisotropy comes from spin-orbit interaction, is there some paper depict there relations? like deriving the Heisenberg Hamiltonian $S_i \cdot {S_j}$ from Coulomb interaction by Dirac?

Your observation is correct that the $s_x^2$ term could not matter in a spin-1/2 quantum model, but we shouldn't be writing such a term for that model anyway. We must determine the exchange terms from symmetry considerations or from a microscopic derivation as in the reference I've given.
1. For $S=\frac{1}{2}$, the expectation value for the "single-ion" magnetocrystalline anisotropy is indeed zero, and it should be! That is, if we consider a lattice of sites labelled by $i$, then $(\sigma_i^x)^2=\mathbb{I}$, the identity matrix, and there is indeed no anisotropy as you say. There is a general result that applies here called Kramer's theorem, which says that, so long as time reversal symmetry remains unbroken (i.e. no magnetic field), then the $S=+\frac{1}{2}$ and $-\frac{1}{2}$ have to be the same energy. So where does the anisotropy come from? Two places: (a) The spin at a given atomic site may be more than $S=\frac{1}{2}$, in which case the spin operators take a different form, and don't square to the identity. (b) The anisotropy may originate from interactions between different atomic sites, so the Hamiltonian reads $\sum_{i,j} \sigma_i^x \sigma_j^x$, which works just fine.