OpenStreetMap

v1.0.0Databasesstable

Provides OpenStreetMap integration for MCP, allowing users to query and visualize map data with tools for adding markers, polygons, and controlling the map view.

osm-postgresql-servermcpai-integration
Share:
81
Stars
0
Downloads
0
Weekly
0/5

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

Query OpenStreetMap data with markers and polygons.
Visualize geographic information and map data.
Retrieve location and spatial data from OSM.
wiseman

Maintainer

LicenseMIT
Languagepython
Versionv1.0.0
UpdatedMay 1, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx osm-postgresql-server

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

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
1

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.pbf
2

Clone 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 values
3

Configure 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=8889
4

Run 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.py
5

Add 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.

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.

Quick Config Preview

{ "mcpServers": { "osm-postgresql-server": { "command": "npx", "args": ["-y", "osm-postgresql-server"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

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.

33,000+ ServersFree & Open SourceStep-by-Step Guides