MCP-Geo logo

MCP-Geo

by webcoderz

MCP-Geo is a geocoding MCP server leveraging the GeoPY library. It provides tools for Large Language Models (LLMs) to geocode addresses, reverse geocode coordinates, and calculate distances.

View on GitHub

Last updated: N/A

What is MCP-Geo?

MCP-Geo is an MCP (Model Context Protocol) server that provides geocoding functionalities to Large Language Models (LLMs). It uses the GeoPY library to convert addresses to geographic coordinates (latitude and longitude) and vice versa, as well as calculate distances between locations.

How to use MCP-Geo?

To use MCP-Geo, first install it either for Claude Desktop using fastmcp install geo.py --name "MCP Geo" or elsewhere by configuring the settings file with the provided JSON configuration. Then, the LLM can call the provided geocoding tools, such as geocode_location, reverse_geocode, and distance_between_addresses, by sending appropriate requests to the server. Ensure the necessary environment variables are set for the chosen geocoding provider (Nominatim, ArcGIS, or Bing).

Key features of MCP-Geo

  • Geocoding addresses to latitude and longitude

  • Reverse geocoding latitude and longitude to addresses

  • Calculating distances between addresses or coordinates

  • Support for multiple geocoding providers (Nominatim, ArcGIS, Bing)

  • Rate limiting to prevent excessive requests

  • Error handling to gracefully manage geocoding failures

Use cases of MCP-Geo

  • Finding the latitude and longitude of a user-provided address.

  • Determining the nearest address to a given point on a map.

  • Calculating the distance between two locations for travel planning.

  • Enriching LLM responses with location-based information.

FAQ from MCP-Geo

What geocoding providers are supported?

The server supports Nominatim, ArcGIS, and Bing. You can select the provider using the GEOCODER_PROVIDER environment variable.

How do I set up the server for a specific geocoding provider?

Set the GEOCODER_PROVIDER environment variable to the desired provider (e.g., nominatim, arcgis, or bing). For ArcGIS and Bing, you may also need to set additional environment variables such as ARC_USERNAME, ARC_PASSWORD, and BING_API_KEY.

What is rate limiting and why is it used?

Rate limiting is a mechanism to prevent excessive requests to the geocoding service, which can lead to usage limit violations. The server implements a delay between geocoding calls to avoid this.

What happens if a geocoding request fails?

The server catches geopy exceptions (e.g., timeouts, service errors) and returns a safe None result instead of crashing. This ensures that the LLM receives a consistent response even if the geocoding request fails.

How can I contribute to the development of this server?

You can extend or modify the server by checking geo.py for implementation details, adjusting environment variables to switch providers, and referring to geopy's official documentation for advanced usage.