OpenStreetMap MCP server

Enhances LLM capabilities with location-based services and geospatial data from OpenStreetMap.
Back to servers
Provider
Jagan Shanmugam
Release date
Mar 29, 2025
Language
Python
Stats
53 stars

This MCP server integrates OpenStreetMap data to enhance LLMs with powerful location-based capabilities. It enables geospatial features like geocoding, route planning, POI search, and neighborhood analysis without requiring direct API access.

Installation

Using with MCP Hosts

To use the OpenStreetMap MCP server with compatible hosts like Claude Desktop, Cursor, or Windsurf, add the following configuration:

"mcpServers": {
  "osm-mcp-server": {
    "command": "uvx",
    "args": [
      "osm-mcp-server"
    ]
  }
}

Local Installation

To install and run the server locally:

  1. Install the package:
pip install -e .
  1. Start the server:
osm-mcp-server

The server will listen for MCP requests on the standard input/output.

Features and Capabilities

Available Tools

The server provides these geospatial tools:

  • geocode_address: Convert text to geographic coordinates
  • reverse_geocode: Convert coordinates to human-readable addresses
  • find_nearby_places: Discover points of interest near a location
  • get_route_directions: Get turn-by-turn directions between locations
  • search_category: Find places of specific categories in an area
  • suggest_meeting_point: Find optimal meeting spots for multiple people
  • explore_area: Get comprehensive data about a neighborhood
  • find_schools_nearby: Locate educational institutions near a location
  • analyze_commute: Compare transportation options between home and work
  • find_ev_charging_stations: Locate EV charging infrastructure with filtering
  • analyze_neighborhood: Evaluate neighborhood livability for real estate
  • find_parking_facilities: Locate parking options near a destination

Resources

The server implements these location-based resources:

  • location://place/{query}: Get information about places by name or address
  • location://map/{style}/{z}/{x}/{y}: Get styled map tiles at specified coordinates

Using the Server

Basic Client Example

You can test the server with the included example client:

python examples/client.py

This demonstrates:

  • Getting information about San Francisco
  • Searching for restaurants in the area
  • Retrieving comprehensive map data with progress tracking

LLM Integration Example

For LLM integration, try the helper class:

python examples/llm_client.py

This shows how an LLM can use the Location Assistant to:

  • Get location information from text queries
  • Find nearby points of interest
  • Get directions between locations
  • Find optimal meeting points
  • Explore neighborhoods

Creating Your Own Client

To build a custom client:

  1. Import the MCP client:
from mcp.client import Client
  1. Initialize the client with your server URL:
client = Client("http://localhost:8000")
  1. Invoke tools or access resources:
# Example: Geocode an address
results = await client.invoke_tool("geocode_address", {"address": "New York City"})

Claude Desktop Local Server Configuration

To configure Claude Desktop to use your local server:

  • On MacOS: Edit ~/Library/Application\ Support/Claude/claude_desktop_config.json
  • On Windows: Edit %APPDATA%/Claude/claude_desktop_config.json

Add the following configuration:

"mcpServers": {
  "osm-mcp-server": {
    "command": "uv",
    "args": [
      "--directory",
      "/path/to/osm-mcp-server",
      "run",
      "osm-mcp-server"
    ]
  }
}

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later