Skip to main content
Glama
mcp-geopolitical-risk

mcp-geopolitical-risk

by pipeworx-io
README.md
# @pipeworx/geopolitical-risk

The Geopolitical Risk (GPR) Index of Dario Caldara and Matteo Iacoviello: monthly values (headline, threats, acts, and about 44 country series) and a daily series with event tags.

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

## Tools

- `gpr_monthly(series?, from?, to?, historical?)` — one dated value per month. `series` is `gpr` (default), `threats`, `acts`, or a 3-letter country code (`CHN`, `JPN`, `USA`, `RUS`, `UKR`, `ISR`, `TWN`, `KOR`, and others). The recent series starts in 1985 (headline index is normalised so 100 is its 1985-2019 average; country series are on a much smaller scale of their own). `historical=true` switches to the long-history series back to 1900. Default window is the latest 12 months.
- `gpr_daily(from?, to?, limit?)` — daily headline index with acts and threats sub-indices, 7-day and 30-day moving averages and the publisher's event tag for the day, from 1985 to within days of today. Default window is the last 30 days, at most 1,000 rows.

Every response carries `data_as_of` (the date the authors last updated the file; for the monthly tool `latest_period` is the last month with a value) and the citation the authors ask users to give.

## Auth

Keyless.

## Data sources

- Dario Caldara and Matteo Iacoviello, Geopolitical Risk Index, monthly and daily series. Called live per request and kept for 30 minutes in the isolate; nothing is bundled in this repo. No reuse terms are stated by the publisher; cite: Caldara, Dario and Matteo Iacoviello (2022), "Measuring Geopolitical Risk," American Economic Review, 112(4), pp. 1194-1225.

The publisher ships legacy Excel workbooks (a 2.7 MB monthly file and a 3.3 MB daily file). `src/xls.ts` is a small dependency-free reader for that format (copied from the china-stocks pack's reader), so the Worker needs no spreadsheet library. A format change makes the pack fail loudly rather than return partial rows. The first call after a cold start downloads and parses a workbook (about half a second measured from a laptop); later calls in the same isolate are served from memory.

Verified 2026-11-18: headline GPR averages 100.0 over 1985-2019; the long-history headline series (`historical=true`) averages 81.7 over the same months, so it is not on the same scale.

## Quick Start

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

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

### What this endpoint actually serves

`tools/list` at `https://gateway.pipeworx.io/geopolitical-risk/mcp` returns the tools in the table
above **plus the shared Pipeworx meta-tools** — `ask_pipeworx`,
`discover_tools`, `search_within`, `remember`/`recall` and the rest of the
gateway-wide set. So the tool count you see is larger than this table: a
single-pack endpoint currently lists roughly 30 shared tools alongside the
pack's own. The connection's `initialize` response states its exact scope, and
is the authoritative answer for a given day.

This is deliberate, not multiplexing by accident. The meta-tools are what let a
scoped connection answer a question this pack does not cover — via
`ask_pipeworx`, which routes across the whole catalog — without you adding a
second MCP server. There is currently no way to mount a pack endpoint without
them; if the extra schemas cost you more context than the routing is worth,
connect to the full gateway once rather than to several pack endpoints.

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 2018+ data sources. The
only difference is which pack's tools are listed **directly**; `ask_pipeworx`
reaches all of them from either one.

## No MCP client? Call it over HTTP

```bash
curl -X POST https://gateway.pipeworx.io/v1/tools/gpr_monthly \
  -H 'Content-Type: application/json' \
  -d '{"series":"CHN","from":"2025-01","to":"2026-10"}'
```

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

## Run it from npm

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

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

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 Geopolitical Risk 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