Skip to main content
Glama
open-data-portals

open-data-portals

by pipeworx-io
README.md
# @pipeworx/open-data-portals

Detect, search and query any public CKAN, Socrata, DKAN, Opendatasoft or ArcGIS Hub open-data portal from its domain alone: the long tail of portals that have no dedicated pack.

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

## Tools

- `portal_detect(domain)` — which platform the domain runs, the evidence, and every probe URL with its HTTP status. A domain that is none of the five returns `not_a_portal`.
- `portal_search_datasets(domain, query, limit, offset)` — catalog search; each hit carries an id for the next two tools plus resource or download links.
- `portal_dataset(domain, id)` — description, license, columns (where the platform exposes them) and each resource or distribution with its download URL and whether `portal_query` can read it.
- `portal_query(domain, id, columns, where, filters, order_by, limit, offset)` — rows through the platform's own query language. `filters` is plain equality on every platform; `where` is the platform's native syntax. A resource with no query API returns `queryable:false` and its download URL (web-fetch `query_table` can read a CSV download). Zero rows is an error, not a success.

Every response names the platform and the exact upstream URL called.

## Auth

Keyless. Public portals only; no cookies, no login, https only.

## Data sources

- The portal's own publisher, through the platform's public API. The response names the portal domain and platform on every call.

Notes for the next person:
- Per-domain budget: 150 upstream requests per domain per hour across callers (shared when the gateway supplies its cache store, per isolate otherwise). Over it the tool answers `budget_exhausted` with a retry time.
- Redirects to a different site are not followed and are reported as evidence. Some portals answer a maintenance redirect to a status page for hours; `portal_detect` then says `not_a_portal` with that redirect target as the reason.
- Socrata's catalog search is global unless scoped to the domain; the tool always scopes it. Non-tabular Socrata assets (maps, measures) have no row API and return their download URL.
- Opendatasoft's records API pages to offset+limit of 10,000 only.
- ArcGIS Hub ids are `itemid_layerindex`; a bare item id resolves to layer 0.

## Quick Start

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

```json
{
  "mcpServers": {
    "open-data-portals": {
      "url": "https://gateway.pipeworx.io/open-data-portals/mcp"
    }
  }
}
```

### What this endpoint actually serves

`tools/list` at `https://gateway.pipeworx.io/open-data-portals/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/open-data-portals/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/open-data-portals/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 2075+ 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/portal_detect \
  -H 'Content-Type: application/json' \
  -d '{"domain":"data.texas.gov"}'
```

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

## Run it from npm

`@pipeworx/mcp-open-data-portals` 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/open-data-portals/mcp` endpoint shown above. It needs network access;
there is no offline mode.

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

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 Open Data Portals 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