Context. The bulk density of an asteroid informs us about its interior structure and composition. To constrain the bulk density one needs an estimate for the mass of the asteroid. The mass is estimated by analyzing an asteroid's gravitational interaction with another object, such as another asteroid during a close encounter. An estimate for the mass has typically been obtained with linearized leastsquares methods despite the fact that this family of methods is not able to properly describe non-Gaussian parameter distributions. In addition, the uncertainties reported for asteroid masses in the literature are sometimes inconsistent with each other and suspected to be unrealistically low. Aims. We present a Markov-chain Monte Carlo (MCMC) algorithm for the asteroid mass estimation problem based on asteroidasteroid close encounters. We verify that our algorithm works correctly by applying it to synthetic data sets. We then use astrometry available through the Minor Planet Center to estimate masses for a select few example cases and compare our results to results reported in the literature. Methods. Our mass estimation method is based on the robust adaptive Metropolis algorithm that has been implemented into the OpenOrb asteroid orbit computation software. Our method has the built-in capability to analyze multiple perturbing asteroids and test asteroids simultaneously. Results. We find that our mass estimates for the synthetic data sets are fully consistent with the ground truth. The nominal masses for real example cases typically agree with the literature but tend to have greater uncertainties than what is reported in recent literature. Possible reasons for this include different astrometric datasets and/or weights, different test asteroids, different force models and/or different algorithms. For (16) Psyche, the target of NASA's Psyche mission, our maximum likelihood mass is approximately 55% of what is reported in the literature. Such a low mass would imply that the bulk density is significantly lower than previously expected and hence disagrees with the theory of (16) Psyche being the metallic core of a protoplanet. We do, however, note that masses reported in recent literature remain within our 3-sigma limits. Conclusions. The new MCMC mass-estimation algorithm performs as expected, but a rigorous comparison with results from a leastsquares algorithm with the exact same dataset remains to be done. The matters of uncertainties in comparison with other algorithms and correlations of observations also warrant further investigation.