Skip to main content
Glama
OpenStreetMap MCP

OpenStreetMap MCP

OpenStreetMap MCP

CI npm License: MIT

A Model Context Protocol server that lets AI assistants read and edit OpenStreetMap through the OSM API v0.6, authenticating with OAuth 2.0 (authorization code + PKCE).

⚠️ Edits are public, permanent and attributed to your OSM account. Practise on the sandbox server (OSM_ENV=dev) and follow the OSM editing guidelines. Don't run bulk or automated edits without following the automated edits code of conduct.

Quick start

Reading works with no setup. Editing needs an OAuth app.

1. Register an OAuth 2 application (for editing)

On openstreetmap.org/oauth2/applications (or the sandbox) create an app:

  • Redirect URI: http://127.0.0.1:8787/callback

  • Confidential application: leave unchecked (public client using PKCE, no secret needed)

  • Permissions: read_prefs, write_api, write_notes (add others if you set OSM_SCOPES)

Copy the Client ID.

2. Add to your MCP client

{
  "mcpServers": {
    "openstreetmap": {
      "command": "npx",
      "args": ["-y", "openstreetmap-mcp"],
      "env": { "OSM_CLIENT_ID": "<your client id>" }
    }
  }
}

Claude Code: claude mcp add openstreetmap -e OSM_CLIENT_ID=<id> -- npx -y openstreetmap-mcp

3. Log in

Ask the assistant to call osm_login. It returns a URL; open it, approve, and the token is stored in ~/.config/openstreetmap-mcp/ (mode 0600). Confirm with osm_whoami.

Related MCP server: architecture-map MCP server

Configuration

Variable

Default

Purpose

OSM_CLIENT_ID

–

OAuth 2 client ID (needed for osm_login)

OSM_CLIENT_SECRET

–

Only for confidential apps

OSM_ACCESS_TOKEN

–

Use a pre-made token instead of the login flow

OSM_ENV

production

dev targets master.apis.dev.openstreetmap.org

OSM_SCOPES

read_prefs write_api write_notes

Space/comma separated OAuth scopes

OSM_REDIRECT_PORT

8787

Loopback port; must match the registered redirect URI

OSM_API_BASE / OSM_WEB_BASE

per env

Override hosts

OSM_USER_AGENT

openstreetmap-mcp/…

Sent on every request (OSM requires one)

OSM_CONFIG_DIR

~/.config/openstreetmap-mcp

Token storage

Tools

Auth: osm_login, osm_logout, osm_whoami

Read (no login needed): osm_capabilities, osm_get_element, osm_get_elements, osm_get_element_full, osm_element_history, osm_element_parents, osm_get_bbox, osm_get_changeset, osm_get_changeset_diff, osm_search_changesets, osm_get_user

Edit (login required): osm_create_changeset, osm_update_changeset_tags, osm_close_changeset, osm_comment_changeset, osm_create_element, osm_update_element, osm_delete_element, osm_upload_diff

Map notes: read — osm_get_notes_in_bbox, osm_search_notes, osm_get_note; write — osm_create_note, osm_comment_note, osm_close_note, osm_reopen_note

Typical edit flow

osm_login → osm_create_changeset → osm_get_element (current version) → osm_update_element (full replace, so send all tags) → osm_close_changeset. For many related changes use osm_upload_diff, which applies creates/modifies/deletes atomically and lets new elements reference each other via negative ids.

Development

npm install
npm run typecheck && npm test
npm run dev        # stdio server from source

See AGENTS.md for architecture and workflow, and CONTRIBUTING.md. Work is tracked in GitHub issues.

License

MIT. OpenStreetMap data is © OpenStreetMap contributors, ODbL.

Available Tools

29 tools
osm_capabilitiesA
Read-only

Get API capabilities and limits of the connected OSM server (max bbox area, changeset size, timeouts).

Inputs: no named parameters.

osm_close_changesetA

Close a changeset you own. Changesets also close automatically after an hour of inactivity.

Inputs: id (required).

osm_close_noteA

Close a map note (optionally with a closing comment). Requires auth with the write_notes scope.

Inputs: id (required), text.

osm_comment_changesetB

Post a comment on a changeset's discussion (any changeset, not only yours).

Inputs: id (required), text (required).

osm_comment_noteA

Add a comment to an open map note. Requires auth with the write_notes scope.

Inputs: id (required), text (required).

osm_create_changesetA

Open a new changeset. All edits must belong to an open changeset; give it a meaningful comment. Returns the changeset id. Edits are public and attributed to the authenticated OSM user. Follow the OSM editing guidelines; use OSM_ENV=dev to practise on the sandbox server.

Inputs: comment (required), source, extra_tags.

osm_create_elementA

Create one node, way, or relation inside an open changeset. Returns the new id (version is 1). Referenced nodes/members must already exist; for many related creations use osm_upload_diff. Edits are public and attributed to the authenticated OSM user. Follow the OSM editing guidelines; use OSM_ENV=dev to practise on the sandbox server.

Inputs: element (required), changeset_id (required).

osm_create_noteB

Create a map note at a location. Requires auth with the write_notes scope. Public and visible to everyone.

Inputs: lat (required), lon (required), text (required).

osm_delete_elementA
Destructive

