OpenStreetMap
Provides OpenStreetMap integration for MCP, allowing users to query and visualize map data with tools for adding markers, polygons, and controlling the map view.
What is OpenStreetMap?
OpenStreetMap is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to provides openstreetmap integration for mcp, allowing users to query and visualize map data with tools for adding markers, polygons, and controlling the map view.
Provides OpenStreetMap integration for MCP, allowing users to query and visualize map data with tools for adding markers, polygons, and controlling the map view.
This server falls under the Databases category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- Provides OpenStreetMap integration for MCP, allowing users t
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx osm-postgresql-serverConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use OpenStreetMap
The OSM PostgreSQL MCP Server bridges OpenStreetMap geodata stored in a local PostGIS database with any MCP-compatible AI client. It exposes seven tools for setting map views, adding markers, drawing lines and polygons, and running raw SQL queries against the OSM dataset — all rendered live in a Leaflet-based web interface at localhost:8889. Developers and GIS analysts use it to let Claude or other AI assistants reason about geographic data, build custom map visualisations, and perform spatial queries without writing boilerplate PostGIS code.
Prerequisites
- Python 3.10+ and the uv package manager installed
- PostgreSQL with the PostGIS extension loaded and an OpenStreetMap dataset imported (e.g. via osm2pgsql)
- The mcp-osm repository cloned locally
- An MCP-compatible client such as Claude Desktop or Claude Code
Import OSM data into PostGIS
Download a regional OSM PBF extract from Geofabrik, then import it into your PostgreSQL/PostGIS database using osm2pgsql. Ensure the database user has SELECT privileges on all imported tables.
osm2pgsql -d osm_db -U postgres your-region.osm.pbfClone the repository and create an env file
Clone the mcp-osm repository, then create a .env file in its root with your PostgreSQL connection details and optional Flask host/port overrides.
git clone https://github.com/wiseman/osm-mcp.git
cd osm-mcp
cp .env.example .env # then edit with your valuesConfigure environment variables
Edit the .env file to point at your PostGIS database. No external API keys are required — all data is local.
PGHOST=localhost
PGPORT=5432
PGDB=osm_db
PGUSER=postgres
PGPASSWORD=yourpassword
FLASK_HOST=127.0.0.1
FLASK_PORT=8889Run the MCP server
Start the server with uv, passing the env file and the required dependencies. The Leaflet map interface will be available at http://localhost:8889/.
uv run --env-file .env --with mcp[cli] --with psycopg2 --with-editable . mcp run mcp.pyAdd the server to your MCP client config
Register the server in your Claude Desktop or Claude Code configuration file so the client can discover it.
OpenStreetMap Examples
Client configuration
Claude Desktop configuration that launches the OSM MCP server via uv. Adjust the path to match your local clone.
{
"mcpServers": {
"osm-postgresql-server": {
"command": "uv",
"args": [
"run",
"--env-file", "/path/to/osm-mcp/.env",
"--with", "mcp[cli]",
"--with", "psycopg2",
"--with-editable", "/path/to/osm-mcp",
"mcp", "run", "/path/to/osm-mcp/mcp.py"
]
}
}
}Prompts to try
Example natural-language prompts that exercise the server's seven tools.
- "Set the map view to London, UK and add a marker at the coordinates of the British Museum"
- "Query the OSM database for all pubs within 500 metres of Oxford Circus and add them as markers"
- "Draw a polygon around the boundary of Central Park in New York City"
- "Show me all bike lanes in Berlin by querying the OSM ways table and rendering them as lines on the map"Troubleshooting OpenStreetMap
Server fails to start with a psycopg2 connection error
Verify your PGHOST, PGPORT, PGDB, PGUSER, and PGPASSWORD values in .env are correct. Run 'psql -h $PGHOST -U $PGUSER -d $PGDB' to confirm connectivity before starting the server.
Map tiles do not load in the Leaflet interface
The Leaflet map requires internet access to load OpenStreetMap tile layers. Check your network connection and ensure the browser can reach https://tile.openstreetmap.org.
query_osm_postgres returns no results
Confirm that osm2pgsql finished successfully and that the planet_osm_point, planet_osm_line, and planet_osm_polygon tables exist in the target database. Run '\dt' inside psql to list tables.
Frequently Asked Questions about OpenStreetMap
What is OpenStreetMap?
OpenStreetMap is a Model Context Protocol (MCP) server that provides openstreetmap integration for mcp, allowing users to query and visualize map data with tools for adding markers, polygons, and controlling the map view. It connects AI assistants to external tools and data sources through a standardized interface.
How do I install OpenStreetMap?
Follow the installation instructions on the OpenStreetMap GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with OpenStreetMap?
OpenStreetMap works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is OpenStreetMap free to use?
Yes, OpenStreetMap is open source and available under the MIT license. You can use it freely in both personal and commercial projects.
OpenStreetMap Alternatives — Similar Databases Servers
Looking for alternatives to OpenStreetMap? Here are other popular databases servers you can use with Claude, Cursor, and VS Code.
Excelize
★ 20.6kGo language library for reading and writing Microsoft Excel™ (XLAM / XLSM / XLSX / XLTM / XLTX) spreadsheets
MCP Toolbox for Databases
★ 15.3kOpen source MCP server specializing in easy, fast, and secure tools for Databases.
DBHub
★ 2.8kA universal database gateway MCP server that enables AI assistants to connect to and query multiple databases (PostgreSQL, MySQL, MariaDB, SQL Server, SQLite) with support for schema exploration, SQL execution, and secure connections via SSH tunnels.
Tabularis
★ 2.1kA lightweight, cross-platform database client for developers. Supports MySQL, PostgreSQL and SQLite. Hackable with plugins. Built for speed, security, and aesthetics.
Postgres AI Guide
★ 1.7kMCP server and Claude plugin for Postgres skills and documentation. Helps AI coding tools generate better PostgreSQL code.
Anyquery
★ 1.7k🏎️ 🏠 ☁️ - Query more than 40 apps with one binary using SQL. It can also connect to your PostgreSQL, MySQL, or SQLite compatible database. Local-first and private by design.
Browse More Databases MCP Servers
Explore all databases servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up OpenStreetMap in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use OpenStreetMap?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.