osm-mcp-integrator
A module for querying and visualizing OpenStreetMap content within the MCP framework, backed by a PostgreSQL/PostGIS database. It supports interactive map controls such as placing geographical markers, defining areas (polygons), and adjusting the visible map extent via the web interface.
Author

wiseman
Quick Info
Actions
Tags
MCP-OSM: Geographic Data Visualization & Query Utility
This package integrates OpenStreetMap capabilities directly into the MCP environment, providing tools for data retrieval and graphical representation on a web-based map.
Core Functionality
- Web-based geospatial viewer powered by Leaflet and OSM tiles.
- Real-time communication channel using Server-Sent Events (SSE) between the backend and the client.
- A suite of MCP commands for map manipulation (e.g., marking locations, drawing boundaries, controlling viewport state).
- Direct execution of SQL against the underlying OpenStreetMap data stored in PostgreSQL/PostGIS.
Setup Instructions
To initiate the service, configure your MCP server startup using a configuration file like this example (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"
]
}
}
}
Upon successful launch of the MCP service, a complementary web application serving the interactive map will be accessible, typically located at http://localhost:8889/.
Configuration Variables
Environment settings that control the behavior of the integrated service:
FLASK_HOST: The network interface address for the Flask web service (Default: 127.0.0.1).FLASK_PORT: The communication port for the Flask web service (Default: 8889).PGHOST: Hostname or IP address for the PostgreSQL database instance (Default: localhost).PGPORT: Port number for the PostgreSQL connection (Default: 5432).PGDB: The specific database schema name containing OSM data (Default: osm).PGUSER: Credentials for database authentication (Default: postgres).PGPASSWORD: Secret key for database access (Default: postgres).
Available MCP Operations
The following remote procedure calls are exposed for controlling the map and database:
get_map_view: Retrieves the current geographic extent displayed on the map.set_map_view: Modifies the map's center point or bounding box.set_map_title: Updates the text label shown in the map's lower-right corner.add_map_marker: Places a distinct point graphic at specified latitude/longitude.add_map_line: Renders a sequence of connected points (a path).add_map_polygon: Draws a closed, filled or outlined shape based on input coordinates.query_osm_postgres: Executes arbitrary Structured Query Language statements directly against the OSM data repository.
