Skip to content

160-tool MCP server for real-time global intelligence from free public APIs: markets, liquidity, prediction markets, SEC filings, conflict, military, aircraft-cohort early warning, migration and border flows, cyber, climate, news and more. Dated observation history, 29 research prompts, cited briefs, geofences, SSE dashboard. MIT, no paid API keys.

Docs: current surface, research layer, settings and status

Phoenix Agent (mac-studio)fdebf9a8de6e
diff --git a/CLAUDE.md b/CLAUDE.md
index cb70558..65f74f2 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -43,7 +43,7 @@ collector.py (daemon) ──┘
```
**Infrastructure layer** (`fetcher.py`, `cache.py`, `circuit_breaker.py`):
-- `Fetcher`: Centralized async HTTP client (httpx). All external calls go through `get_json()`, `get_text()`, or `get_xml()`. Handles retries (2 max), per-source rate limiting, and stale-data fallback (never returns blank if old data exists).
+- `Fetcher`: Centralized async HTTP client (httpx). All external calls go through `get_json()`, `get_text()`, `get_xml()` or `get_bytes()` (binary bodies, streamed under a size cap, never cached). Handles retries (2 max), per-source rate limiting, and stale-data fallback (never returns blank if old data exists). Failure logs and returned error strings pass through `redact()`, which masks credential query parameters and the values of `*_KEY` / `*_TOKEN` / `*_SECRET` / `*_PASSWORD` environment variables.
- `CircuitBreaker`: Per-source tracking. 3 consecutive failures trips the breaker for 5 minutes. Each RSS feed gets its own breaker (`rss:bbc_world`).
- `Cache`: SQLite WAL-mode TTL cache. `get()` returns live data, `get_stale()` returns expired data for fallback.
@@ -59,6 +59,10 @@ collector.py (daemon) ──┘
**Collector** (`collector.py`): Standalone daemon for 24/7 vector store population. 61 sources organized by domain, with `--daemon`, `--interval`, `--sources` CLI args. Dynamic import via `_import_fetch_fn()`. Per-source timeout overrides in `SOURCE_TIMEOUTS` (the `aoi_digest` sweep gets 240 s; everything else the flat 45 s). Entry point: `intel-collector`.
+**Observation history** (`history.py`, `history_extractors.py`, `history_backfill.py`, `history_timeline.py`): every collector capture is written to the same SQLite database as the cache: a run log per source (status, reason, stale replays), deduplicated payload bodies, and observations with three dates (`observed_at` the period described, `published_at` the release when known, `collected_at` when saved). Feeds `intel_collection_health`, `intel_series_history`, `intel_capture_history`, `intel_revisions`, `intel_lagged_connections`, `intel_day_timeline` and `intel_history_backfill` (FRED and ECB). Retention and caps are set by the `WORLD_INTEL_HISTORY_*` variables (README). Nothing exists before the collector's first recorded cycle except backfilled series.
+
+**Research guide** (`guide.py`, `guide_prompts.py`): the MCP prompts (29 worked research questions) and resources (`intel://guide`, generated from the live registry; `intel://guide/measures`; `intel://guide/source-health`).
+
**Reports** (`reports.py`): PDF/HTML intelligence report generator. Collects 18 domains in parallel, renders styled HTML, converts to PDF via WeasyPrint. Optional dependency: `pip install -e ".[pdf]"`.
**Dashboard** (`dashboard/`): Self-contained Starlette app with a single `index.html` template (no frontend build step). SSE endpoint streams all domains in parallel via `asyncio.gather()`, refreshes every 30 seconds. Loads `.env` from project root on startup. `/api/aois` feeds the AOI geofence layer from the shared AOI store: it opens a fresh `AOIStore` per request (`_open_aoi_store`) because SQLite connections are thread-bound and the handler may run on a different thread than a cached store's creator; it reads stored sweep snapshots and never gathers live. Endpoint tests use Starlette's `TestClient` without the context manager so lifespan (default-path `Cache`) never runs.
@@ -85,7 +89,11 @@ collector.py (daemon) ──┘
## Environment Variables
Only these unlock additional data sources (everything else works unauthenticated):
-- `ACLED_ACCESS_TOKEN` — conflict events
+- `ACLED_EMAIL` / `ACLED_PASSWORD`: conflict events, unrest and risk scores
+- `UCDP_ACCESS_TOKEN`: UCDP organized violence events (the API refuses requests without it)
+- `TOMTOM_API_KEY`: traffic flow and incidents
+- `WINDY_API_KEY`: webcams
+- `OPENSKY_USERNAME` / `OPENSKY_PASSWORD`: OpenSky account for the aviation tools
- `NASA_FIRMS_API_KEY` — satellite wildfire data
- `EIA_API_KEY` — energy prices
- `CLOUDFLARE_API_TOKEN` — internet outage data
diff --git a/README.md b/README.md
index 4e36d8d..94f344f 100644
--- a/README.md
+++ b/README.md
@@ -10,6 +10,8 @@ Real-time global intelligence across **30+ domains** with **160 MCP tools**, a l
Built for AI agents that need world awareness: market conditions, geopolitical risk, military posture, aircraft-cohort early warning, refugee and migration flows, supply chain disruptions, cyber threats, and more — all queryable via the Model Context Protocol. The vector store enables natural language queries like *"military activity near Taiwan"* or *"cyber threats targeting healthcare"* across all historical data.
+For research, the collector keeps a dated history of what it captures. Each observation carries the period it describes, the publisher's release date when known, and when it was saved, so earlier copies, revised values, lagged correlations between series and any past day can be queried, and collection health is measured from the collector's run log rather than inferred from cache freshness. The server also exposes **29 MCP prompts** (worked research questions, each naming the tools it needs and the limit to respect) and **3 MCP resources**: a research guide generated from the live tool registry (`intel://guide`), a measures glossary (`intel://guide/measures`) and live source health (`intel://guide/source-health`).
+
---
## What You Get
@@ -828,6 +830,16 @@ The vector store uses FastEmbed (ONNX-based, BAAI/bge-small-en-v1.5) for embeddi
| `OLLAMA_API_URL` | No | Ollama server for AI-generated briefs (default: `http://localhost:11434`) |
| `OLLAMA_MODEL` | No | Ollama model for AI-generated briefs (default: `llama3.2`) |
| `WORLD_INTEL_LOG_LEVEL` | No | Logging level (default: INFO) |
+| `WORLD_INTEL_CACHE_DB` | No | Cache and history database path (default: `$XDG_CACHE_HOME/world-intel-mcp/cache.db`, else `~/.cache/world-intel-mcp/cache.db`) |
+| `WORLD_INTEL_DASHBOARD_HOST` | No | Dashboard bind interface (default: `127.0.0.1`) |
+| `WORLD_INTEL_HEATMAP_CACHE_MB` | No | On-disk cap for adsb.lol heatmaps used by the aircraft-cohort tools (default: 1024) |
+| `WORLD_INTEL_HISTORY_CADENCE_S` | No | Expected seconds between collector attempts, for collection health (default: 300) |
+| `WORLD_INTEL_HISTORY_CADENCES` | No | Per-source cadence overrides, e.g. `aoi_digest=900,news_feed=600` |
+| `WORLD_INTEL_HISTORY_PAYLOAD_DAYS` | No | Days stored payload bodies are kept (default: 7; 0 keeps them forever) |
+| `WORLD_INTEL_HISTORY_CAPTURE_DAYS` | No | Days run-log captures are kept (default: 30; 0 keeps them forever) |
+| `WORLD_INTEL_HISTORY_DAYS` | No | Days observations are kept (default: 365; 0 keeps them forever) |
+| `WORLD_INTEL_HISTORY_MAX_BODY_BYTES` | No | Largest payload body stored, in bytes of JSON (default: 4194304; 0 = no cap) |
+| `WORLD_INTEL_HISTORY_REPLAY_MAX_BYTES` | No | Largest payload returned by a capture replay (default: 262144; 0 = no cap) |
| `WORLD_INTEL_AOI_WEBHOOK` | No | URL POSTed when an AOI sweep finds changes (collector daemon); quiet sweeps don't fire |
| `WORLD_INTEL_AOI_WEBHOOK_FORMAT` | No | `json` (default: title/totals/markdown payload) or `text` (raw markdown body + `Title` header, ntfy-style) |
diff --git a/ROADMAP.md b/ROADMAP.md
index 92a1b37..08aa0aa 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -1,7 +1,7 @@
# World Intel MCP — Feature Parity Roadmap
**Benchmark**: [koala73/worldmonitor](https://github.com/koala73/worldmonitor)
-**Updated**: 2026-10-17 (Unreleased: Phase 29 research-grade history and evidence, in progress, and US and UK border-crossing flows; 0.11.0: aircraft-cohort early warning, cross-border migration)
+**Updated**: 2026-10-18 (Unreleased, merged to main 2026-10-18: Phase 29 research-grade history and evidence, and US and UK border-crossing flows; 0.11.0: aircraft-cohort early warning, cross-border migration)
**Current tools**: 160 (159 intel + 1 status)
---
@@ -578,7 +578,7 @@ past its cap reads as a failed refresh that names the Location or the cap.
The roadmap above is history; this section is the actual road ahead.
Ordered by value; numbers are proposals, not commitments.
-### Phase 29 (in progress, 2026-10-17): Research-Grade History and Evidence
+### Phase 29 (merged to main 2026-10-18, unreleased): Research-Grade History and Evidence
Clean-room design: ideas only, no third-party code or text is used. The
pattern this phase adopts is that every answer is built from saved records
with three separate dates: the period a value describes, when its publisher
@@ -599,7 +599,7 @@ dashboard.
| 1 | Story breadth | News clusters carry a distinct-outlet count; a top-stories view ranks by how many outlets carry a story | :white_check_mark: Built 2026-10-17, unreleased: clusters gain `outlets` / `outlet_count` (sister feeds of one publisher count once); `intel_top_stories` ranks by outlet count with an attention list (countries and organizations by mention growth). Found on the way: cluster `sources` was empty in every live cluster (key mismatch, `feed_name` vs `source_name`) and RSS times were shifted by the host UTC offset; both fixed. Concurrent RSS reads now share one request per feed (a live collector news-group cycle: 119 requests for 119 feeds). Review fixes 2026-10-17: clustering runs off the event loop; attention is empty with `attention_change_measured: false` when no feed spans both windows, never "nothing grew" |
| 1 | Liquidity and flows | Fed balance sheet, Treasury General Account, reverse repo and net liquidity (FRED keyless CSV), money supply (US M2, euro area M1/M2/M3, never summed), ECB, ICI fund flows and ETF net issuance, FINRA margin statistics, BLS series; amounts kept separate from flows | :yellow_circle: Built, unreleased: 5 tools (`intel_liquidity_board`, `intel_net_liquidity`, `intel_money_supply`, `intel_fed_liquidity_series`, `intel_ecb_series`), 5 CLI commands, 2 collector sources. FRED graph CSV and ECB Data Portal live-verified 2026-10-17. The TGA term is WDTGAL (Wednesday level, USD millions): WTREGEN is a week average; the net liquidity `method` block states each term's units, conversion and how RRPONTSYD (daily, USD billions) is aligned to the Wednesday. Blocked, measured 2026-10-17, and listed in the board's `blocked` field; no proxy is substituted, so fund flows and ETF net issuance have no source: ICI (money market fund assets at /research/stats/mmf, ETF net issuance at /research/stats/etf) answers 403 Akamai "Access Denied" on every path, robots.txt included; FINRA margin statistics XLSX answers 200, but the finra.org Terms of Use (Restrictions d and e) forbid building a database from the site and data mining, scraping or harvesting tools, robots included, and the page says data feeds are not available; BLS public API v1 answers 200 without a key (CPI-U, payrolls), but api.bls.gov robots.txt is `Disallow: /` and the terms page on www.bls.gov answers 403 to this server's User-Agent, so it is not used |
| 1 | Kalshi + cross-venue markets | Kalshi public market data next to Polymarket; same-event comparison with an explicit match confidence; settled markets scored against pre-settlement prices (Brier) | :white_check_mark: Unreleased: `intel_kalshi_markets`, `intel_prediction_compare`, `intel_prediction_settled` (`sources/kalshi.py`, `sources/prediction_cross.py`, `analysis/prediction_matching.py`), CLI and 2 collector sources. Kalshi endpoints measured 2026-10-17, all HTTP 200 without an account: `/events` (nested markets), `/series` (`include_volume`), `/markets?status=settled`, `/markets/candlesticks` (batch, capped at 10,000 candles per call), `/historical/cutoff`. The `/events` `category` parameter is ignored by the API, so categories resolve through `/series?category=`, whose filter is loose too (7 of the 869 series it returned for Economics were other categories), so series are matched exactly; an unknown category answers `{"series": null}` and is reported as a gap, not an outage. The exchange-wide settled listing is intraday sports (1,000 rows covered about 40 minutes; none open 24h), so settled samples default to the Economics category's top series. Polymarket Gamma caps a page at 100 rows. Matching is deliberately conservative: live 2026-10-17 it matched the Fed 25 bps hike/cut pairs for October and December and rejected 25 vs 50+ bps, 2026 vs 2027, and the Fed-hold pair ("no change" vs "Hike 0bps": a known false negative). Team and person aliases are not resolved, so most sports pairs stay unmatched. Kalshi requests are spaced 0.2 s apart in-process: the two collector sources scanning the same series at once drew HTTP 429, and at 0.1 s a 26-request category scan still drew one (none at 0.2 s in one live run). Settled samples are the most recently settled markets and cluster in time (one football match supplied 11 of 25 Polymarket markets in a live run), so a Brier score describes its sample, not a venue's skill. Every number a caller passes has a range stated in the input schema (at most 25 Kalshi series or pages per scan), so one call cannot fan out into unbounded upstream requests. Review round (2026-10-17): expired-cache serves are marked on every Kalshi read and on Polymarket's settled listing and histories, and a stale history is not scored; matching adds rate-action and direction gates, keeps signs and ordinals, reads a $ amount as an amount, and its candidate blocking is complete against a brute-force scan in tests; compare carries each side's price basis, spread and Kalshi last-trade time (public `/markets/trades`, HTTP 200 without an account, measured 2026-10-17) and ranks flagged pairs after comparable ones; Polymarket is scored against the earlier of endDate and closedTime (on 20 closed markets measured 2026-10-17, closedTime came 2.7 to 5.5 h after endDate for football and 164 h before it for one early resolution, and umaEndDate equalled closedTime in all 20, so no outcome-known time is published); Kalshi pacing applies only on a cache miss. The shared `polymarket` circuit breaker (three failed history calls pause all Polymarket reads for 300 s) is documented, not changed. Re-review round (2026-10-17): matching also rejects different days of the same month, disjoint months, different clock times, quantity unit or kind mismatches, reordered quantities, opposite wording and a name on one venue only (adversarial set: 42 of 46 cases right, the 4 misses are same-event pairs rejected); a side priced from an expired copy is flagged and not comparable; Kalshi last-trade lookups read the trade price, skip expired listings, stop after 10 lookups or 10 s and name each null time; matching runs in a worker thread (2,127 Kalshi x 2,000 Polymarket in 3.4 s on mac-studio, scratch benchmark) |
-| 1 | News vs market reaction | Companies and countries named in story clusters mapped to tickers / country indices; same-day move against a benchmark | :yellow_circle: Built 2026-10-17, unreleased; 7 test expectations await correction at merge: `intel_news_market_reaction` and `intel news-reaction`. Company rows: stock, benchmark (SPY, or the exchange country's index) and excess return on the story's session; country rows: index return with a trailing z-score. Session rule in the exchange's timezone (after close = next session; weekends and holidays read from the listing's own bars); a last bar Yahoo has not finalized is pending. Open: `^TASI` and `^TA125` (Saudi and Israel in the country-index table) return 404 on Yahoo, so those benchmarks are data gaps |
+| 1 | News vs market reaction | Companies and countries named in story clusters mapped to tickers / country indices; same-day move against a benchmark | :yellow_circle: Built 2026-10-17, merged to main 2026-10-18, unreleased: `intel_news_market_reaction` and `intel news-reaction`. Company rows: stock, benchmark (SPY, or the exchange country's index) and excess return on the story's session; country rows: index return with a trailing z-score. Session rule in the exchange's timezone (after close = next session; weekends and holidays read from the listing's own bars); a last bar Yahoo has not finalized is pending. Open: `^TASI` and `^TA125` (Saudi and Israel in the country-index table) return 404 on Yahoo, so those benchmarks are data gaps |
| 2 | Connections with timing offsets | Correlation between retained series over a shared sample, tested at leads and lags, with minimum sample size and false-discovery control; states that it does not prove causation | :white_check_mark: Built 2026-10-17, unreleased: `intel_lagged_connections` and `intel history connections`. Pearson r on a UTC day, week or month grid at every lag from -max_lag to +max_lag (default 5, cap 30, at most 1,000 tests a call), period-over-period changes by default, p from Student's t (regularized incomplete beta, standard library), Benjamini-Hochberg adjustment across the call (default 0.05) with significance decided on the AR(1)-adjusted `q_ar1` (independent random walks in levels: 91 of 100 seeds flagged by the unadjusted q, none by `q_ar1`), "no evidence" below an effective sample of 3, a 30-point minimum with every untested pair and lag listed with its n, latest vintage, rows without `observed_at` refused with the reason, every clamp reported in the MCP response and the CLI, and a `cannot_prove` list. p-values match scipy to 3.3e-13 relative error. Verified 2026-10-17 over a live MCP stdio session and the CLI on four real FRED series loaded into an isolated store. Not done: rank correlation, prewhitening |
| 2 | Day timeline | What every retained source recorded for a given day, by observation date or collection date | :white_check_mark: Built 2026-10-17, unreleased: `intel_day_timeline` and `intel history day` (`history_timeline.py`; read-only `mode=ro` connection, never fetches). by=collected: per-source run-log state (changed, unchanged, answered, degraded, failed, not_attempted, collector_did_not_run, before_run_log, never_run, unknown_past_retention; collector ran, did_not_run, unknown_past_retention or not_recorded) with attempts, status counts, reasons, extractor failures, a partial_failure flag and payload changes; by=observed: date and UTC-instant values on the day, month and year values listed apart as period values, undated observations counted and excluded. Retention is stated per record kind for the day. Measured 2026-10-17: two live collector cycles of 6 sources four minutes apart (12 captures: ok 8, degraded 2, error 2; every payload in the second cycle matched the first) read back over a live MCP stdio session and the CLI; 2026-10-16 in the same store reads collector `not_recorded` (context `before_first_capture`) with sources `before_run_log` or `never_run` (re-measured 2026-10-18T02:16Z after the review fixes, MCP stdio and CLI). On a synthetic store (475,200 captures, 1.75 million observations, 10,982 series) one call took 24 to 46 ms (measured before the review fixes, not re-measured), and no statement full-scans a history table under SQLite 3.45.3, 3.53.4 and 3.54.0. Not measured: a live store with weeks of history |
| 3 | Dashboard views | Liquidity board, situations, top stories, collection health panels | :white_check_mark: Built 2026-10-17, unreleased: four tabs behind RESEARCH (key `p`), each loaded from its own route that calls the tool's function (`/api/liquidity-board`, `/api/situations`, `/api/top-stories`, and `/api/collection-health` on the dashboard cache's history store); a failed call renders as UNAVAILABLE or REFRESH FAILED with the function's reason, never as an empty list. Checked 2026-10-17 in headless Chrome with real upstreams (9 liquidity rows; 20 situations and 9 stories over 95 of 119 feeds; collection health after one collector cycle: 38 ok, 5 degraded, 16 failing), with FRED and ECB, every RSS feed and the history store made unreachable (each tab showed the outage and its reason), and with markup injected into a headline (shown as text). Situations and top stories take 5 to 15 s per call |
@@ -697,7 +697,9 @@ suite, and a live MCP stdio session.
| Static datasets | 18 | Bases, ports, pipelines, nuclear, cables, datacenters, spaceports, minerals, exchanges, trade routes, cloud regions, financial centers |
| RSS feeds | 119 | 24 categories |
| Tests in repo | 2,801 | 2,781 non-smoke tests + 20 live smoke tests (measured 2026-10-18: `pytest -m 'not smoke'` -> 2,781 passed, 20 deselected); full suite requires `.[dev]` |
-| Statement coverage | 92% | Measured 2026-10-12 full-suite `--cov` (92.02%); 91.65% on 2026-10-11; 91.18% on 2026-09-01, 59% the morning before. CI ratchet at 89 |
-| Primary remaining gaps | `cli.py` tests, coverage gate, `server.py` refactor | See Planned Phases 23-26 |
+| Statement coverage | 96% | Measured 2026-10-18 on the merged main (`a7374b7`), `pytest -m 'not smoke' --cov`: 96.46% on fedora (Python 3.13) and ai-lab (3.12), 96.45% on fedora (3.11); 92.02% on 2026-10-12; 91.65% on 2026-10-11; 91.18% on 2026-09-01, 59% the morning before. CI ratchet at 89 |
+| MCP prompts and resources | 29 / 3 | Research guide over MCP (Phase 29): worked research prompts; guide, measures glossary and source health resources |
+| Collector sources | 61 | `collector.SOURCES`; every capture is written to the observation history |
+| Primary remaining gaps | Blocked publishers (ICI fund flows and ETF issuance, FINRA margin statistics, BLS series); Saudi and Israel benchmarks for news vs market reaction (Yahoo 404); rank correlation and prewhitening for lagged connections | See Phase 29 |
-**Bottom line (2026-10-11)**: 139 tools across 30+ domains; Phases 27-28 added aircraft-cohort early warning and cross-border migration. **Earlier (2026-09-02)**: 122 tools across 30+ domains, with the roadmap aligned to the live MCP registry and, for the first time, a forward-looking plan (Phases 23-26): geofence depth, the coverage gate, missing domains, and `server.py` modularization.
+**Bottom line (2026-10-18)**: 160 tools across 30+ domains, 29 MCP prompts and 3 resources, 61 collector sources. Phase 29 (dated observation history with revisions and backfill, collection health, lagged connections, day timeline, liquidity and money, Kalshi and cross-venue prediction markets, news signals and market reaction, the research guide over MCP and the dashboard research panels), tropical cyclone forecast tracks and US and UK border-crossing flows are merged to main, unreleased. **Earlier (2026-10-11)**: 139 tools across 30+ domains; Phases 27-28 added aircraft-cohort early warning and cross-border migration. **Earlier (2026-09-02)**: 122 tools across 30+ domains, with the roadmap aligned to the live MCP registry and, for the first time, a forward-looking plan (Phases 23-26): geofence depth, the coverage gate, missing domains, and `server.py` modularization.
diff --git a/pyproject.toml b/pyproject.toml
index a7f600d..9f0bdd6 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,7 +1,7 @@
[project]
name = "world-intel-mcp"
version = "0.11.0"
-description = "World Intelligence MCP Server: real-time global intelligence across 30+ domains with 139 MCP tools"
+description = "World Intelligence MCP Server: real-time global intelligence across 30+ domains with 160 MCP tools, 29 research prompts and a dated observation history"
readme = "README.md"
requires-python = ">=3.11"
license = {text = "MIT"}
diff --git a/src/world_intel_mcp/server.py b/src/world_intel_mcp/server.py
index 57a2e4d..35d39f3 100644
--- a/src/world_intel_mcp/server.py
+++ b/src/world_intel_mcp/server.py
@@ -62,6 +62,10 @@ Phase 26: the 2,900-line registry/dispatch monolith split into domain modules
TOOLS/HANDLERS parity guarantee) and shared infrastructure in
runtime.py. Pure move: 128 tools, byte-identical definitions,
identical dispatch semantics.
+Phases 27-29: aircraft-cohort early warning, cross-border migration, and
+ research-grade history and evidence, with MCP prompts and resources
+ (guide.py). 160 tools in 20 modules as of 2026-10-18; ROADMAP.md has
+ the per-phase detail.
"""
import asyncio