osm
Model Context Protocol server for OpenStreetMap data
claude mcp add --transport stdio wiseman-osm-mcp uv 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 \ --env PGDB="PostgreSQL database name (default: osm)" \ --env PGHOST="PostgreSQL host (default: localhost)" \ --env PGPORT="PostgreSQL port (default: 5432)" \ --env PGUSER="PostgreSQL username (default: postgres)" \ --env FLASK_HOST="Host for the Flask web server (default: 127.0.0.1)" \ --env FLASK_PORT="Port for the Flask web server (default: 8889)" \ --env PGPASSWORD="PostgreSQL password (default: postgres)"
How to use
This MCP server integrates OpenStreetMap data with MCP by exposing an API to query and visualize OSM data stored in a PostgreSQL/PostGIS database. It includes a web-based map viewer (Leaflet with OpenStreetMap tiles) and a set of MCP tools for map interaction. Clients can request the current map view, set views, place markers or shapes, and run raw SQL queries against the OSM data via the provided tools. The server communicates with clients over Server-Sent Events (SSE) for real-time updates and provides a PostgreSQL interface for OSM data access.
How to install
Prerequisites:
- Python environment (uv usage shown here relies on the uv wrapper; ensure Python and uv are properly installed)
- PostgreSQL with PostGIS enabled and a database containing OSM data
- Node is not required for this setup (this MCP runs via uv)
- Ensure you have the project checked out at /Users/wiseman/src/mcp-osm and an environment file at the project root if you plan to use --env-file
Installation steps:
- Install dependencies (via uv setup as described in the README):
# Install uv if not installed and navigate to project directory
# This command uses the configuration from the README
# It assumes Python and uv are available in your environment
- Prepare environment variables (optional; defaults are provided in the README):
export FLASK_HOST=127.0.0.1
export FLASK_PORT=8889
export PGHOST=localhost
export PGPORT=5432
export PGDB=osm
export PGUSER=postgres
export PGPASSWORD=postgres
- Run the MCP server with the provided command (from the README example):
uv 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
- Open your browser to the web interface served by the MCP server (default: http://localhost:8889) and begin interacting with the map and MCP tools.
Additional notes
Tips and common considerations:
- Ensure PostgreSQL is running and the osm database/schema is populated with the OSM data you need.
- The web UI uses Leaflet and SSE for real-time updates; a stable network connection improves responsiveness.
- If the web UI does not load, check that FLASK_PORT and FLASK_HOST are correctly exposed and that firewalls allow access.
- The environment variables listed can be overridden by an .env file; use --env-file to supply them at startup.
- Tools available include get_map_view, set_map_view, set_map_title, add_map_marker, add_map_line, add_map_polygon, and query_osm_postgres for SQL queries against the OSM database.
- If you need to query custom PostGIS data, use query_osm_postgres to run SQL against the osm schema.
Related MCP Servers
mcp-vegalite
MCP server from isaacwasserman/mcp-vegalite-server
github-chat
A Model Context Protocol (MCP) for analyzing and querying GitHub repositories using the GitHub Chat API.
nautex
MCP server for guiding Coding Agents via end-to-end requirements to implementation plan pipeline
pagerduty
PagerDuty's official local MCP (Model Context Protocol) server which provides tools to interact with your PagerDuty account directly from your MCP-enabled client.
futu-stock
mcp server for futuniuniu stock
mcp -boilerplate
Boilerplate using one of the 'better' ways to build MCP Servers. Written using FastMCP