Growing urbanisation is a threat to both mental health and biodiversity. Street trees are an important biodiversity component of urban greenspace, but little is known about their effects on mental health. Here, we analysed the association of street tree density and species richness with antidepressant prescribing for 9751 inhabitants of Leipzig, Germany. We examined spatial scale effects of street trees at different distances around participant’s homes, using Euclidean buffers of 100, 300, 500, and 1000 m. Employing generalised additive models, we found a lower rate of antidepressant prescriptions for people living within 100 m of higher density of street trees—although this relationship was marginally significant ( p = 0.057) when confounding factors were considered. Density of street trees at further spatial distances, and species richness of street trees at any distance, were not associated with antidepressant prescriptions. However, for individuals with low socio-economic status, high density of street trees at 100 m around the home significantly reduced the probability of being prescribed antidepressants. The study suggests that unintentional daily contact to nature through street trees close to the home may reduce the risk of depression, especially for individuals in deprived groups. This has important implications for urban planning and nature-based health interventions in cities.