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.

Three domains: Meteoalarm (EU), JTWC (W Pacific), RIPEstat BGP status (+3 = 132); FAA NOTAMs honestly skipped

Phoenix Agent (Marcs-Mac-Studio)70165007c6e5
diff --git a/src/world_intel_mcp/fetcher.py b/src/world_intel_mcp/fetcher.py
index 6e22d24..c6774d3 100644
--- a/src/world_intel_mcp/fetcher.py
+++ b/src/world_intel_mcp/fetcher.py
@@ -25,6 +25,7 @@ _YAHOO_MIN_INTERVAL = 0.6 # seconds
# Per-source rate limits (min seconds between calls).
# Sources not listed here have no enforced limit.
_SOURCE_RATE_LIMITS: dict[str, float] = {
+ "ripestat": 1.0,
"yahoo-finance": 0.6, # unofficial — ~100 req/min safe
"opensky": 6.0, # free tier: 10 req/min
"coingecko": 2.0, # free tier: 30 calls/min
diff --git a/src/world_intel_mcp/sources/bgp.py b/src/world_intel_mcp/sources/bgp.py
new file mode 100644
index 0000000..b24c943
--- /dev/null
+++ b/src/world_intel_mcp/sources/bgp.py
@@ -0,0 +1,203 @@
+"""BGP routing status source for world-intel-mcp, via RIPEstat.
+
+Per-resource routing health from the RIPE NCC's RIPEstat Data API
+(stat.ripe.net). No API key required. Scope honesty: RIPEstat data
+calls are resource-parameterized — you ask about ONE prefix or ASN.
+This module is therefore a per-resource status check (visibility in
+the RIS peer mesh, announced state, observed origins, RPKI validity),
+NOT global hijack/anomaly detection; RIPEstat offers no target-free
+"current incidents" feed usable here.
+
+Shape facts, verified live 2026-09-01 against AS3333 and 193.0.0.0/21:
+routing-status accepts both ASNs and prefixes but returns different
+data keys per type (ASN: announced_space + observed_neighbours;
+prefix: origins + less/more_specifics); origins arrive as ints;
+visibility is per address family with ris_peers_seeing/total_ris_peers
+counts; rpki-validation requires BOTH an origin ASN and a prefix and
+returns status valid/invalid/unknown with the matching ROAs. For a
+prefix query the RPKI check here validates each origin actually
+observed in BGP; for an ASN query RPKI is skipped (validating every
+announced prefix would be an unbounded fan-out) and marked so.
+"""
+
+import logging
+import re
+from datetime import datetime, timezone
+
+from ..fetcher import Fetcher
+
+logger = logging.getLogger("world-intel-mcp.sources.bgp")
+
+_ROUTING_STATUS_URL = "https://stat.ripe.net/data/routing-status/data.json"
+_RPKI_VALIDATION_URL = "https://stat.ripe.net/data/rpki-validation/data.json"
+
+# Routing state moves in minutes; RIPEstat itself caches upstream.
+_CACHE_TTL = 300
+# ROAs change on hours-to-days timescales.
+_RPKI_CACHE_TTL = 900
+
+# At most this many observed origins get an RPKI check (MOAS prefixes
+# rarely have more; keeps the fan-out bounded).
+_MAX_RPKI_ORIGINS = 3
+
+_ASN_RE = re.compile(r"^(?:AS)?(\d+)$", re.IGNORECASE)
+
+
+async def fetch_bgp_status(fetcher: Fetcher, resource: str) -> dict:
+ """Fetch BGP routing status for one prefix or ASN from RIPEstat.
+
+ Args:
+ fetcher: Shared HTTP fetcher with caching and circuit breaking.
+ resource: An ASN ("AS3333" or "3333") or a CIDR prefix
+ ("193.0.0.0/21", IPv6 accepted). Bare IP addresses are not
+ accepted — pass the covering prefix.
+
+ Returns:
+ For an ASN: visibility per address family, announced space,
+ observed neighbour count, first/last seen. For a prefix:
+ visibility, observed origin ASNs with route objects,
+ less/more specific counts, and per-origin RPKI validation
+ (valid/invalid/unknown). Both carry resource, resource_type,
+ source, and timestamp.
+ """
+ now = datetime.now(timezone.utc)
+ timestamp = now.strftime("%Y-%m-%dT%H:%M:%SZ")
+ resource = resource.strip()
+
+ asn_match = _ASN_RE.match(resource)
+ is_prefix = "/" in resource
+ if not asn_match and not is_prefix:
+ return {
+ "error": (
+ f"Invalid resource: {resource!r}. Pass an ASN "
+ "('AS3333' or '3333') or a CIDR prefix ('193.0.0.0/21')."
+ ),
+ "reason": "invalid_resource",
+ "resource": resource,
+ "source": "ripestat",
+ "timestamp": timestamp,
+ }
+
+ query_resource = asn_match.group(1) if asn_match else resource
+ resource_type = "asn" if asn_match else "prefix"
+
+ data = await fetcher.get_json(
+ url=_ROUTING_STATUS_URL,
+ source="ripestat",
+ cache_key=f"bgp:routing-status:{query_resource}",
+ cache_ttl=_CACHE_TTL,
+ params={"resource": query_resource},
+ )
+
+ payload = data.get("data") if isinstance(data, dict) else None
+ if not payload:
+ logger.warning("RIPEstat routing-status returned no data for %s", resource)
+ return {
+ "error": (
+ f"RIPEstat routing-status unavailable for {resource} "
+ "(no live or cached data)"
+ ),
+ "degraded": True,
+ "reason": "ripestat_fetch_failed",
+ "resource": resource,
+ "resource_type": resource_type,
+ "source": "ripestat",
+ "timestamp": timestamp,
+ }
+
+ visibility = _extract_visibility(payload.get("visibility") or {})
+ result: dict = {
+ "resource": resource,
+ "resource_type": resource_type,
+ "visibility": visibility,
+ "visible": any(
+ (fam.get("ris_peers_seeing") or 0) > 0 for fam in visibility.values()
+ ),
+ "first_seen": payload.get("first_seen"),
+ "last_seen": payload.get("last_seen"),
+ "source": "ripestat",
+ "timestamp": timestamp,
+ }
+
+ if resource_type == "asn":
+ result["announced_space"] = payload.get("announced_space")
+ result["observed_neighbours"] = payload.get("observed_neighbours")
+ result["rpki"] = []
+ result["rpki_note"] = (
+ "RPKI validation needs a specific prefix; query a prefix "
+ "resource to validate it against its observed origins."
+ )
+ return result
+
+ origins = [
+ {
+ "origin": str(o.get("origin")),
+ "route_objects": o.get("route_objects") or [],
+ }
+ for o in payload.get("origins") or []
+ if o.get("origin") is not None
+ ]
+ result["origins"] = origins
+ result["less_specifics_count"] = len(payload.get("less_specifics") or [])
+ result["more_specifics_count"] = len(payload.get("more_specifics") or [])
+ result["rpki"] = [
+ await _validate_origin(fetcher, origin["origin"], resource)
+ for origin in origins[:_MAX_RPKI_ORIGINS]
+ ]
+ result["rpki_status"] = _summarize_rpki(result["rpki"])
+ return result
+
+
+async def _validate_origin(fetcher: Fetcher, origin: str, prefix: str) -> dict:
+ """RPKI-validate one origin/prefix pair via RIPEstat.
+
+ A validation fetch failure is reported inline (status
+ "fetch_failed") rather than degrading the whole result — the
+ routing-status half is still good data.
+ """
+ data = await fetcher.get_json(
+ url=_RPKI_VALIDATION_URL,
+ source="ripestat",
+ cache_key=f"bgp:rpki:{origin}:{prefix}",
+ cache_ttl=_RPKI_CACHE_TTL,
+ params={"resource": origin, "prefix": prefix},
+ )
+ payload = data.get("data") if isinstance(data, dict) else None
+ if not payload:
+ logger.warning(
+ "RIPEstat rpki-validation unavailable for %s / %s", origin, prefix
+ )
+ return {"origin": origin, "status": "fetch_failed", "roa_count": 0}
+ return {
+ "origin": origin,
+ "status": payload.get("status"),
+ "roa_count": len(payload.get("validating_roas") or []),
+ }
+
+
+def _extract_visibility(visibility: dict) -> dict:
+ """Reduce RIPEstat's visibility block to seeing/total per family."""
+ out: dict[str, dict] = {}
+ for family in ("v4", "v6"):
+ fam = visibility.get(family)
+ if isinstance(fam, dict):
+ out[family] = {
+ "ris_peers_seeing": fam.get("ris_peers_seeing"),
+ "total_ris_peers": fam.get("total_ris_peers"),
+ }
+ return out
+
+
+def _summarize_rpki(checks: list[dict]) -> str:
+ """Collapse per-origin RPKI checks into one summary status.
+
+ Any invalid origin makes the whole prefix "invalid" (that is the
+ hijack-shaped signal); all-valid is "valid"; anything else —
+ no ROAs, fetch failures, no observed origins — is "unknown".
+ """
+ statuses = {c.get("status") for c in checks}
+ if "invalid" in statuses:
+ return "invalid"
+ if statuses and statuses <= {"valid"}:
+ return "valid"
+ return "unknown"
diff --git a/src/world_intel_mcp/sources/jtwc.py b/src/world_intel_mcp/sources/jtwc.py
new file mode 100644
index 0000000..897028b
--- /dev/null
+++ b/src/world_intel_mcp/sources/jtwc.py
@@ -0,0 +1,191 @@
+"""JTWC tropical cyclone warning source for world-intel-mcp.
+
+Parses the Joint Typhoon Warning Center's RSS feed at metoc.navy.mil.
+No API key required. Complement to sources/cyclones.py (NHC): JTWC is
+the US DoD warning agency for the Northwest Pacific, North Indian
+Ocean, and Southern Hemisphere; its feed also carries a Central/Eastern
+Pacific item that overlaps NHC coverage.
+
+Feed facts, verified live 2026-09-01 against four active storms: RSS
+2.0 with one item per basin group (guids NWPAC-NIO-WARNINGS,
+EPAC-CPAC-WARNINGS, SH-WARNINGS) plus a TROPICAL-ADVISORIES item
+listing the significant-tropical-weather advisories (ABPW10/ABIO10).
+Storms live inside each item's CDATA HTML description as headers like
+"Tropical Depression 17W (Saudel) Warning #42" followed by
+"Issued at 01/2100Z" and product links; the HTML nests unbalanced
+<p><b> tags, so parsing is regex-over-text, not DOM. A quiet basin's
+item says "No Current Tropical Cyclone Warnings." — that is a VALID
+empty result, not an outage. Item pubDates use a two-digit year
+("Tue, 01 Sep 26 ..."); issued_at carries only day/time (DD/HHMMZ).
+
+Positions, intensities, and forecast tracks are NOT in the RSS — they
+live in the per-storm warning-text products this module links to but
+does not fetch (one fetch per storm would fan out unboundedly).
+"""
+
+import logging
+import re
+from datetime import datetime, timezone
+
+from ..fetcher import Fetcher
+
+try:
+ import feedparser
+except ImportError:
+ feedparser = None # type: ignore[assignment]
+
+logger = logging.getLogger("world-intel-mcp.sources.jtwc")
+
+_JTWC_RSS_URL = "https://www.metoc.navy.mil/jtwc/rss/jtwc.rss"
+
+# Warnings are 6-hourly; the feed itself rebuilds more often.
+_CACHE_TTL = 600
+
+_BASINS_BY_GUID: dict[str, str] = {
+ "NWPAC-NIO-WARNINGS": "northwest_pacific_north_indian",
+ "EPAC-CPAC-WARNINGS": "central_eastern_pacific",
+ "SH-WARNINGS": "southern_hemisphere",
+}
+_ADVISORIES_GUID = "TROPICAL-ADVISORIES"
+
+# "Tropical Depression 17W (Saudel) Warning #42" — note the feed's
+# double space after the classification; \s+ absorbs it.
+_STORM_RE = re.compile(
+ r"(?P<classification>(?:Super\s+)?(?:Tropical\s+(?:Depression|Storm|Cyclone)"
+ r"|Typhoon|Hurricane|Subtropical\s+(?:Depression|Storm)))"
+ r"\s+(?P<id>\d{2}[A-Z])\s+\((?P<name>[^)]+)\)\s+Warning\s+#?(?P<warning>\d+)"
+)
+_ISSUED_RE = re.compile(r"(?:Re)?issued at\s+(\d{2}/\d{4}Z)", re.IGNORECASE)
+_WARNING_TEXT_RE = re.compile(r"href=['\"]([^'\"]*web\.txt)['\"]")
+_GRAPHIC_RE = re.compile(r"href=['\"]([^'\"]*\.gif)['\"]")
+_ADVISORY_LINK_RE = re.compile(r"<a\s+href=['\"]([^'\"]+\.txt)['\"][^>]*>([^<]+)</a>")
+_QUIET_MARKER = "No Current Tropical Cyclone Warnings"
+
+
+async def fetch_jtwc_cyclones(fetcher: Fetcher) -> dict:
+ """Fetch active JTWC tropical cyclone warnings.
+
+ Args:
+ fetcher: Shared HTTP fetcher with caching and circuit breaking.
+
+ Returns:
+ Dict with storms list (id, name, classification, warning
+ number, issued_at as DD/HHMMZ, basin, product links), count,
+ by_basin counts (quiet basins present with 0), advisories list
+ (significant tropical weather advisory products), source, and
+ timestamp. Zero storms with no degraded marker means quiet
+ basins, not a failure.
+ """
+ now = datetime.now(timezone.utc)
+ timestamp = now.strftime("%Y-%m-%dT%H:%M:%SZ")
+
+ if feedparser is None:
+ return {
+ "error": "feedparser not installed — run: pip install feedparser",
+ "degraded": True,
+ "reason": "feedparser_missing",
+ "storms": [],
+ "count": 0,
+ "by_basin": {},
+ "advisories": [],
+ "source": "jtwc",
+ "timestamp": timestamp,
+ }
+
+ xml_text = await fetcher.get_xml(
+ _JTWC_RSS_URL,
+ source="jtwc",
+ cache_key="jtwc:rss:current",
+ cache_ttl=_CACHE_TTL,
+ )
+
+ if xml_text is None:
+ logger.warning("JTWC RSS feed returned no data")
+ return {
+ "error": "JTWC RSS feed unavailable (no live or cached data)",
+ "degraded": True,
+ "reason": "jtwc_fetch_failed",
+ "storms": [],
+ "count": 0,
+ "by_basin": {},
+ "advisories": [],
+ "source": "jtwc",
+ "timestamp": timestamp,
+ }
+
+ parsed = feedparser.parse(xml_text)
+
+ storms: list[dict] = []
+ by_basin: dict[str, int] = {}
+ advisories: list[dict] = []
+ for entry in parsed.get("entries", []):
+ guid = entry.get("id") or ""
+ description = entry.get("summary") or ""
+
+ if guid == _ADVISORIES_GUID:
+ advisories = [
+ {"title": " ".join(title.split()), "url": url}
+ for url, title in _ADVISORY_LINK_RE.findall(description)
+ ]
+ continue
+
+ basin = _BASINS_BY_GUID.get(guid)
+ if basin is None:
+ # Unknown item — derive a label from the category rather
+ # than dropping storms silently.
+ category = entry.get("category") or guid or "unknown"
+ basin = re.sub(r"[^a-z0-9]+", "_", category.lower()).strip("_")
+
+ basin_storms = _parse_storms(description, basin)
+ by_basin[basin] = len(basin_storms)
+ storms.extend(basin_storms)
+
+ return {
+ "storms": storms,
+ "count": len(storms),
+ "by_basin": by_basin,
+ "advisories": advisories,
+ "feed_published": parsed.get("feed", {}).get("published"),
+ "source": "jtwc",
+ "timestamp": timestamp,
+ }
+
+
+def _parse_storms(description: str, basin: str) -> list[dict]:
+ """Extract storm warnings from one basin item's HTML description.
+
+ Each storm's details (issued time, product links) are searched for
+ only in the text span between its header and the next storm's
+ header, so links can't bleed across storms.
+ """
+ matches = list(_STORM_RE.finditer(description))
+ storms = []
+ for i, match in enumerate(matches):
+ segment_end = (
+ matches[i + 1].start() if i + 1 < len(matches) else len(description)
+ )
+ segment = description[match.end() : segment_end]
+
+ issued = _ISSUED_RE.search(segment)
+ warning_text = _WARNING_TEXT_RE.search(segment)
+ graphic = _GRAPHIC_RE.search(segment)
+
+ storms.append(
+ {
+ "id": match.group("id"),
+ "name": match.group("name").strip(),
+ "classification": " ".join(match.group("classification").split()),
+ "warning_number": int(match.group("warning")),
+ "issued_at": issued.group(1) if issued else None,
+ "basin": basin,
+ "warning_text_url": warning_text.group(1) if warning_text else None,
+ "warning_graphic_url": graphic.group(1) if graphic else None,
+ }
+ )
+ if not storms and _QUIET_MARKER.lower() not in description.lower():
+ logger.info(
+ "JTWC %s item had no storm headers and no quiet marker "
+ "— format may have drifted",
+ basin,
+ )
+ return storms
diff --git a/src/world_intel_mcp/sources/meteoalarm.py b/src/world_intel_mcp/sources/meteoalarm.py
new file mode 100644
index 0000000..290ea74
--- /dev/null
+++ b/src/world_intel_mcp/sources/meteoalarm.py
@@ -0,0 +1,243 @@
+"""Meteoalarm European severe-weather warning source for world-intel-mcp.
+
+Parses the Meteoalarm legacy ATOM feeds at feeds.meteoalarm.org. No API
+key required. Coverage: Europe only — 39 participating countries (the
+EUMETNET members, including Israel), each with its own per-country feed.
+
+Feed facts, verified live 2026-09-01 against the France feed: entries
+carry CAP 1.2 extension elements (cap:event, cap:severity, cap:onset,
+cap:expires, cap:areaDesc, cap:certainty, cap:urgency, cap:status,
+cap:message_type, cap:identifier) that feedparser exposes as
+``entry.cap_event`` etc.; the awareness color (yellow/orange/red) is
+NOT a CAP field in this feed — it appears only as the leading word of
+the entry title ("Yellow Thunderstorm Warning issued for France -
+Hautes-Pyrénées"), so ``awareness_color`` here is derived from the
+title. There is NO Europe-wide feed: the documented
+``meteoalarm-legacy-atom-europe`` slug returns 404 and the feed index
+page advertises per-country feeds only, so a country is required to
+fetch warnings; calling without one returns the country roster.
+
+Feed content is licensed by MeteoAlarm under terms equivalent to
+CC BY 4.0 (per the feed's own <rights> element).
+"""
+
+import logging
+import re
+from datetime import datetime, timezone
+
+from ..fetcher import Fetcher
+
+try:
+ import feedparser
+except ImportError:
+ feedparser = None # type: ignore[assignment]
+
+logger = logging.getLogger("world-intel-mcp.sources.meteoalarm")
+
+_FEED_URL_TEMPLATE = "https://feeds.meteoalarm.org/feeds/meteoalarm-legacy-atom-{slug}"
+
+# Warnings feed; 10 minutes keeps us polite while staying current.
+_CACHE_TTL = 600
+
+# Complete per-country roster harvested from the feeds.meteoalarm.org
+# index page 2026-09-01. These are URL slugs, not ISO codes.
+_COUNTRIES: frozenset[str] = frozenset(
+ {
+ "andorra",
+ "austria",
+ "belgium",
+ "bosnia-herzegovina",
+ "bulgaria",
+ "croatia",
+ "cyprus",
+ "czechia",
+ "denmark",
+ "estonia",
+ "finland",
+ "france",
+ "germany",
+ "greece",
+ "hungary",
+ "iceland",
+ "ireland",
+ "israel",
+ "italy",
+ "latvia",
+ "lithuania",
+ "luxembourg",
+ "malta",
+ "moldova",
+ "montenegro",
+ "netherlands",
+ "norway",
+ "poland",
+ "portugal",
+ "republic-of-north-macedonia",
+ "romania",
+ "serbia",
+ "slovakia",
+ "slovenia",
+ "spain",
+ "sweden",
+ "switzerland",
+ "ukraine",
+ "united-kingdom",
+ }
+)
+
+# Common names that differ from Meteoalarm's slugs.
+_ALIASES: dict[str, str] = {
+ "uk": "united-kingdom",
+ "great-britain": "united-kingdom",
+ "czech-republic": "czechia",
+ "bosnia": "bosnia-herzegovina",
+ "bosnia-and-herzegovina": "bosnia-herzegovina",
+ "macedonia": "republic-of-north-macedonia",
+ "north-macedonia": "republic-of-north-macedonia",
+}
+
+# Meteoalarm awareness colors, as they lead entry titles.
+_COLOR_RE = re.compile(r"^(Green|Yellow|Orange|Red)\b", re.IGNORECASE)
+
+
+async def fetch_meteoalarm_alerts(
+ fetcher: Fetcher, country: str | None = None, limit: int = 50
+) -> dict:
+ """Fetch active severe-weather warnings for one European country.
+
+ Args:
+ fetcher: Shared HTTP fetcher with caching and circuit breaking.
+ country: Country name or slug (e.g. "france", "united-kingdom",
+ "uk"). Meteoalarm publishes per-country feeds only, so None
+ returns the available-country roster instead of warnings.
+ limit: Max alerts to return (each alert is one warning for one
+ area; a single meteorological event spans several entries).
+
+ Returns:
+ Dict with alerts list (event, severity, awareness_color, area,
+ onset/expires, certainty, urgency, status), count, by_severity
+ and by_color counts, country, source, and timestamp. Zero
+ alerts with no degraded marker means calm weather, not a
+ failure.
+ """
+ now = datetime.now(timezone.utc)
+ timestamp = now.strftime("%Y-%m-%dT%H:%M:%SZ")
+
+ if country is None:
+ return {
+ "note": (
+ "Meteoalarm publishes per-country feeds only (no Europe-wide "
+ "feed exists). Pass country=<name> to fetch warnings."
+ ),
+ "available_countries": sorted(_COUNTRIES),
+ "alerts": [],
+ "count": 0,
+ "country": None,
+ "source": "meteoalarm",
+ "timestamp": timestamp,
+ }
+
+ slug = _normalize_country(country)
+ if slug not in _COUNTRIES:
+ return {
+ "error": f"Unknown Meteoalarm country: {country!r}",
+ "reason": "unknown_country",
+ "available_countries": sorted(_COUNTRIES),
+ "alerts": [],
+ "count": 0,
+ "country": country,
+ "source": "meteoalarm",
+ "timestamp": timestamp,
+ }
+
+ if feedparser is None:
+ return {
+ "error": "feedparser not installed — run: pip install feedparser",
+ "degraded": True,
+ "reason": "feedparser_missing",
+ "alerts": [],
+ "count": 0,
+ "country": slug,
+ "source": "meteoalarm",
+ "timestamp": timestamp,
+ }
+
+ xml_text = await fetcher.get_xml(
+ _FEED_URL_TEMPLATE.format(slug=slug),
+ source="meteoalarm",
+ cache_key=f"meteoalarm:atom:{slug}",
+ cache_ttl=_CACHE_TTL,
+ )
+
+ if xml_text is None:
+ logger.warning("Meteoalarm feed for %s returned no data", slug)
+ return {
+ "error": (
+ f"Meteoalarm feed for {slug} unavailable (no live or cached data)"
+ ),
+ "degraded": True,
+ "reason": "meteoalarm_fetch_failed",
+ "alerts": [],
+ "count": 0,
+ "country": slug,
+ "source": "meteoalarm",
+ "timestamp": timestamp,
+ }
+
+ parsed = feedparser.parse(xml_text)
+
+ alerts = []
+ by_severity: dict[str, int] = {}
+ by_color: dict[str, int] = {}
+ total_entries = 0
+ for entry in parsed.get("entries", []):
+ total_entries += 1
+ title = entry.get("title", "")
+ color_match = _COLOR_RE.match(title)
+ color = color_match.group(1).lower() if color_match else None
+
+ severity = entry.get("cap_severity")
+ if severity:
+ by_severity[severity] = by_severity.get(severity, 0) + 1
+ if color:
+ by_color[color] = by_color.get(color, 0) + 1
+
+ if len(alerts) >= limit:
+ continue # keep counting for by_severity/by_color totals
+
+ alerts.append(
+ {
+ "event": entry.get("cap_event"),
+ "severity": severity,
+ "awareness_color": color,
+ "area": entry.get("cap_areadesc"),
+ "onset": entry.get("cap_onset"),
+ "expires": entry.get("cap_expires"),
+ "certainty": entry.get("cap_certainty"),
+ "urgency": entry.get("cap_urgency"),
+ "status": entry.get("cap_status"),
+ "message_type": entry.get("cap_message_type"),
+ "identifier": entry.get("cap_identifier"),
+ "title": title,
+ "published": entry.get("published"),
+ "link": entry.get("link"),
+ }
+ )
+
+ return {
+ "alerts": alerts,
+ "count": len(alerts),
+ "total_entries": total_entries,
+ "by_severity": by_severity,
+ "by_color": by_color,
+ "country": slug,
+ "feed_updated": parsed.get("feed", {}).get("updated"),
+ "source": "meteoalarm",
+ "timestamp": timestamp,
+ }
+
+
+def _normalize_country(country: str) -> str:
+ """Normalize a user-supplied country name to a Meteoalarm slug."""
+ slug = re.sub(r"[\s_]+", "-", country.strip().lower())
+ return _ALIASES.get(slug, slug)
diff --git a/src/world_intel_mcp/tests/test_server_registry.py b/src/world_intel_mcp/tests/test_server_registry.py
index c535bae..c0720f3 100644
--- a/src/world_intel_mcp/tests/test_server_registry.py
+++ b/src/world_intel_mcp/tests/test_server_registry.py
@@ -123,11 +123,11 @@ def test_aggregate_refuses_drift_and_collisions() -> None:
def test_tool_count_matches_documented_surface(server) -> None:
- """128 = 127 intelligence tools + intel_status. If this fails after
+ """132 = 131 intelligence tools + intel_status. If this fails after
adding a tool, update README.md, ROADMAP.md, and this number in the
same change: the repo's history shows doc counts drifting stale
within weeks when nothing enforced them."""
- assert len(server.TOOLS) == 128
+ assert len(server.TOOLS) == 132
@pytest.mark.asyncio
diff --git a/src/world_intel_mcp/tests/test_sources_bgp.py b/src/world_intel_mcp/tests/test_sources_bgp.py
new file mode 100644
index 0000000..a3dcafb
--- /dev/null
+++ b/src/world_intel_mcp/tests/test_sources_bgp.py
@@ -0,0 +1,270 @@
+"""Tests for sources/bgp.py — respx-mocked RIPEstat data calls.
+
+Gaps / not covered: RIPEstat's "maintenance" envelope (status !=
+"ok" with a data key still present) — the module treats a missing/empty
+data key as failure and passes through whatever data holds otherwise;
+IPv6 prefix responses (assumed shape-identical to v4, mocked only).
+"""
+
+import asyncio as asyncio_mod
+
+import httpx
+import pytest
+import respx
+
+from world_intel_mcp.fetcher import Fetcher
+from world_intel_mcp.sources.bgp import _summarize_rpki, fetch_bgp_status
+
+# Envelope + data shapes mirror live RIPEstat responses observed
+# 2026-09-01 for AS3333 and 193.0.0.0/21.
+_ASN_STATUS = {
+ "status": "ok",
+ "data": {
+ "first_seen": {
+ "prefix": "193.0.0.0/22",
+ "origin": "3333",
+ "time": "2000-08-18T08:00:00",
+ },
+ "last_seen": {
+ "prefix": "193.0.22.0/23",
+ "origin": "3333",
+ "time": "2026-09-01T16:00:00",
+ },
+ "visibility": {
+ "v4": {"ris_peers_seeing": 111, "total_ris_peers": 111},
+ "v6": {"ris_peers_seeing": 108, "total_ris_peers": 108},
+ },
+ "announced_space": {
+ "v4": {"prefixes": 6, "ips": 4608},
+ "v6": {"prefixes": 1, "48s": 1},
+ },
+ "observed_neighbours": 904,
+ "resource": "3333",
+ },
+}
+
+_PREFIX_STATUS = {
+ "status": "ok",
+ "data": {
+ "first_seen": {
+ "prefix": "193.0.0.0/21",
+ "origin": "3333",
+ "time": "2000-10-31T00:00:00",
+ },
+ "last_seen": {
+ "prefix": "193.0.0.0/21",
+ "origin": "3333",
+ "time": "2026-09-01T16:00:00",
+ },
+ "visibility": {
+ "v4": {"ris_peers_seeing": 111, "total_ris_peers": 111},
+ "v6": {"ris_peers_seeing": 0, "total_ris_peers": 0},
+ },
+ "origins": [{"origin": 3333, "route_objects": ["RIPE"]}],
+ "less_specifics": [],
+ "more_specifics": [{"origin": 3333, "prefix": "193.0.0.0/22"}],
+ "resource": "193.0.0.0/21",
+ },
+}
+
+_RPKI_VALID = {
+ "status": "ok",
+ "data": {
+ "resource": "3333",
+ "prefix": "193.0.0.0/21",
+ "validating_roas": [
+ {
+ "origin": "3333",
+ "prefix": "193.0.0.0/21",
+ "validity": "valid",
+ "max_length": 21,
+ }
+ ],
+ "status": "valid",
+ "validator": "routinator",
+ },
+}
+
+
+def _moas_status(origins: list[int]) -> dict:
+ """Prefix routing-status with multiple observed origins (MOAS)."""
+ data = {k: v for k, v in _PREFIX_STATUS["data"].items()}
+ data["origins"] = [{"origin": o, "route_objects": []} for o in origins]
+ return {"status": "ok", "data": data}
+
+
+def _rpki_response(status: str, roas: int = 0) -> dict:
+ return {
+ "status": "ok",
+ "data": {"validating_roas": [{}] * roas, "status": status},
+ }
+
+
+async def test_fetch_bgp_status_asn(fetcher: Fetcher) -> None:
+ route = respx.get(url__regex=r".*stat\.ripe\.net/data/routing-status.*").mock(
+ return_value=httpx.Response(200, json=_ASN_STATUS)
+ )
+
+ result = await fetch_bgp_status(fetcher, "AS3333")
+
+ assert result["source"] == "ripestat"
+ assert result["resource"] == "AS3333"
+ assert result["resource_type"] == "asn"
+ assert "degraded" not in result
+ assert result["visible"] is True
+ assert result["visibility"]["v4"] == {
+ "ris_peers_seeing": 111,
+ "total_ris_peers": 111,
+ }
+ assert result["announced_space"]["v4"]["prefixes"] == 6
+ assert result["observed_neighbours"] == 904
+ assert result["first_seen"]["time"] == "2000-08-18T08:00:00"
+ assert result["rpki"] == [] # ASN queries skip RPKI, explicitly
+ assert "prefix" in result["rpki_note"]
+ # The AS prefix is stripped before hitting RIPEstat
+ assert route.calls.last.request.url.params["resource"] == "3333"
+
+
+async def test_fetch_bgp_status_prefix_with_rpki(fetcher: Fetcher) -> None:
+ respx.get(url__regex=r".*stat\.ripe\.net/data/routing-status.*").mock(
+ return_value=httpx.Response(200, json=_PREFIX_STATUS)
+ )
+ rpki_route = respx.get(url__regex=r".*stat\.ripe\.net/data/rpki-validation.*").mock(
+ return_value=httpx.Response(200, json=_RPKI_VALID)
+ )
+
+ result = await fetch_bgp_status(fetcher, "193.0.0.0/21")
+
+ assert result["resource_type"] == "prefix"
+ assert "degraded" not in result
+ assert result["origins"] == [{"origin": "3333", "route_objects": ["RIPE"]}]
+ assert result["less_specifics_count"] == 0
+ assert result["more_specifics_count"] == 1
+ assert result["rpki"] == [{"origin": "3333", "status": "valid", "roa_count": 1}]
+ assert result["rpki_status"] == "valid"
+ # RPKI was validated against the origin observed in BGP
+ params = rpki_route.calls.last.request.url.params
+ assert params["resource"] == "3333"
+ assert params["prefix"] == "193.0.0.0/21"
+
+
+async def test_fetch_bgp_status_moas_invalid_origin(fetcher: Fetcher) -> None:
+ """One RPKI-invalid origin marks the whole prefix invalid."""
+ respx.get(url__regex=r".*stat\.ripe\.net/data/routing-status.*").mock(
+ return_value=httpx.Response(200, json=_moas_status([3333, 65551]))
+ )
+
+ def _rpki_by_origin(request: httpx.Request) -> httpx.Response:
+ origin = request.url.params["resource"]
+ status = "valid" if origin == "3333" else "invalid"
+ return httpx.Response(200, json=_rpki_response(status, roas=1))
+
+ respx.get(url__regex=r".*stat\.ripe\.net/data/rpki-validation.*").mock(
+ side_effect=_rpki_by_origin
+ )
+
+ result = await fetch_bgp_status(fetcher, "193.0.0.0/21")
+
+ assert [c["status"] for c in result["rpki"]] == ["valid", "invalid"]
+ assert result["rpki_status"] == "invalid"
+
+
+async def test_fetch_bgp_status_unannounced_prefix(fetcher: Fetcher) -> None:
+ """A withdrawn/unseen prefix: zero visibility, no origins, rpki unknown."""
+ data = {
+ "status": "ok",
+ "data": {
+ "visibility": {
+ "v4": {"ris_peers_seeing": 0, "total_ris_peers": 111},
+ },
+ "origins": [],
+ "less_specifics": [],
+ "more_specifics": [],
+ },
+ }
+ respx.get(url__regex=r".*stat\.ripe\.net/data/routing-status.*").mock(
+ return_value=httpx.Response(200, json=data)
+ )
+
+ result = await fetch_bgp_status(fetcher, "203.0.113.0/24")
+
+ assert result["visible"] is False
+ assert result["origins"] == []
+ assert result["rpki"] == []
+ assert result["rpki_status"] == "unknown"
+ assert "degraded" not in result
+
+
+async def test_fetch_bgp_status_rpki_failure_is_inline_not_degraded(
+ fetcher: Fetcher, monkeypatch: pytest.MonkeyPatch
+) -> None:
+ """Routing status still comes back when only the RPKI call fails."""
+
+ async def _no_sleep(*args, **kwargs) -> None:
+ return None
+
+ monkeypatch.setattr(asyncio_mod, "sleep", _no_sleep)
+
+ respx.get(url__regex=r".*stat\.ripe\.net/data/routing-status.*").mock(
+ return_value=httpx.Response(200, json=_PREFIX_STATUS)
+ )
+ respx.get(url__regex=r".*stat\.ripe\.net/data/rpki-validation.*").mock(
+ return_value=httpx.Response(500)
+ )
+
+ result = await fetch_bgp_status(fetcher, "193.0.0.0/21")
+
+ assert "degraded" not in result
+ assert result["rpki"] == [
+ {"origin": "3333", "status": "fetch_failed", "roa_count": 0}
+ ]
+ assert result["rpki_status"] == "unknown"
+
+
+async def test_fetch_bgp_status_feed_down_is_marked_degraded(
+ fetcher: Fetcher, monkeypatch: pytest.MonkeyPatch
+) -> None:
+ async def _no_sleep(*args, **kwargs) -> None:
+ return None
+
+ monkeypatch.setattr(asyncio_mod, "sleep", _no_sleep)
+
+ respx.get(url__regex=r".*stat\.ripe\.net.*").mock(return_value=httpx.Response(500))
+
+ result = await fetch_bgp_status(fetcher, "3333")
+
+ assert result["degraded"] is True
+ assert result["reason"] == "ripestat_fetch_failed"
+ assert "unavailable" in result["error"].lower()
+ assert result["resource_type"] == "asn"
+
+
+async def test_fetch_bgp_status_invalid_resource(fetcher: Fetcher) -> None:
+ """Bare IPs and junk are rejected locally — no HTTP call."""
+ for bad in ("8.8.8.8", "example.com", ""):
+ result = await fetch_bgp_status(fetcher, bad)
+ assert result["reason"] == "invalid_resource"
+ assert "degraded" not in result
+ assert not respx.calls
+
+
+def test_summarize_rpki() -> None:
+ assert _summarize_rpki([]) == "unknown"
+ assert _summarize_rpki([{"status": "valid"}]) == "valid"
+ assert _summarize_rpki([{"status": "valid"}, {"status": "invalid"}]) == "invalid"
+ assert _summarize_rpki([{"status": "valid"}, {"status": "unknown"}]) == "unknown"
+ assert _summarize_rpki([{"status": "fetch_failed"}]) == "unknown"
diff --git a/src/world_intel_mcp/tests/test_sources_jtwc.py b/src/world_intel_mcp/tests/test_sources_jtwc.py
new file mode 100644
index 0000000..f8ed07b
--- /dev/null
+++ b/src/world_intel_mcp/tests/test_sources_jtwc.py
@@ -0,0 +1,258 @@
+"""Tests for sources/jtwc.py — respx-mocked JTWC RSS.
+
+Gaps / not covered: the real Southern Hemisphere season shape with
+active storms (SH was quiet when the live feed was observed, so SH
+storm headers like "Tropical Cyclone 01S" are exercised via the
+unknown-guid mock, not a captured SH payload); "Super Typhoon" and
+"Reissued at" variants are mocked from documented JTWC conventions,
+not observed live.
+"""
+
+import asyncio as asyncio_mod
+
+import httpx
+import pytest
+import respx
+
+from world_intel_mcp.fetcher import Fetcher
+from world_intel_mcp.sources import jtwc as jtwc_mod
+from world_intel_mcp.sources.jtwc import fetch_jtwc_cyclones
+
+# Structure mirrors the live feed observed 2026-09-01: basin items with
+# CDATA HTML descriptions, unbalanced <p><b> nesting, double space
+# between classification and storm id, quiet SH item, advisories item.
+_RSS = """<?xml version="1.0" encoding="UTF-8"?>
+<rss version="2.0">
+ <channel>
+ <title>JTWC TROPICAL CYCLONE INFORMATION FEED</title>
+ <pubDate>Tue, 01 Sep 2026 22:00:07 +0000</pubDate>
+ <item>
+ <title>Current Northwest Pacific/North Indian Ocean* Tropical Systems</title>
+ <description><![CDATA[<p><b>Tropical Depression 17W (Saudel) Warning #42 </b><br>
+<b>Issued at 01/2100Z<b>
+<ul>
+<li><a href='https://www.metoc.navy.mil/jtwc/products/wp1726web.txt' target='newwin'>TC Warning Text </a></li>
+<li><a href='https://www.metoc.navy.mil/jtwc/products/wp1726.gif' target='newwin'>TC Warning Graphic</a></li>
+</ul>
+<p><b>Super Typhoon 22W (Krovanh) Warning #03 </b><br>
+<b>Reissued at 01/2115Z<b>
+<ul>
+<li><a href='https://www.metoc.navy.mil/jtwc/products/wp2226web.txt' target='newwin'>TC Warning Text </a></li>
+</ul>
+]]></description>
+ <category>Northwest Pacific/North Indian Ocean* Tropical Systems</category>
+ <guid>NWPAC-NIO-WARNINGS</guid>
+ <pubDate>Tue, 01 Sep 26 22:00:07 +0000</pubDate>
+ </item>
+ <item>
+ <title>Current Central/Eastern Pacific Tropical Systems</title>
+ <description><![CDATA[<p><b><p><b>Hurricane 11E (Karina) Warning #22 </b><br>
+<b>Issued at 01/2200Z<b>
+<ul>
+<li><a href='https://www.metoc.navy.mil/jtwc/products/ep1126web.txt' target='newwin'>TC Warning Text </a></li>
+<li><a href='https://www.metoc.navy.mil/jtwc/products/ep1126.gif' target='newwin'>TC Warning Graphic</a></li>
+</ul>
+]]></description>
+ <category>Central/Eastern Pacific Tropical Systems</category>
+ <guid>EPAC-CPAC-WARNINGS</guid>
+ <pubDate>Tue, 01 Sep 26 22:00:07 +0000</pubDate>
+ </item>
+ <item>
+ <title>Current Southern Hemisphere Tropical Systems</title>
+ <description><![CDATA[<ul><li><font color='red'>No Current Tropical Cyclone Warnings.</font></li></ul>
+]]></description>
+ <category>Southern Hemisphere Tropical Systems</category>
+ <guid>SH-WARNINGS</guid>
+ <pubDate>Tue, 01 Sep 26 22:00:07 +0000</pubDate>
+ </item>
+ <item>
+ <title>Current Significant Tropical Weather Advisories</title>
+ <description><![CDATA[<ul>
+<li><b><a href="https://www.metoc.navy.mil/jtwc/products/abpwweb.txt" target='newwin'>ABPW10 (Western/South Pacific Ocean)</a><br>
+<font color=red>Reissued at 01/2100Z</font></li>
+<li><b><a href="https://www.metoc.navy.mil/jtwc/products/abioweb.txt" target='newwin'>ABIO10 (Indian Ocean)</a><br>
+Issued at 01/1800Z</b></li>
+</ul>]]></description>
+ <category>Significant Tropical Weather Advisories</category>
+ <guid>TROPICAL-ADVISORIES</guid>
+ <pubDate>Tue, 01 Sep 26 22:00:07 +0000</pubDate>
+ </item>
+ </channel>
+</rss>
+"""
+
+
+def _quiet_rss() -> str:
+ """Every basin quiet — the valid off-season shape."""
+ quiet = (
+ "<![CDATA[<ul><li><font color='red'>"
+ "No Current Tropical Cyclone Warnings.</font></li></ul>]]>"
+ )
+ out = _RSS
+ for guid in ("NWPAC-NIO-WARNINGS", "EPAC-CPAC-WARNINGS"):
+ head, _, tail = out.partition(f"<guid>{guid}</guid>")
+ # Replace the description preceding this guid
+ start = head.rindex("<description>") + len("<description>")
+ end = head.rindex("</description>")
+ out = head[:start] + quiet + head[end:] + f"<guid>{guid}</guid>" + tail
+ return out
+
+
+async def test_fetch_jtwc_extracts_storms(fetcher: Fetcher) -> None:
+ respx.get(url__regex=r".*metoc\.navy\.mil.*").mock(
+ return_value=httpx.Response(200, text=_RSS)
+ )
+
+ result = await fetch_jtwc_cyclones(fetcher)
+
+ assert result["source"] == "jtwc"
+ assert result["count"] == 3
+ assert "degraded" not in result
+ assert result["by_basin"] == {
+ "northwest_pacific_north_indian": 2,
+ "central_eastern_pacific": 1,
+ "southern_hemisphere": 0, # quiet basin present with zero
+ }
+
+ saudel = result["storms"][0]
+ assert saudel["id"] == "17W"
+ assert saudel["name"] == "Saudel"
+ assert saudel["classification"] == "Tropical Depression"
+ assert saudel["warning_number"] == 42
+ assert saudel["issued_at"] == "01/2100Z"
+ assert saudel["basin"] == "northwest_pacific_north_indian"
+ assert saudel["warning_text_url"] == (
+ "https://www.metoc.navy.mil/jtwc/products/wp1726web.txt"
+ )
+ assert saudel["warning_graphic_url"] == (
+ "https://www.metoc.navy.mil/jtwc/products/wp1726.gif"
+ )
+
+ krovanh = result["storms"][1]
+ assert krovanh["classification"] == "Super Typhoon"
+ assert krovanh["warning_number"] == 3 # "#03" coerced
+ assert krovanh["issued_at"] == "01/2115Z" # "Reissued at" variant
+ # Krovanh's segment has no .gif link; Saudel's must not bleed over
+ assert krovanh["warning_graphic_url"] is None
+ assert krovanh["warning_text_url"] == (
+ "https://www.metoc.navy.mil/jtwc/products/wp2226web.txt"
+ )
+
+ karina = result["storms"][2]
+ assert karina["id"] == "11E"
+ assert karina["classification"] == "Hurricane"
+ assert karina["basin"] == "central_eastern_pacific"
+
+ assert result["advisories"] == [
+ {
+ "title": "ABPW10 (Western/South Pacific Ocean)",
+ "url": "https://www.metoc.navy.mil/jtwc/products/abpwweb.txt",
+ },
+ {
+ "title": "ABIO10 (Indian Ocean)",
+ "url": "https://www.metoc.navy.mil/jtwc/products/abioweb.txt",
+ },
+ ]
+ assert result["feed_published"] == "Tue, 01 Sep 2026 22:00:07 +0000"
+
+
+async def test_fetch_jtwc_all_quiet_is_valid_not_degraded(fetcher: Fetcher) -> None:
+ """Every basin quiet is a real state of the world, not an outage."""
+ respx.get(url__regex=r".*metoc\.navy\.mil.*").mock(
+ return_value=httpx.Response(200, text=_quiet_rss())
+ )
+
+ result = await fetch_jtwc_cyclones(fetcher)
+
+ assert result["count"] == 0
+ assert result["storms"] == []
+ assert result["by_basin"] == {
+ "northwest_pacific_north_indian": 0,
+ "central_eastern_pacific": 0,
+ "southern_hemisphere": 0,
+ }
+ assert "degraded" not in result
+ assert "error" not in result
+ # Advisories still parse even when all basins are quiet
+ assert len(result["advisories"]) == 2
+
+
+async def test_fetch_jtwc_unknown_guid_falls_back_to_category(
+ fetcher: Fetcher,
+) -> None:
+ """A new/renamed basin item must not silently drop its storms."""
+ rss = _RSS.replace("NWPAC-NIO-WARNINGS", "WESTPAC-WARNINGS")
+
+ respx.get(url__regex=r".*metoc\.navy\.mil.*").mock(
+ return_value=httpx.Response(200, text=rss)
+ )
+
+ result = await fetch_jtwc_cyclones(fetcher)
+
+ assert result["count"] == 3 # nothing dropped
+ derived = [b for b in result["by_basin"] if b.startswith("northwest_pacific")]
+ assert derived # basin label derived from the category text
+ assert result["by_basin"][derived[0]] == 2
+
+
+async def test_fetch_jtwc_drifted_format_logs_but_returns(
+ fetcher: Fetcher, caplog: pytest.LogCaptureFixture
+) -> None:
+ """No storm headers AND no quiet marker means the format drifted."""
+ rss = _RSS.replace(
+ "No Current Tropical Cyclone Warnings.", "Something unrecognized."
+ )
+
+ respx.get(url__regex=r".*metoc\.navy\.mil.*").mock(
+ return_value=httpx.Response(200, text=rss)
+ )
+
+ with caplog.at_level("INFO", logger="world-intel-mcp.sources.jtwc"):
+ result = await fetch_jtwc_cyclones(fetcher)
+
+ assert result["by_basin"]["southern_hemisphere"] == 0
+ assert "degraded" not in result
+ assert any("drifted" in r.message for r in caplog.records)
+
+
+async def test_fetch_jtwc_feed_down_is_marked_degraded(
+ fetcher: Fetcher, monkeypatch: pytest.MonkeyPatch
+) -> None:
+ """A fetch failure must never be shape-identical to quiet basins."""
+
+ async def _no_sleep(*args, **kwargs) -> None:
+ return None
+
+ monkeypatch.setattr(asyncio_mod, "sleep", _no_sleep)
+
+ respx.get(url__regex=r".*metoc\.navy\.mil.*").mock(return_value=httpx.Response(500))
+
+ result = await fetch_jtwc_cyclones(fetcher)
+
+ assert result["degraded"] is True
+ assert result["reason"] == "jtwc_fetch_failed"
+ assert "unavailable" in result["error"].lower()
+ assert result["storms"] == []
+ assert result["by_basin"] == {}
+
+
+async def test_fetch_jtwc_without_feedparser(
+ fetcher: Fetcher, monkeypatch: pytest.MonkeyPatch
+) -> None:
+ monkeypatch.setattr(jtwc_mod, "feedparser", None)
+
+ result = await fetch_jtwc_cyclones(fetcher)
+
+ assert result["degraded"] is True
+ assert result["reason"] == "feedparser_missing"
diff --git a/src/world_intel_mcp/tests/test_sources_meteoalarm.py b/src/world_intel_mcp/tests/test_sources_meteoalarm.py
new file mode 100644
index 0000000..2d35daf
--- /dev/null
+++ b/src/world_intel_mcp/tests/test_sources_meteoalarm.py
@@ -0,0 +1,222 @@
+"""Tests for sources/meteoalarm.py — respx-mocked legacy ATOM feeds.
+
+Gaps / not covered: only the France feed's live shape informed the
+mock (other countries assumed identical); the real feed's PubSubHubbub
+hub links and cap:geocode blocks are omitted from the mock as the
+module ignores them.
+"""
+
+import asyncio as asyncio_mod
+
+import httpx
+import pytest
+import respx
+
+from world_intel_mcp.fetcher import Fetcher
+from world_intel_mcp.sources import meteoalarm as meteoalarm_mod
+from world_intel_mcp.sources.meteoalarm import (
+ _normalize_country,
+ fetch_meteoalarm_alerts,
+)
+
+# Entry shape mirrors the live France feed observed 2026-09-01:
+# cap:* extension elements, awareness color only in the title.
+_ATOM = """<?xml version="1.0" encoding="UTF-8"?>
+<feed xmlns="http://www.w3.org/2005/Atom"
+ xmlns:cap="urn:oasis:names:tc:emergency:cap:1.2">
+ <id>tag:meteoalarm.org,2021-02-19:FR</id>
+ <title>MeteoAlarm - Alerting Europe for Extreme Weather</title>
+ <updated>2026-09-01T21:36:24Z</updated>
+ <entry>
+ <cap:areaDesc>Hautes-Pyrénées</cap:areaDesc>
+ <cap:event>Moderate thunderstorm warning</cap:event>
+ <cap:onset>2026-09-01T14:00:10+00:00</cap:onset>
+ <cap:expires>2026-09-01T22:00:00+00:00</cap:expires>
+ <cap:certainty>Likely</cap:certainty>
+ <cap:severity>Moderate</cap:severity>
+ <cap:urgency>Future</cap:urgency>
+ <cap:status>Actual</cap:status>
+ <cap:message_type>Alert</cap:message_type>
+ <cap:identifier>2.49.0.0.250.0.FR.645023</cap:identifier>
+ <link href="https://meteoalarm.org?geocode=EMMA_ID:FR003"/>
+ <published>2026-09-01T14:00:19Z</published>
+ <id>https://feeds.meteoalarm.org/api/v1/warnings/feeds-france/aa-1</id>
+ <title>Yellow Thunderstorm Warning issued for France - Hautes-Pyrénées</title>
+ <updated>2026-09-01T14:00:19Z</updated>
+ </entry>
+ <entry>
+ <cap:areaDesc>Finistère</cap:areaDesc>
+ <cap:event>Severe wind warning</cap:event>
+ <cap:severity>Severe</cap:severity>
+ <cap:status>Actual</cap:status>
+ <id>https://feeds.meteoalarm.org/api/v1/warnings/feeds-france/aa-2</id>
+ <title>Orange Wind Warning issued for France - Finistère</title>
+ </entry>
+ <entry>
+ <cap:areaDesc>Var</cap:areaDesc>
+ <cap:event>Extreme rain warning</cap:event>
+ <cap:severity>Extreme</cap:severity>
+ <cap:status>Actual</cap:status>
+ <id>https://feeds.meteoalarm.org/api/v1/warnings/feeds-france/aa-3</id>
+ <title>Red Rain Warning issued for France - Var</title>
+ </entry>
+</feed>
+"""
+
+_EMPTY_ATOM = """<?xml version="1.0" encoding="UTF-8"?>
+<feed xmlns="http://www.w3.org/2005/Atom"
+ xmlns:cap="urn:oasis:names:tc:emergency:cap:1.2">
+ <id>tag:meteoalarm.org,2021-02-19:UK</id>
+ <title>MeteoAlarm - Alerting Europe for Extreme Weather</title>
+ <updated>2026-09-01T21:36:24Z</updated>
+</feed>
+"""
+
+
+async def test_fetch_meteoalarm_extracts_alerts(fetcher: Fetcher) -> None:
+ respx.get(url__regex=r".*feeds\.meteoalarm\.org/feeds/.*-france$").mock(
+ return_value=httpx.Response(200, text=_ATOM)
+ )
+
+ result = await fetch_meteoalarm_alerts(fetcher, country="France")
+
+ assert result["source"] == "meteoalarm"
+ assert result["country"] == "france"
+ assert result["count"] == 3
+ assert result["total_entries"] == 3
+ assert "degraded" not in result
+ assert result["by_severity"] == {"Moderate": 1, "Severe": 1, "Extreme": 1}
+ assert result["by_color"] == {"yellow": 1, "orange": 1, "red": 1}
+ assert result["feed_updated"] == "2026-09-01T21:36:24Z"
+
+ first = result["alerts"][0]
+ assert first["event"] == "Moderate thunderstorm warning"
+ assert first["severity"] == "Moderate"
+ assert first["awareness_color"] == "yellow" # from title, not CAP
+ assert first["area"] == "Hautes-Pyrénées"
+ assert first["onset"] == "2026-09-01T14:00:10+00:00"
+ assert first["expires"] == "2026-09-01T22:00:00+00:00"
+ assert first["certainty"] == "Likely"
+ assert first["urgency"] == "Future"
+ assert first["status"] == "Actual"
+ assert first["message_type"] == "Alert"
+ assert first["identifier"] == "2.49.0.0.250.0.FR.645023"
+ assert first["published"] == "2026-09-01T14:00:19Z"
+
+ assert result["alerts"][1]["awareness_color"] == "orange"
+ assert result["alerts"][2]["awareness_color"] == "red"
+
+
+async def test_fetch_meteoalarm_limit_keeps_full_counts(fetcher: Fetcher) -> None:
+ """Limit truncates the alerts list but not the summary counters."""
+ respx.get(url__regex=r".*feeds\.meteoalarm\.org.*").mock(
+ return_value=httpx.Response(200, text=_ATOM)
+ )
+
+ result = await fetch_meteoalarm_alerts(fetcher, country="france", limit=1)
+
+ assert result["count"] == 1
+ assert result["total_entries"] == 3
+ assert result["by_severity"] == {"Moderate": 1, "Severe": 1, "Extreme": 1}
+ assert result["by_color"] == {"yellow": 1, "orange": 1, "red": 1}
+
+
+async def test_fetch_meteoalarm_no_country_returns_roster(fetcher: Fetcher) -> None:
+ """No Europe-wide feed exists — country=None returns the roster, no HTTP."""
+ result = await fetch_meteoalarm_alerts(fetcher)
+
+ assert result["count"] == 0
+ assert result["alerts"] == []
+ assert result["country"] is None
+ assert "error" not in result
+ assert "degraded" not in result
+ assert len(result["available_countries"]) == 39
+ assert "france" in result["available_countries"]
+ assert "united-kingdom" in result["available_countries"]
+ assert not respx.calls # roster answered locally
+
+
+async def test_fetch_meteoalarm_unknown_country_is_not_degraded(
+ fetcher: Fetcher,
+) -> None:
+ """Bad input is a usage error, not an upstream outage."""
+ result = await fetch_meteoalarm_alerts(fetcher, country="Atlantis")
+
+ assert result["reason"] == "unknown_country"
+ assert "Atlantis" in result["error"]
+ assert "degraded" not in result
+ assert result["alerts"] == []
+ assert "available_countries" in result
+ assert not respx.calls
+
+
+async def test_fetch_meteoalarm_alias_and_quiet_feed(fetcher: Fetcher) -> None:
+ """ "UK" resolves to united-kingdom; an empty feed is calm weather."""
+ route = respx.get(
+ url__regex=r".*feeds\.meteoalarm\.org/feeds/.*-united-kingdom$"
+ ).mock(return_value=httpx.Response(200, text=_EMPTY_ATOM))
+
+ result = await fetch_meteoalarm_alerts(fetcher, country="UK")
+
+ assert route.called
+ assert result["country"] == "united-kingdom"
+ assert result["count"] == 0
+ assert result["total_entries"] == 0
+ assert result["alerts"] == []
+ assert result["by_severity"] == {}
+ assert "degraded" not in result
+ assert "error" not in result
+
+
+async def test_fetch_meteoalarm_feed_down_is_marked_degraded(
+ fetcher: Fetcher, monkeypatch: pytest.MonkeyPatch
+) -> None:
+ async def _no_sleep(*args, **kwargs) -> None:
+ return None
+
+ monkeypatch.setattr(asyncio_mod, "sleep", _no_sleep)
+
+ respx.get(url__regex=r".*feeds\.meteoalarm\.org.*").mock(
+ return_value=httpx.Response(500)
+ )
+
+ result = await fetch_meteoalarm_alerts(fetcher, country="germany")
+
+ assert result["degraded"] is True
+ assert result["reason"] == "meteoalarm_fetch_failed"
+ assert "unavailable" in result["error"].lower()
+ assert result["alerts"] == []
+ assert result["count"] == 0
+
+
+async def test_fetch_meteoalarm_without_feedparser(
+ fetcher: Fetcher, monkeypatch: pytest.MonkeyPatch
+) -> None:
+ monkeypatch.setattr(meteoalarm_mod, "feedparser", None)
+
+ result = await fetch_meteoalarm_alerts(fetcher, country="france")
+
+ assert result["degraded"] is True
+ assert result["reason"] == "feedparser_missing"
+
+
+def test_normalize_country() -> None:
+ assert _normalize_country("France") == "france"
+ assert _normalize_country(" United Kingdom ") == "united-kingdom"
+ assert _normalize_country("UK") == "united-kingdom"
+ assert _normalize_country("czech_republic") == "czechia"
+ assert _normalize_country("North Macedonia") == "republic-of-north-macedonia"
+ assert _normalize_country("Bosnia and Herzegovina") == "bosnia-herzegovina"
diff --git a/src/world_intel_mcp/tools/hazards.py b/src/world_intel_mcp/tools/hazards.py
index 00af22a..7d1a8fd 100644
--- a/src/world_intel_mcp/tools/hazards.py
+++ b/src/world_intel_mcp/tools/hazards.py
@@ -188,6 +188,29 @@ TOOLS: list[Tool] = [
description="Get active tropical cyclones from the US National Hurricane Center: name, classification, intensity (knots), pressure (mb), position, movement, by-basin grouping. Covers the Atlantic, Eastern and Central Pacific basins only - Western Pacific / Indian Ocean storms (JTWC) are not included. Zero storms means a quiet tropics, not an outage; a fetch failure carries an explicit error. No API key needed.",
inputSchema={"type": "object", "properties": {}},
),
+ Tool(
+ name="intel_meteoalarm_alerts",
+ description="Get active severe-weather warnings from Meteoalarm (EUMETNET): event type, severity, awareness color, area, onset/expires. Covers Europe only - 39 participating countries, each with its own feed (no Europe-wide feed exists); call without country to list available countries. Awareness color is derived from the warning title. Zero alerts means calm weather, not an outage; a fetch failure carries an explicit error. Content CC BY 4.0-equivalent. No API key needed.",
+ inputSchema={
+ "type": "object",
+ "properties": {
+ "country": {
+ "type": "string",
+ "description": "Country name or slug (e.g. france, united-kingdom, uk). Omit to get the available-country roster.",
+ },
+ "limit": {
+ "type": "integer",
+ "description": "Max alerts (default 50); one warning may span several area entries",
+ "default": 50,
+ },
+ },
+ },
+ ),
+ Tool(
+ name="intel_jtwc_cyclones",
+ description="Get active tropical cyclone warnings from the Joint Typhoon Warning Center: storm id, name, classification, warning number, issue time, warning text/graphic links, by-basin grouping, plus significant tropical weather advisories. Covers the Northwest Pacific, North Indian Ocean, and Southern Hemisphere; its Central/Eastern Pacific item overlaps NHC (intel_cyclones). Positions and intensities are not in the feed - they live in the linked warning products. Zero storms means quiet basins, not an outage. No API key needed.",
+ inputSchema={"type": "object", "properties": {}},
+ ),
]
@@ -257,6 +280,22 @@ async def _cyclones(arguments: dict[str, Any]) -> Any:
return await cyclones.fetch_cyclones(runtime.fetcher)
+async def _meteoalarm_alerts(arguments: dict[str, Any]) -> Any:
+ from ..sources import meteoalarm
+
+ return await meteoalarm.fetch_meteoalarm_alerts(
+ runtime.fetcher,
+ country=arguments.get("country"),
+ limit=arguments.get("limit", 50),
+ )
+
+
+async def _jtwc_cyclones(arguments: dict[str, Any]) -> Any:
+ from ..sources import jtwc
+
+ return await jtwc.fetch_jtwc_cyclones(runtime.fetcher)
+
+
HANDLERS = {
"intel_earthquakes": _earthquakes,
"intel_wildfires": _wildfires,
@@ -268,4 +307,6 @@ HANDLERS = {
"intel_launch_schedule": _launch_schedule,
"intel_volcano_activity": _volcano_activity,
"intel_cyclones": _cyclones,
+ "intel_meteoalarm_alerts": _meteoalarm_alerts,
+ "intel_jtwc_cyclones": _jtwc_cyclones,
}
diff --git a/src/world_intel_mcp/tools/infrastructure.py b/src/world_intel_mcp/tools/infrastructure.py
index 28f6897..3b61394 100644
--- a/src/world_intel_mcp/tools/infrastructure.py
+++ b/src/world_intel_mcp/tools/infrastructure.py
@@ -110,6 +110,20 @@ TOOLS: list[Tool] = [
},
},
),
+ Tool(
+ name="intel_bgp_status",
+ description="Get BGP routing status for one prefix or ASN from RIPEstat: RIS peer visibility per address family, announced space and neighbour count (ASN queries), observed origin ASNs and per-origin RPKI validation valid/invalid/unknown (prefix queries). A per-resource health check, not global hijack detection - RIPEstat has no target-free incident feed. No API key needed.",
+ inputSchema={
+ "type": "object",
+ "properties": {
+ "resource": {
+ "type": "string",
+ "description": "ASN (AS3333 or 3333) or CIDR prefix (193.0.0.0/21); bare IPs rejected",
+ },
+ },
+ "required": ["resource"],
+ },
+ ),
]
@@ -168,6 +182,14 @@ async def _service_status(arguments: dict[str, Any]) -> Any:
)
+async def _bgp_status(arguments: dict[str, Any]) -> Any:
+ from ..sources import bgp
+
+ return await bgp.fetch_bgp_status(
+ runtime.fetcher, resource=arguments.get("resource", "")
+ )
+
+
HANDLERS = {
"intel_internet_outages": _internet_outages,
"intel_cable_health": _cable_health,
@@ -178,5 +200,5 @@ HANDLERS = {
"intel_traffic_incidents": _traffic_incidents,
"intel_webcams": _webcams,
"intel_shipping_index": _shipping_index,
- "intel_service_status": _service_status,
+ "intel_service_status": _service_status, "intel_bgp_status": _bgp_status,
}