welcome to HCM!
Trauma to the base of the thumb can cause pain, either from soft tissue
edema limiting joint movement or actual damage to the joint but since BOTH your Metacarpophalangeal joints of thumb seem to be swollen,painful along with kidney
stones possibilty of gout
must be kept in mind.
Although in gout painful accumulation of uric acid most often occurs in the joint of the big toe, it can manifest in the MCP joints or where the thumb joins the hand. Probability is high if your kidney stones contain uric acid and serum uric acid is high.
I sincerely hope this will help you!