Introduction: The migration of people from rural environments to cities has accelerated urbanization. This has modified the landscape as well as the ecological processes and communities in these areas. The Costa Rican endemic Cabanis´s Ground-Sparrow (Melozone cabanisi) is a species of limited distribution restricted to the Gran Area Metropolitana, which is the biggest urban settlement of the country. This area has experimented and still experiment an ongoing fragmentation and loss of habitat of the areas used by this species (i.e., coffee plantations, shrubs, and thickets). Objective: Determine the effects of urbanization on habitat abundance and spatial pattern for the occurrence of the Cabanis´s Ground-Sparrow. Methods: We modeled the area of potentially suitable habitat for the Cabanis´s Ground-Sparrow in Costa Rica using occurrence and bioclimatic data. Then, we estimated the actual suitable habitat using the potentially suitable habitat and land cover type layers. Finally, we analyzed the connectivity among the actual suitable habitat patches using single-patch and multi-patch approaches. Results: From the area of potentially suitable habitat estimated by the bioclimatic model, 74  % were urban areas that are unsuitable for Cabanis´s Ground-Sparrow. The largest suitable patches within urban areas were coffee plantations; which also were crucial for maintaining connectivity between habitat patches along the species’ range. Conclusions: To preserve and protect the endemic Cabanis´s Ground-Sparrow these areas must be taken into consideration by decision-makers in the present and future management plans. We recommend avoiding change shrubs and thickets to urban cover to preserve the occurrence of the endemic Cabanis´s Ground-Sparrow, and implement a program for the payment of environmental services to landholders, supported by the local governments, to protect those habitats in urban contexts.  Finally, this is a tool that will help to detect which habitats within heavily urbanized areas are the most important to ensure different species conservation.

Keywords: Coffee plantations, Habitat loss, Habitat connectivity, Keyplayer, Landscape ecology, Maxent, Melozone cabaninisi