Skip to main content
Glama
Location MCP

Location MCP

by pipeworx-io
README.md
# @pipeworx/location

Turns any place description into one canonical location (name, centre, bounding box, match type and the interpretation applied) and builds map links from it, including the NASA FIRMS fire map.

Part of [Pipeworx](https://pipeworx.io) — an MCP gateway connecting AI agents to 2088+ live data sources. This is an independent, unofficial integration — not affiliated with, endorsed by, or published by the upstream provider.

## Tools

- `resolve_location(description, country?, state?, near_lat?, near_lon?)` -- the canonical location for a ZIP or postal code, US city or county, street address, landmark, lake, park, region, coordinates (decimal or degrees-minutes-seconds), offset ("10 miles north of Truckee, CA") or radius ("within 25 miles of Belmont, CA"). Returns `match_type` (coordinates, address, postal_code, place, admin_area, region, landmark, offset, radius), `precision_m`, `center`, `bbox` [west, south, east, north] when the source has an extent, `candidates` and `ambiguous` for names that fit several places, `sources` with `fetched_at`, and `tried`. Nothing resolved returns `found: false`; coordinates are never guessed.
- `location_map_link(description | lat+lon [+ bbox], target?)` -- a FIRMS (`#d:24hrs;@{lon},{lat},{zoom}z`, longitude first) or OpenStreetMap link. Zoom comes from the bbox span, clamped to 3-16, so a lake is wide and a small town is close; with no bbox it falls back to a default per match type, and the result says which.

## Auth

Keyless.

## Data sources

- US Census Bureau, Geocoding Services -- US street addresses.
- US Census Bureau, TIGERweb -- ZIP Code Tabulation Areas, incorporated and census-designated places, counties, states (authoritative extents).
- Zippopotam.us -- postal codes for 60+ countries.
- OpenStreetMap, Nominatim -- landmarks, lakes, parks, regions and everything else, with bounding boxes.
- Komoot, Photon -- fallback when Nominatim has no match.

## Notes

- Logic lives in `shared/src/location-resolution/` so other packs and the router can import `resolveLocation`; this pack is the tool surface.
- Zoom formula: web-mercator fit of the bbox into a 1000 x 700 px viewport, minus 0.3 level of padding, rounded to 0.1, clamped to 3-16.
- A US street address is matched by the Census geocoder and interpolated along the street segment (`precision_m` 30). Non-US postal codes are point matches (Zippopotam holds no extents); UK full postcodes fall back to the outward code and say so.
- "Springfield" with no state is `ambiguous: true` with up to 5 candidates; pass `state`, `country` or `near_lat`/`near_lon` to settle it.
- Nominatim allows 1 request per second; the resolver spaces its calls and never repeats a query within one resolution.

## Quick Start

Add to your MCP client (Claude Desktop, Cursor, Windsurf, etc.):

```json
{
  "mcpServers": {
    "location": {
      "url": "https://gateway.pipeworx.io/location/mcp"
    }
  }
}
```

### What this endpoint actually serves

`tools/list` at `https://gateway.pipeworx.io/location/mcp` returns the tools in the table
above **plus five Pipeworx tools**: `ask_pipeworx`, `discover_tools`, `ask_pipeworx_grounded`, `company_register_search` and `company_facts`.
`ask_pipeworx` answers a question this pack does not cover by routing across the
whole catalog, without adding a second MCP server.

Add an option to the same URL:

- `https://gateway.pipeworx.io/location/mcp?meta=1` lists this pack's tools plus **up to 48 shared Pipeworx tools** (48 when this README was
generated; a connection without an account lists fewer, and its own `tools/list` is the
exact answer on any given day).
- `https://gateway.pipeworx.io/location/mcp?meta=0` lists this pack's tools alone.

Or connect to the full Pipeworx gateway to get every pack's tools listed
directly, instead of just this one's:

```json
{
  "mcpServers": {
    "pipeworx": {
      "url": "https://gateway.pipeworx.io/mcp"
    }
  }
}
```

Both URLs reach the same gateway and the same 2088+ data sources. The
only difference is which pack's tools are listed **directly**; `ask_pipeworx`
reaches all of them from either one (it is not listed on a `?meta=0` connection).

## No MCP client? Call it over HTTP

```bash
curl -X POST https://gateway.pipeworx.io/v1/tools/resolve_location \
  -H 'Content-Type: application/json' \
  -d '{"description":"10 miles north of Truckee, CA"}'
```

No account needed for the first calls. Inspect any tool: `GET https://gateway.pipeworx.io/v1/tools/resolve_location`. Find one: `POST https://gateway.pipeworx.io/v1/tools/search_packs` with `{"query":"..."}`.

## Run it from npm

`@pipeworx/mcp-location` is a local stdio bridge to the Pipeworx gateway: your MCP client
starts it with `npx`, and it forwards every call to the same
`https://gateway.pipeworx.io/location/mcp` endpoint shown above. It needs network access;
there is no offline mode.

```json
{
  "mcpServers": {
    "location": {
      "command": "npx",
      "args": ["-y", "@pipeworx/mcp-location"]
    }
  }
}
```

Without a key it calls anonymously, capped at 50 calls a day. A free account
raises that to 200 a day: get a key at https://pipeworx.io/signup and add
`"env": { "PIPEWORX_API_KEY": "<your key>" }` to the server entry.
The key is sent as a Bearer token, the same way a hosted connection sends it,
so calls are metered and billed exactly as they are there.

It lists **only** this pack's tools by default. Set `PIPEWORX_META_TOOLS=1` to
also list `ask_pipeworx` and the other gateway-wide tools.

Behind an HTTPS proxy: Node's built-in `fetch` does not read `HTTPS_PROXY` by
default. Newer Node releases honour it when `NODE_USE_ENV_PROXY=1` is set; check
your Node version's documentation.

## Using with ask_pipeworx

Instead of calling tools directly, you can ask questions in plain English —
this works on the pack endpoint above as well as on the full gateway:

```
ask_pipeworx({ question: "your question about Location data" })
```

The gateway picks the right tool and fills the arguments automatically.

## More

- [Docs and guides](https://pipeworx.io/docs)
- [pipeworx.io](https://pipeworx.io)

## License

MIT