Delete an element. Fails with 412 if it is still referenced by a way or relation. Nodes need their current lat/lon. Returns the new version. Edits are public and attributed to the authenticated OSM user. Follow the OSM editing guidelines; use OSM_ENV=dev to practise on the sandbox server.

Inputs: element (required), changeset_id (required).

osm_element_historyB
Read-only

List all versions of an element, oldest first. Useful to see who changed what.

Inputs: id (required), type (required).

osm_element_parentsB
Read-only

Find what uses an element: relations containing any element, or ways containing a node.

Inputs: id (required), type (required), parent.

osm_get_bboxA
Read-only

Download all data in a bounding box. The API limits the area (see osm_capabilities, default 0.25 square degrees) and node count; keep boxes small.

Inputs: max_lat (required), max_lon (required), min_lat (required), min_lon (required).

osm_get_changesetB
Read-only

Read a changeset's metadata, optionally with its discussion comments.

Inputs: id (required), include_discussion.

osm_get_changeset_diffA
Read-only

Get the osmChange (XML) describing everything a changeset created, modified, or deleted.

Inputs: id (required).

osm_get_elementA
Read-only

Read a single node, way, or relation (current version, or a specific version).

Inputs: id (required), type (required), version.

osm_get_element_fullA
Read-only

Read a way or relation together with all the elements it references (nodes of a way; members of a relation).

Inputs: id (required), type (required).

osm_get_elementsA
Read-only

Read several elements of one type in a single call (current versions).

Inputs: ids (required), type (required).

osm_get_noteA
Read-only

Read one map note with its full comment thread.

Inputs: id (required).

osm_get_notes_in_bboxC
Read-only

List map notes (user-reported map problems) in a bounding box. Max bbox area is limited by the server.

Inputs: max_lat (required), max_lon (required), min_lat (required), min_lon (required), +2 more.

osm_get_userB
Read-only

Get public profile details of a user by numeric id.

Inputs: id (required).

osm_loginA

Start OAuth 2.0 login (authorization code + PKCE). Returns a URL the user must open in a browser and approve; the token is then captured automatically by a temporary local listener (5 minute window). Afterwards call osm_whoami to confirm. Needed before any editing or note-writing tool.

Inputs: no named parameters.

osm_logoutA

Revoke the stored OAuth token and delete it from disk.

Inputs: no named parameters.

osm_reopen_noteA

Reopen a closed map note (optionally with a comment). Requires auth with the write_notes scope.

Inputs: id (required), text.

osm_search_changesetsA
Read-only

Search changesets. All filters are optional and combined with AND. Returns newest first, max 100.

Inputs: bbox, open, time, user, +5 more.

osm_search_notesC
Read-only

Full-text search of map notes and their comments.

Inputs: q (required), sort, limit, order, +1 more.

osm_update_changeset_tagsA

Replace all tags on an open changeset you own (include existing ones you want to keep).

Inputs: id (required), tags (required).

osm_update_elementA

Replace an element's tags and geometry. This is a full replace, not a patch: first read the element with osm_get_element, change what you need, and send back everything including unchanged tags. Returns the new version. Edits are public and attributed to the authenticated OSM user. Follow the OSM editing guidelines; use OSM_ENV=dev to practise on the sandbox server.

Inputs: element (required), changeset_id (required).

osm_upload_diffA
Destructive

Apply many creates/modifies/deletes atomically in one request (osmChange). Use negative ids for new elements and reference them from ways/relations in the same diff; the result maps placeholder ids to real ones. Order: creates, then modifies, then deletes. Edits are public and attributed to the authenticated OSM user. Follow the OSM editing guidelines; use OSM_ENV=dev to practise on the sandbox server.

Inputs: changeset_id (required), create, delete, modify.

osm_whoamiA
Read-only

Show the server being used and the authenticated user (if any), including permissions.

Inputs: no named parameters.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 29 tools

    Disambiguation4/5

    Most tools target clearly distinct resources or lifecycle stages: element reads/writes, changeset operations, notes, auth, and capabilities. The main ambiguity is among the element-read family (osm_get_element, osm_get_elements, osm_get_element_full, osm_element_history, osm_element_parents), but their descriptions make the boundaries reasonably clear.

    Naming Consistency4/5

    The tool set mostly follows a predictable osm_verb_noun pattern such as osm_get_element, osm_create_changeset, and osm_close_note. Minor deviations exist, notably osm_element_history and osm_element_parents missing a get_ prefix and a few noun/command-style names like osm_whoami and osm_capabilities.

    Tool Count3/5

    At 29 tools this is a heavy surface, exceeding the typical well-scoped range. The OSM domain is broad enough to justify many operations, but some closely related read tools could potentially be consolidated to reduce selection burden.

    Completeness5/5

    The server covers element CRUD, batch osmChange uploads, history, parent lookup, bounding-box reads, changeset lifecycle/search/diff/comments, note lifecycle/search, authentication, and capabilities. This is a very complete surface for interacting with the OpenStreetMap API.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      A
      maintenance
      Enables AI assistants to search, validate, and edit OpenStreetMap data through natural language commands and built-in safety protections. It supports discovery of nearby amenities, geographic data exploration, and secure map editing via OAuth authentication.
      45
      5
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      A read-only MCP server for OpenStreetMap offering geocoding, routing, route optimization, isochrones, and POI search—requiring no API key and built for AI travel planning.
      11
      428 npm
      6
      MIT