Fire in da houseTop Tip:Paying $100+ per month for Perplexity, MidJourney, Runway, ChatGPT and other tools is crazy - get all your AI tools in one site starting at $15 per month with Galaxy AI Fire in da houseCheck it out free

osm-mcp

MCP.Pizza Chef: wiseman

osm-mcp is a Model Context Protocol server that integrates OpenStreetMap data, enabling real-time querying and visualization through an MCP interface. It features a web-based map viewer using Leaflet, supports server-to-client communication via Server-Sent Events, and provides tools for map control such as adding markers and polygons. It also offers a PostgreSQL/PostGIS query interface for advanced spatial data operations, making it ideal for developers needing interactive map data access within MCP workflows.

Use This MCP server To

Query OpenStreetMap data via MCP for geospatial analysis Visualize map data interactively using a web-based Leaflet viewer Add and manage map markers and polygons through MCP tools Set and retrieve map views dynamically in real-time Perform spatial queries using PostgreSQL/PostGIS on OSM data Stream map updates to clients using Server-Sent Events Integrate OSM data into AI workflows for location-based reasoning Enable real-time map interaction within AI-assisted applications

README

MCP-OSM: OpenStreetMap Integration for MCP

This package provides OpenStreetMap integration for MCP, allowing users to query and visualize map data through an MCP interface.

MCP-OSM Screenshot

Features

  • Web-based map viewer using Leaflet and OpenStreetMap
  • Server-to-client communication via Server-Sent Events (SSE)
  • MCP tools for map control (adding markers, polygons, setting view, getting view)
  • PostgreSQL/PostGIS query interface for OpenStreetMap data

Installation

This is my claude_desktop_config.json:

{
  "mcpServers": {
    "OSM PostgreSQL Server": {
      "command": "/Users/wiseman/.local/bin/uv",
      "args": [
        "run",
        "--env-file",
        ".env",
        "--with",
        "mcp[cli]",
        "--with",
        "psycopg2",
        "--with-editable",
        "/Users/wiseman/src/mcp-osm",
        "--directory",
        "/Users/wiseman/src/mcp-osm",
        "mcp",
        "run",
        "mcp.py"
      ]
    }
  }
}

When the MCP server starts it also starts a web server at http://localhost:8889/ that has the map interface.

Environment Variables

The following environment variables can be used to configure the MCP:

  • FLASK_HOST - Host for the Flask server (default: 127.0.0.1)
  • FLASK_PORT - Port for the Flask server (default: 8889)
  • PGHOST - PostgreSQL host (default: localhost)
  • PGPORT - PostgreSQL port (default: 5432)
  • PGDB - PostgreSQL database name (default: osm)
  • PGUSER - PostgreSQL username (default: postgres)
  • PGPASSWORD - PostgreSQL password (default: postgres)

MCP Tools

The following MCP tools are available:

  • get_map_view - Get the current map view
  • set_map_view - Set the map view to specific coordinates or bounds
  • set_map_title - Set the title displayed at the bottom right of the map
  • add_map_marker - Add a marker at specific coordinates
  • add_map_line - Add a line defined by a set of coordinates
  • add_map_polygon - Add a polygon defined by a set of coordinates
  • query_osm_postgres - Execute a SQL query against the OpenStreetMap database

osm-mcp FAQ

How do I install osm-mcp?
Install osm-mcp by running the provided command with environment setup, including dependencies like psycopg2 and MCP CLI, as shown in the example configuration.
What map viewer does osm-mcp use?
osm-mcp uses Leaflet, a popular open-source JavaScript library, for web-based interactive map visualization.
How does osm-mcp communicate with MCP clients?
It uses Server-Sent Events (SSE) for efficient server-to-client real-time communication.
Can I perform spatial queries on OpenStreetMap data?
Yes, osm-mcp provides a PostgreSQL/PostGIS interface to run advanced spatial queries on OSM data.
Is osm-mcp suitable for real-time map updates?
Yes, osm-mcp supports real-time updates and interactions through SSE and MCP tools for map control.
What MCP tools are included with osm-mcp?
Tools include adding markers, polygons, setting map views, and retrieving current map views for interactive control.
Can osm-mcp be integrated with different LLM providers?
Yes, osm-mcp is provider-agnostic and can be integrated with models like OpenAI, Claude, and Gemini via MCP.
Does osm-mcp support custom map data beyond OpenStreetMap?
Primarily designed for OpenStreetMap data, but can be extended with PostgreSQL/PostGIS for custom spatial datasets.