We introduce and study strongly and weakly harmonic functions on metric measure spaces defined via the mean value property holding for all and, respectively, for some radii of balls at every point of the underlying domain. Among properties of such functions we investigate various types of Harnack estimates on balls and compact sets, weak and strong maximum principles, comparison principles, the Hölder and the Lipshitz estimates and some differentiability properties. The latter one is based on the notion of a weak upper gradient. The Dirichlet problem for functions satisfying the mean value property is studied via the dynamical programming method related to stochastic games. We employ the Perron method to construct a harmonic function with continuous boundary data. Finally, we discuss and prove the Liouville type theorems.Our results are obtained for various types of measures: continuous with respect to a metric, doubling, uniform, measures satisfying the annular decay condition. Relations between such measures are presented as well. The presentation is illustrated by examples.