OSM Overpass MCP Server
by gander-mcp
README.md
# @gander-mcp/osm-overpass-mcp
An [MCP](https://modelcontextprotocol.io) server that exposes the OpenStreetMap
[Overpass API](https://wiki.openstreetmap.org/wiki/Overpass_API) as a single
tool, so an LLM client can run Overpass QL queries and get back the raw response
or a GeoJSON `FeatureCollection`.
Requires Node.js >= 26.
The same package is also published as `osm-overpass-mcp`, so
`npx osm-overpass-mcp` works too.
## Tool
### `overpass_query`
| Argument | Type | Default | Description |
| --- | --- | --- | --- |
| `query` | string (required) | — | The full Overpass QL query text, e.g. `node[amenity=pharmacy](50.0,19.9,50.1,20.0);out;` |
| `format` | `"raw"` \| `"geojson"` | `"raw"` | `raw` returns the Overpass response verbatim; `geojson` converts it to a GeoJSON `FeatureCollection` |
An empty query is rejected without a network call. On Overpass rate limiting
(HTTP 429/406) the server honours `Retry-After` (or waits 30s) and retries up to
`OVERPASS_MAX_RETRIES` times before returning a structured error. Query syntax
errors (HTTP 400) are returned immediately, not retried.
## Running
```sh
# stdio (default) — for clients that launch the server as a subprocess
npx @gander-mcp/osm-overpass-mcp
npx @gander-mcp/osm-overpass-mcp --transport stdio
# Streamable HTTP — binds to loopback only by default
npx @gander-mcp/osm-overpass-mcp --transport http
```
An unknown `--transport` value exits non-zero and prints the valid choices.
### stdio client config
```jsonc
{
"mcpServers": {
"overpass": {
"command": "npx",
"args": ["-y", "@gander-mcp/osm-overpass-mcp"]
}
}
}
```
## Configuration
All configuration is via environment variables; each has a default.
| Variable | Default | Description |
| --- | --- | --- |
| `OVERPASS_ENDPOINT` | `https://overpass-api.de/api/interpreter` | Overpass API endpoint to query. Point this at a mirror or your own instance if the public one is rate-limiting you. |
| `OVERPASS_USER_AGENT` | `osm-overpass-mcp/<version> (+https://github.com/gander-mcp/osm-overpass-mcp)` | `User-Agent` sent on every request. |
| `OVERPASS_TIMEOUT_MS` | `30000` | Per-request timeout in milliseconds. Must be a positive integer. |
| `OVERPASS_MAX_RETRIES` | `3` | Retries after the first attempt on rate limit / timeout. Must be a non-negative integer. |
| `OVERPASS_MCP_HOST` | `127.0.0.1` | HTTP transport bind address. Namespaced to avoid the common `HOST` env var. |
| `OVERPASS_MCP_PORT` | `3000` | HTTP transport port. |
The HTTP path is always `/mcp`.
### Remote HTTP use
The HTTP transport binds to `127.0.0.1` by default and has no authentication.
To expose it beyond localhost, set `OVERPASS_MCP_HOST` explicitly and put it
behind your own TLS-terminating reverse proxy and access control.
## Development
```sh
npm install # also installs the lefthook git hooks (prepare script)
npm run dev # run from source with --watch
npm test # unit + integration tests (mocked Overpass endpoint)
npm run check # typecheck + lint + test
npm run fix # apply Biome autofixes + formatting
npm run build # compile to dist/ with tsc
npm run test:smoke # live smoke test against the real Overpass API (network)
```
`npm test` never hits the network. The live smoke test is excluded from it and
also runs daily (and on demand) via the non-blocking `Live Smoke` workflow.
`lefthook` runs Biome + typecheck on `pre-commit` and the test suite on
`pre-push`, mirroring the `Code` workflow so CI failures surface locally first.
### Repository variables (Settings → Secrets and variables → Actions)
| Variable | Default | What it does |
|---|---|---|
| `ENFORCE_AUDIT` | `1` | `npm audit` in `code.yml` blocks the run by default; set to `0` to report advisories without failing (e.g. while triaging an upstream CVE with no fix yet) |
## Releasing
1. `Release` workflow (manual, pick `patch`/`minor`/`major`): release-it bumps
the version, updates `CHANGELOG.md`, tags `vX.Y.Z`, creates the GitHub
Release and then starts `Publish NPM` for that tag.
2. `Publish NPM` workflow: stages the package on npm with provenance (Trusted
Publishing, no token) under both names, `@gander-mcp/osm-overpass-mcp` and
`osm-overpass-mcp`. Each becomes installable once a maintainer approves it
with 2FA: `npm stage list`, `npm stage approve <stage-id>`.
### First publication (manual, once)
Staged publishing also creates new packages. Until approval, npm shows a public
`0.0.0-stage` placeholder under the name. Requires 2FA on the npm account.
```sh
npm login
npm ci
npm run build
npm stage publish --provenance=false --access public
npm pkg set name=osm-overpass-mcp
npm stage publish --provenance=false --access public
git checkout package.json
npm stage list
npm stage approve <stage-id> # once for each package
VERSION=$(node -p "require('./package.json').version")
git tag "v$VERSION" && git push origin "v$VERSION"
```
Then on npmjs.com, in the settings of both packages, add a Trusted Publisher: GitHub
Actions, repository `gander-mcp/osm-overpass-mcp`, workflow `publish-npm.yml`,
with staged publishing allowed. Provenance requires a public repository.
## Writing Overpass queries
See [`docs/overpass-references.md`](docs/overpass-references.md) for Overpass QL
syntax, guides, and testing tools.
## License
[AGPL-3.0-only](LICENSE)
TDQS
A3.8/5.0
Scored across 1 tool
Disambiguation5/5
With a single tool there is no possibility of misselection; every request maps unambiguously to overpass_query.
Naming Consistency5/5
The lone tool uses a clear snake_case verb_noun name (overpass_query) that matches the server's domain, so there is no convention mixing.
Tool Count4/5
A single parameterized tool is defensible because Overpass QL is a general-purpose query language covering the whole API, though the thin surface means agents get no higher-level helpers.
Completeness4/5
The general query tool plus optional geojson output covers essentially the entire Overpass API, leaving only niceties like query validation, presets, or result pagination absent.
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues