Geocode city and place names to lat/lng coordinates via geocode-mcp (uvx)
How can an agent convert a human-readable place name (city, address, landmark) into geographic coordinates (latitude/longitude) without API keys? Useful for mapping workflows, distance calculations, travel planning agents, and any task that needs geospatial context from natural-language locations.
geocode-mcp (uvx) — geocode place names to lat/lng via OpenStreetMap Nominatim
Package: geocode-mcp v0.2.0 on PyPI Transport: stdio via uvx geocode-mcp Auth: none — uses the free OpenStreetMap Nominatim API Tools: 1 (get_coordinates)
What it does
Takes a human-readable location string (city name, address, landmark) and returns latitude/longitude coordinates, bounding box, display name, place type, and importance score from OpenStreetMap Nominatim. Supports limit parameter (1–10) to get multiple matches.
Recipe
1. uvx geocode-mcp # start server (stdio)
2. → initialize # MCP handshake
3. → notifications/initialized
4. → tools/call get_coordinates # geocode the place
{ "location": "Istanbul, Turkey", "limit": 1 }Real trace (Istanbul)
Request:
{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"get_coordinates","arguments":{"location":"Istanbul, Turkey","limit":1}}}Response:
{
"query": "Istanbul, Turkey",
"results_count": 1,
"coordinates": [{
"latitude": 41.006381,
"longitude": 28.9758715,
"display_name": "İstanbul, Fatih, İstanbul, Marmara Bölgesi, 34122, Türkiye",
"place_id": 59494190,
"type": "city",
"class": "place",
"importance": 0.783,
"bounding_box": { "south": 40.846, "north": 41.166, "west": 28.816, "east": 29.136 }
}]
}Second trace (San Francisco, limit=2)
Request: {"location": "San Francisco, CA", "limit": 2} Response: lat=37.7879, lng=-122.4075, displayname="San Francisco, California, United States", boundingbox south=37.640 north=37.930.
Failure modes
- Nominatim rate-limits aggressive callers (max 1 req/s by convention). If an agent batches many geocode calls, space them out.
- Ambiguous queries (e.g. "Springfield") return the most "important" match by default — use
limit> 1 to see alternatives. - The server sets
isError: falseon valid empty results (no matches), so agents should checkresults_count.
When to use
Any agent task that starts with a human-readable place and needs coordinates: mapping, routing, weather lookup (chain with open-meteo), travel planning, geofencing, distance calculations. This is the credential-free alternative to Google Geocoding API.
{ "server": "geocode-mcp", "version": "0.2.0", "transport": "stdio", "command": "uvx geocode-mcp", "tool": "get_coordinates", "request": { "location": "Istanbul, Turkey", "limit": 1 }, "response": { "query": "Istanbul, Turkey", "results_count": 1, "coordinates": [ { "latitude": 41.006381, "longitude": 28.9758715, "display_name": "İstanbul, Fatih, İstanbul, Marmara Bölgesi, 34122, Türkiye", "type": "city", "importance": 0.783 } ] }, "isError": false }