Skip to main content

MCP server for Philippine civic data: PSGC, infra spending accountability, PSA economy (inflation, labor, poverty, population), one-call area profiles, earthquakes, weather, typhoons, procurement, solar/climate, air quality, vegetation

Project description

ph-civic-data-mcp

The multi-source MCP server for Philippine civic data. PSGC codes, infra spending accountability, earthquakes, weather, typhoons, procurement, population, poverty, solar radiation, air quality, satellite vegetation indices, and macro indicators — all in your AI agent, no API keys required.

PyPI Python 3.11+ License: MIT Glama AAA MCP Registry

One-click install: Add to Cursor Add to VS Code Install via Smithery Add via Claude Code

ph-civic-data-mcp is a zero-cost, stdio-transport MCP server. v0.4.0 expands the PSA OpenSTAT layer beyond population/poverty into the live economy — get_inflation_stats (regional CPI), get_labor_stats (Labor Force Survey), get_health_indicators — and adds the auto-stitch differentiator get_area_profile: name a place once and get the resolved PSGC spine plus demographics, economy, procurement, hazard, and weather composed in a single agent turn, with infrastructure notices already normalized per 100k residents. v0.3.1 was a correctness pass on the v0.3.0 accountability layer (no fabricated PAGASA advisories, stoplisted hazard tokens, "City of Manila" coordinate bridge, province/agency-alias infra search). v0.3.0 added the PH Accountability layer: PSGC location resolver, infra spending search, and one cross-source heuristic that flags procurement notices for further review by cross-referencing PHIVOLCS earthquakes and PAGASA typhoon footprints. v0.2.0 added six no-auth scientific + open-data sources (NASA POWER, Open-Meteo Air Quality, NASA MODIS, USGS FDSN, NOAA IBTrACS, World Bank Open Data) on top of the original four Philippine government feeds (PHIVOLCS, PAGASA, PhilGEPS, PSA). 29 tools total. Boots and runs with zero API keys.

All data sourced from public records (PSGC, PHIVOLCS, PAGASA, PhilGEPS, PSA, and open scientific feeds). Heuristic indicators are statistical only; specific allegations, if any, require independent investigation and corroboration.

This is how easy it is to set up

One JSON file. One claude command. Your agent just correlated live Philippine weather with 2020 Census population data in a single turn.

setup

The recording above isn't scripted. It's vhs docs/demo_setup.tape, which spawns Claude Code with --mcp-config pointing at this server, and Claude fans out in parallel to get_weather_forecast (Open-Meteo) and get_population_stats (PSA PXWeb), then correlates them. The temperatures (30.4 / 30.9 / 31.0 °C max over Apr 19-21) and NCR population (13,484,462) in the streamed answer are what the live sources returned at the moment of the recording.

Works the same way in Claude Desktop, Cursor, Zed, VS Code, or any MCP-compatible client. One "command": "uvx", one "args": ["ph-civic-data-mcp"], done.

Demo

Every GIF below is a real VHS recording of docs/live_demo.py. It spawns uvx ph-civic-data-mcp from this PyPI release and calls each tool over the real MCP stdio protocol. The panels you see contain the actual JSON returned by the server. Nothing is staged.

A grand tour hitting 7 tools across all 4 sources in one session:

grand tour

Per-source walkthroughs below. To reproduce any of them locally: uv run python docs/live_demo_single.py <suite>.

Why this exists

Philippine civic-data portals publish open data, but each in its own schema — scraped HTML tables, PXWeb JSON, undocumented APIs. Nothing ties them together for an AI agent. This server does.

A handful of other Philippine civic-data MCP servers exist (PSGC administrative geography, holidays, DHSUD license-to-sell, DepEd schools), each covering one dataset. None expose hazard feeds, weather, procurement, or statistical data, and none combine sources. This server does both. See the Prior art section below for the full list.

Install

uvx ph-civic-data-mcp

Or via pip:

pip install ph-civic-data-mcp

Setup

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "ph-civic-data": {
      "command": "uvx",
      "args": ["ph-civic-data-mcp"]
    }
  }
}

Claude Code

Add to .claude/settings.json:

{
  "mcpServers": {
    "ph-civic-data": {
      "command": "uvx",
      "args": ["ph-civic-data-mcp"]
    }
  }
}

Or install via the Claude Code CLI:

claude mcp add ph-civic-data -- uvx ph-civic-data-mcp

Cursor, Zed, other MCP clients

Any client that supports the stdio MCP transport works. Point the command at uvx ph-civic-data-mcp. No API keys required for the default configuration.

What you can ask

After setup, ask your agent:

  • "How hot is Metro Manila this week and how many people are affected?"
  • "What earthquakes happened in the Philippines in the last 24 hours?"
  • "Is Taal volcano active right now?"
  • "What's the 3-day weather forecast for Quezon City?"
  • "Are there active typhoons in the Philippines right now?"
  • "Search PhilGEPS for flood control contracts."
  • "What is the population of Region VII based on the PSA?"
  • "What is the poverty incidence in the Bicol Region?"
  • "Give me a multi-hazard risk profile for Leyte."
  • "What's the solar irradiance in Ilocos Norte this week? Good site for a PV farm?" (v0.2.0)
  • "Compare air quality in Makati and Cebu City right now." (v0.2.0)
  • "What do MODIS NDVI composites say about vegetation health over the Nueva Ecija rice bowl?" (v0.2.0)
  • "Cross-check the magnitudes that PHIVOLCS and USGS assigned to last week's events." (v0.2.0)
  • "List all typhoons that passed through the PAR in the 2024 season." (v0.2.0)
  • "What's the Philippines' GDP growth and poverty ratio over the last decade?" (v0.2.0)
  • "Resolve 'Sta. Mesa, Manila' to its official PSGC code." (v0.3.0)
  • "Find DPWH flood-control or construction projects in Pampanga over P50M with low progress." (v0.3.0)
  • "Show me PH infrastructure spending breakdown by category for the latest PhilGEPS window." (v0.3.0)
  • "Are there any infra projects whose locations overlap a recent earthquake or typhoon footprint? Flag them for review." (v0.3.0)
  • "Walk the location hierarchy from PSGC code 072217000 up to its region." (v0.3.0)
  • "What's the cache TTL and freshness of every data source this server uses?" (v0.3.0)
  • "What's the latest inflation rate in Central Visayas vs nationally?" (v0.4.0)
  • "What are the current employment and underemployment rates from the PSA Labor Force Survey?" (v0.4.0)
  • "What's the maternal mortality ratio and total fertility rate for the Philippines?" (v0.4.0)
  • "Give me the full civic profile of Cebu — population, poverty, inflation, jobs, procurement activity, hazards, and weather, in one shot." (v0.4.0)

Per-source demos

PHIVOLCS — earthquakes + volcano alert levels

phivolcs

PAGASA — weather forecast + typhoon tracking

pagasa

PhilGEPS — procurement search + aggregation

philgeps

PSA — population (2020 Census) + poverty (2023 Full-Year)

psa

Cross-source — parallel multi-hazard risk profile

cross-source

PSA economy + auto-stitch — inflation, labor, health, one-call area profile (v0.4.0)

v0.4.0 per-source

The LinkedIn showcase — one question correlated across five sources through get_area_profile — is under What's new in v0.4.0.

How the demos are produced

docs/live_demo.py and docs/live_demo_single.py open an MCP StdioTransport pointing at uvx ph-civic-data-mcp (which resolves to this PyPI release), call the tools, and render the responses with Rich (panels, tables, syntax-highlighted JSON, live spinners). vhs drives a real terminal and records the session. Tapes are committed under docs/*.tape.

Data sources

Source Data Update frequency Auth
PHIVOLCS Earthquakes, bulletins, volcano alerts 5 min (earthquakes), 30 min (volcanoes) None
PAGASA 10-day weather, active typhoons, alerts Hourly Optional PAGASA_API_TOKEN
Open-Meteo Weather fallback when PAGASA token absent Hourly None
PhilGEPS Government procurement notices (latest ~100) 6 h (cached) None
PSA OpenSTAT Population (2020 Census), poverty (2023), CPI/inflation, Labor Force Survey, health indicators Per-table vintage None
NASA POWER (v0.2.0) Daily solar irradiance + temp/precip/wind, any lat/lng Daily None
Open-Meteo Air Quality (v0.2.0) PM2.5/PM10/NO2/SO2/O3/CO + AQI Hourly None
NASA MODIS via ORNL DAAC (v0.2.0) NDVI/EVI vegetation indices (250m, 16-day composites) Weekly None
USGS FDSN (v0.2.0) Philippine-region earthquakes from global seismic network Minutes None
NOAA IBTrACS (v0.2.0) Historical tropical cyclone tracks through the PAR Per storm None
World Bank Open Data (v0.2.0) Philippine macro indicators (GDP, poverty ratio, inflation, etc.) Annual None
PSGC (v0.3.0) Philippine Standard Geographic Code via psgc.gitlab.io (PSA dataset mirror) When PSA publishes a new version None
PH Infra (PhilGEPS-backed) (v0.3.0) Filtered infra notices for construction / road / bridge / flood control 6 h cache window None
PSA economy (v0.4.0) CPI/inflation (regional), Labor Force Survey rates, health indicators via PXWeb browse-discovery Per-table vintage (read from each table) None
Area profile (auto-stitch) (v0.4.0) One-call composition: PSGC + PSA + PhilGEPS + PHIVOLCS + PAGASA, with per-capita normalization Live per request; 1 h cache None

All tools

Tool Description Key params
get_latest_earthquakes Recent PH earthquakes min_magnitude, limit, region
get_earthquake_bulletin Full PHIVOLCS bulletin for one event bulletin_url
get_volcano_status Alert level per monitored PH volcano volcano_name
get_weather_forecast 1–10 day forecast (PAGASA or Open-Meteo) location, days
get_active_typhoons Active tropical cyclones in/near PAR
get_weather_alerts Active PAGASA warnings region
search_procurement Keyword search on PhilGEPS notices keyword, agency, region, date_from/to, limit
get_procurement_summary Aggregate procurement stats agency, region, year
get_population_stats 2020 Census population region
get_poverty_stats 2023 Full-Year poverty incidence region
assess_area_risk Multi-hazard profile (parallel PHIVOLCS + PAGASA) location
get_solar_and_climate (v0.2.0) NASA POWER daily solar irradiance + climate variables at any coordinate latitude, longitude, start_date, end_date
get_air_quality (v0.2.0) Real-time air quality for ~80 major PH cities via Open-Meteo location
get_vegetation_index (v0.2.0) MODIS NDVI + EVI vegetation index timeseries at any coordinate latitude, longitude, start_date, end_date
get_usgs_earthquakes_ph (v0.2.0) PH-bbox earthquakes from USGS global network (cross-ref to PHIVOLCS) start_date, end_date, min_magnitude, limit
get_historical_typhoons_ph (v0.2.0) Historical typhoons that passed through the Philippine AOR (IBTrACS) year, limit
get_world_bank_indicator (v0.2.0) Philippine macro indicator from World Bank Open Data (code or friendly alias) indicator, per_page
resolve_ph_location (v0.3.0) Fuzzy-resolve a free-text PH place name to its canonical PSGC record query
list_admin_units (v0.3.0) Browse children of a PSGC node, or top-level regions when parent_code is None parent_code, level, limit
get_location_hierarchy (v0.3.0) Full chain region -> province -> city/municipality for one PSGC code psgc_code
search_infra_projects (v0.3.0) Filter PhilGEPS notices for infra-related work (construction, road, bridge, flood control) keyword, region, province, year, min_cost_php, status, limit
get_infra_project (v0.3.0) Full record for one infra project by project_id project_id
summarize_infra_spending (v0.3.0) Aggregate infra notice stats by category, region, agency region, year, funding_source
flag_infra_anomalies (v0.3.0) Heuristic indicators for further review (high_cost_no_progress, hazard_overlap, duplicate_titles_same_agency) region, province, min_cost_php
get_data_freshness (v0.3.0) Catalog of every upstream source with TTL, freshness, license (none)
get_inflation_stats (v0.4.0) Headline year-on-year CPI inflation, national or regional, latest published month area
get_labor_stats (v0.4.0) PSA Labor Force Survey key rates (LFPR, employment, unemployment, underemployment) region
get_health_indicators (v0.4.0) National health indicators (maternal mortality, total fertility rate, browse-discovered set) indicator
get_area_profile (v0.4.0) One-call auto-stitch: resolved PSGC + demographics + economy + procurement + hazard + weather, per-capita normalized location

Environment variables

Variable Required Notes
PAGASA_API_TOKEN Optional Requires formal PAGASA request. Without it, weather auto-falls-back to Open-Meteo.

No mandatory API keys. The server boots and all 25 tools work without any token.

Data freshness warnings

  • Population: 2020 Census. No later national data exists yet.
  • Poverty: 2023 Full-Year poverty statistics (latest PSA release).
  • Procurement: PhilGEPS open data does not expose filterable search externally. This server scrapes the latest ~100 bid notices and filters client-side. Cached 6h.
  • Emergencies: for real-time disaster response, always check ndrrmc.gov.ph and official PHIVOLCS/PAGASA channels. This server is for research, not life-safety decisions.

Architecture

  • Python 3.11+, fastmcp>=3.0.0,<4.0.0
  • Two HTTP clients: standard + PHIVOLCS_CLIENT with verify=False (PHIVOLCS has a broken SSL cert chain). SSL verification is never disabled globally.
  • In-memory TTL caches per source; no disk writes.
  • stdio transport only (zero hosting cost).
  • PSA table paths are discovered via the PXWeb browse API, never hardcoded.

Development

git clone https://github.com/xmpuspus/ph-civic-data-mcp
cd ph-civic-data-mcp
uv sync --extra dev

# MCP Inspector
fastmcp dev src/ph_civic_data_mcp/server.py

# Tests (run against live APIs)
uv run pytest tests/ -v

# Build
uv run python -m build
uv run twine check dist/*

Limitations

  • PAGASA token is gated. Non-government users may be denied. Open-Meteo fallback removes this as a hard dependency.
  • PhilGEPS is not real-time. Public portal exposes no filterable API; this server operates on the latest ~100 notices with client-side filtering.
  • Emergencies: direct users to official channels; this is a research tool.

What's new in v0.4.0 — PSA economy + the auto-stitch context layer

v0.4.0 does two things: it takes the PSA OpenSTAT layer past population/poverty into the live economy, and it adds the differentiator the project was building toward — a single tool that hands the agent correlated multi-source context in one turn instead of making it orchestrate eight calls.

New PSA economy tools

All three use the same browse-discovery convention as the existing population/poverty tools: only the stable subject path is fixed, the .px table is discovered by text (never a hardcoded id), and the data vintage is read from each table's own time dimension — never from the response timestamp, which is just server wall-clock.

  • get_inflation_stats(area) — headline year-on-year CPI inflation, 2018 base, national or by region. PSA splits long series into era tables with near-identical titles (a backcasted 1958–1994 table sits right next to the current one); the resolver picks the table whose time dimension reaches the most recent year, so you always get the current series. Reports the exact reference period because PSA publishes monthly with a lag.
  • get_labor_stats() — Labor Force Survey key rates: labor-force participation, employment, unemployment, underemployment. National (the PSA key-indicator table has no regional split; a region argument is recorded as an explicit caveat rather than silently ignored).
  • get_health_indicators(indicator) — national health indicators (maternal mortality ratio, total fertility rate) with the full available set browse-discovered, not hardcoded.

The auto-stitch layer: get_area_profile(location)

Name a place once. The tool resolves it to its PSGC code, then fans out in parallel and returns demographics, economy, procurement activity, multi-hazard risk, and the short-range weather outlook in one envelope — and it does the cross-source normalization the agent would otherwise have to do itself (infrastructure notices per 100k residents, each block carrying its own reference period). One round-trip replaces about eight, and the agent never has to know that population keys on region while procurement keys on province and hazard is PHIVOLCS+PAGASA.

The showcase: one question, five sources, a defensible read

v0.4.0 hero

This is a real claude -p --mcp-config turn (tape: docs/demo_v040_hero.tape). One question:

"Which region's recent government infra-notice count per 100k looks least proportionate to its economic need — weigh poverty, regional inflation, and population — and note hazard exposure. Flagged-for-review language only."

The agent calls get_area_profile twice — Eastern Visayas and Central Visayas — each composing PSGC + PSA + PhilGEPS + PHIVOLCS + PAGASA, then reasons across the two. Values are what the live sources returned at capture (2026-05-18):

  • Eastern Visayas: poverty 20.3% (2023), population 4.55M, regional inflation 8.5% (2026 Apr), earthquake risk Low, 0 infra notices in the current PhilGEPS window.
  • Central Visayas: poverty 12.3% (2023), population 8.08M, regional inflation 10.8% (2026 Apr), earthquake risk Low, 0 infra notices.
  • The read it produced: Eastern Visayas warrants closer review as the more underserved of the two — higher poverty against a smaller population, yet the same zero-notice procurement footprint as the wealthier, faster-inflating Central Visayas; comparable (low) hazard exposure, so the flat footprint is not explained by a disaster driver. "An absence that warrants further investigation … not a finding of wrongdoing", with source_url and the public-data disclaimer attached.

That conclusion is impossible from any single feed: it needs census population

  • PSA poverty + PSA regional inflation (the v0.4.0 economic denominator) + PhilGEPS procurement + PHIVOLCS/PAGASA hazard, normalized per capita. The new auto-stitch layer makes the agent's orchestration invisible — one question, one defensible answer.

Per-source demo

v0.4.0 per-source

docs/live_demo_v040.py over the real MCP stdio protocol (tape: docs/demo_v040_sources.tape): national + regional headline inflation, Labor Force Survey rates, national health indicators, and the one-call get_area_profile. Every panel is live tool JSON from the server.

Tests

tests/test_psa_expansion.py (8) and tests/test_autostitch.py (4) — live integration tests mirroring tests/test_phivolcs.py, covering real-figure sanity bands, the national-only labor caveat, graceful unknown-area/unknown -indicator paths, the unresolved-location degradation path, and per-capita arithmetic consistency. The stale v0.3.0 server_version assertion in tests/test_v030_live.py was repinned to the package __version__.

What's new in v0.3.1 — correctness pass on the v0.3.0 accountability layer

Re-recorded demo: "Sta. Mesa, Manila" + "flood control in Pampanga"

accountability demo

One real claude -p --mcp-config call against uvx ph-civic-data-mcp@0.3.1 (live PyPI), exercising the v0.3.1 fixes in a single turn:

  1. resolve_ph_location("Sta. Mesa, Manila") resolves cleanly to PSGC "City of Manila" — the v0.3.0 chain silently failed here because city_to_coords couldn't invert "City of Manila" back to a coordinate. v0.3.1's city_to_coords strips the city of / municipality of prefixes and walks comma-segments.
  2. search_infra_projects(keyword="flood control", province="Pampanga") returns matches via the new _PROVINCE_AGENCY_HINTS map, which expands "Pampanga" to also catch DPWH agency names like "REGION III" / "Central Luzon" / "San Fernando". v0.3.0 returned a false-empty list because the substring filter only checked title + agency, never the regional aliases. The hint map covers all 81 PH provinces plus NCR.
  3. flag_infra_anomalies(province="Pampanga") now emits clean hazard_overlap results because the new _proper_noun_tokens helper requires capitalisation in the source string and applies an explicit stoplist of geographic chrome (city, region, eastern, philippines, ...). v0.3.0 fired on tokens like ['city'] because every alpha word ≥4 chars from earthquake locations went into the keyword set — the README itself had to caveat this in the v0.3.0 demo caption. The apologetic caveat is gone.

Tape: docs/demo_accountability.tape (35s VHS recording, mpdecimate post-process). The gif is the actual frames vhs captured against the live PyPI release.

What changed under the hood

  • get_weather_alerts no longer fabricates advisories. v0.3.0's regex matched alert names ("Heavy Rainfall Warning", "Flood Advisory", "Gale Warning") wherever they appeared on the PAGASA homepage including the navigation menu and breadcrumbs. v0.3.1 returns [] when the page is reachable but the active-warning state is ambiguous, and [] with the explicit "No Active Warnings" signal when the homepage says so. For real-time advisories, hit bagong.pagasa.dost.gov.ph directly.
  • get_volcano_status not-found branch emits source_url + license + caveats for envelope parity with the rest of v0.3.0.
  • Server instructions block now anchors civic-tech framing every turn: agents are instructed to use defensible language ("flagged for review"), never accusations, and to cite source_url for every factual claim.
  • get_data_freshness doubles as health/version probe. Response now includes server_name, transport, and tool_count.
  • urllib3 InsecureRequestWarning suppressed for the dedicated PHIVOLCS client only. Verify-disabled scope is unchanged.

Distribution

  • One-click install badges in the header (Cursor, VS Code, Smithery, Claude Code).
  • Claude Desktop .mcpb bundle attached to the v0.3.1 GitHub release (2.8 MB). Double-click to install. Optional PAGASA token prompted via user_config.
  • .github/workflows/ci.yml runs ruff + tests on every push and PR (Python 3.11 and 3.12).
  • .github/workflows/release-smoke.yml fires on every v*.*.* tag, installs the freshly-published wheel from PyPI in a fresh venv, and asserts that len(tools) >= 25 plus offline regression checks for the v0.3.1 geo fixes.
  • tests/test_v031_fixes.py — 13 new regression tests pinning each fix. 70 tests pass total (57 existing + 13 new).

DPWH portal status (verified 2026-05-02)

The DPWH transparency portal at transparency.dpwh.gov.ph and api.transparency.dpwh.gov.ph is still behind a Cloudflare bot challenge (HTTP 403, "Just a moment..."). PhilGEPS remains the source of record for infra-spending tools; the single integration point in sources/infra.py is unchanged and ready to swap in when DPWH lifts the block.

What's new in v0.3.0 — PH Accountability layer

This release adds three tightly-scoped capabilities for civic accountability work, plus one polish tool.

  1. PSGC backbone (resolve_ph_location / list_admin_units / get_location_hierarchy) — fuzzy free-text place name resolution to the canonical Philippine Standard Geographic Code, full hierarchy walks, and admin-unit browsing. Sourced from the community-mirrored PSA dataset at psgc.gitlab.io.
  2. Infra spending (search_infra_projects / get_infra_project / summarize_infra_spending) — PhilGEPS notices filtered for construction / road / bridge / flood control / drainage / school building / civil works. The DPWH Transparency portal at transparency.dpwh.gov.ph is currently behind Cloudflare's bot challenge and not reachable to non-browser clients, so v0.3.0 sources from the open PhilGEPS listing instead.
  3. Cross-source anomaly indicator (flag_infra_anomalies) — emits heuristic flags for further review by cross-referencing the infra notice window against PHIVOLCS earthquakes (>=M4.0 in last 30d) and active PAGASA typhoon footprints. Three rules: high_cost_no_progress, hazard_overlap, duplicate_titles_same_agency. Every flagged item ships with a "Statistical indicators derived from public data. Patterns may have legitimate explanations." disclaimer.
  4. Polishget_data_freshness returns the catalog of every upstream source with cache TTL, freshness expectation, and license. Every new tool response includes source, source_url, data_retrieved_at, and license.

Per-tool live outputs

Every JSON block below is the actual response from each new tool, captured by running uv run python docs/live_probe_v030.py against live public APIs on the release date. Lists are clipped to fit; full output saved to /tmp/live_probe_v030_output.json.

resolve_ph_location — PSGC fuzzy resolver

Handles common patterns: comma-separated qualifiers ("Sta. Mesa, Manila"), Filipino abbreviations (Sta., Sto., Brgy.), partial names ("Pampanga"), full names.

$ resolve_ph_location(query="Sta. Mesa, Manila")
{
  "psgc_code": "133900000",
  "name": "City of Manila",
  "level": "city",
  "parent_code": "130000000",
  "region_code": "130000000",
  "island_group": "luzon",
  "matched": true,
  "match_score": 0.893,
  "source": "PSGC",
  "source_url": "https://psgc.gitlab.io/api/cities-municipalities/133900000/",
  "license": "Public domain (PSA Philippine Standard Geographic Code)"
}

get_location_hierarchy — full chain region -> province -> city/municipality

$ get_location_hierarchy(psgc_code="072200000")
{
  "psgc_code": "072200000",
  "chain": [
    {
      "psgc_code": "070000000",
      "name": "Central Visayas",
      "level": "region",
      "source_url": "https://psgc.gitlab.io/api/regions/070000000/"
    },
    {
      "psgc_code": "072200000",
      "name": "Cebu",
      "level": "province",
      "source_url": "https://psgc.gitlab.io/api/provinces/072200000/"
    }
  ],
  "source": "PSGC",
  "license": "Public domain (PSA Philippine Standard Geographic Code)"
}

search_infra_projects — PhilGEPS notices, infra-only

$ search_infra_projects(keyword="construction", limit=3)
[
  {
    "project_id": "23164",
    "title": "Construction of Sewage Treatment Plant (STP) in Pasig Bliss Village III ...",
    "agency": "CITY OF PASIG",
    "category": "civil works (other)",
    "cost_php": null,
    "currency": "PHP",
    "status": "Open",
    "date_published": "2026-04-27",
    "source": "PhilGEPS",
    "source_url": "https://www.philgeps.gov.ph/",
    "license": "Public — PhilGEPS open notice listing"
  },
  {
    "project_id": "23319",
    "title": "26C00029 Asset Preservation Program ... Reconstruction Upgrading ...",
    "agency": "DEPARTMENT OF PUBLIC WORKS AND HIGHWAYS - REGION I",
    "category": "road / highway",
    "cost_php": null,
    "status": "Open",
    "source_url": "https://www.philgeps.gov.ph/"
  }
]

summarize_infra_spending — aggregated breakdown

$ summarize_infra_spending()
{
  "total_count": 15,
  "total_value_php": null,
  "by_category": {
    "road / highway": 7,
    "civil works (other)": 6,
    "bridge": 1,
    "school building": 1
  },
  "by_funding_source": {"unknown": 15},
  "reference_period": {"from": "2026-04-27", "to": "2026-04-27"},
  "note": "Computed over the latest infra-keyword-matched PhilGEPS notice window (cached 6h). Approved budget totals are not published in the open notice listing, so total_value_php is typically null.",
  "source": "PhilGEPS",
  "source_url": "https://www.philgeps.gov.ph/",
  "license": "Public — PhilGEPS open notice listing",
  "disclaimer": "Statistical indicators derived from public data. Patterns may have legitimate explanations."
}

flag_infra_anomalies — heuristic indicators across PhilGEPS + PHIVOLCS + PAGASA

$ flag_infra_anomalies(min_cost_php=50_000_000)
{
  "filters": {"region": null, "province": null, "min_cost_php": 50000000},
  "projects_examined": 15,
  "flagged_count": 4,
  "rules_summary": {"hazard_overlap": 4},
  "flagged": [
    {
      "project_id": "23164",
      "title": "Construction of Sewage Treatment Plant (STP) ... Pasig City",
      "agency": "CITY OF PASIG",
      "rule_fired": "hazard_overlap",
      "evidence": "project title overlaps with recent hazard footprint keywords: ['city']",
      "source_url": "https://www.philgeps.gov.ph/"
    }
  ],
  "hazard_inputs": {"recent_earthquake_count_30d": 0, "active_typhoon_count": 0},
  "source": "PhilGEPS + PHIVOLCS + PAGASA",
  "source_url": "https://www.philgeps.gov.ph/, https://earthquake.phivolcs.dost.gov.ph/, https://bagong.pagasa.dost.gov.ph/",
  "license": "Public — PhilGEPS, PHIVOLCS, PAGASA notice and bulletin pages",
  "disclaimer": "Statistical indicators derived from public data. Patterns may have legitimate explanations."
}

Each flag is a heuristic indicator, not an accusation. The hazard_overlap rule simply says the project title shares keywords with a recent hazard footprint; the project may be entirely legitimate post-disaster reconstruction. Treat output as a starting point for further investigation, not as evidence of wrongdoing.

get_data_freshness — TTL and license catalog

$ get_data_freshness()
{
  "server_version": "0.3.0",
  "asof": "2026-04-27T00:09:21+00:00",
  "sources": [
    {"source": "PSGC", "source_url": "https://psgc.gitlab.io/api/", "freshness": "Updated when PSA publishes new PSGC version (annual or quarterly)", "cache_ttl_seconds": 86400, "license": "Public domain (PSA Philippine Standard Geographic Code)"},
    {"source": "PHIVOLCS earthquakes", "source_url": "https://earthquake.phivolcs.dost.gov.ph/", "freshness": "5-minute table refresh; bulletins published per event", "cache_ttl_seconds": 300, "license": "Public — PHIVOLCS public bulletin pages"}
  ]
}

What's new in v0.2.0 — six new no-auth sources

Correlation demo: "Why is Metro Manila so hot right now?"

correlation demo

One unscripted claude -p --mcp-config call, real MCP stdio transport, live upstream APIs. Claude picks three sources out of the 17 tools — PAGASA/Open-Meteo 7-day forecast (v0.1.x), NASA POWER solar irradiance (v0.2.0, new), and Open-Meteo Air Quality (v0.2.0, new) — then correlates them into a three-sentence answer. The numbers in the response (6.8–7.3 kWh/m²/day irradiance, 30.3–31.8°C daytime temps, PM2.5 24.8 µg/m³, US AQI 91) are exactly what the live endpoints returned at the moment of recording. Tape: docs/demo_correlation.tape.

Per-tool live outputs

Every JSON block below is the actual response from each tool, captured by running uv run python docs/live_probe_v020.py against live public APIs on the release date. No placeholders, no truncation tricks — lists were clipped to fit.

get_solar_and_climate — NASA POWER

Daily solar irradiance + climate at any coordinate. Useful for PV siting and agricultural modeling.

$ get_solar_and_climate(latitude=14.5995, longitude=120.9842,
                        start_date="2026-04-01", end_date="2026-04-07")
{
  "latitude": 14.5995,
  "longitude": 120.9842,
  "start_date": "2026-04-01",
  "end_date": "2026-04-07",
  "days": [
    {"date": "2026-04-01", "solar_irradiance_kwh_m2": 6.79, "temp_c": 25.4, "precipitation_mm": 0.11, "windspeed_ms": 2.11},
    {"date": "2026-04-02", "solar_irradiance_kwh_m2": 7.18, "temp_c": 24.9, "precipitation_mm": 0.01, "windspeed_ms": 2.45},
    {"date": "2026-04-03", "solar_irradiance_kwh_m2": 7.13, "temp_c": 25.3, "precipitation_mm": 0.17, "windspeed_ms": 2.23}
  ],
  "source": "NASA POWER",
  "data_retrieved_at": "2026-04-20T00:12:13Z"
}

get_air_quality — Open-Meteo Air Quality

Fills the gap that AQICN left when it was removed in v0.1.8. No auth, reliable PH coverage.

$ get_air_quality(location="Manila")
{
  "location": "Manila",
  "latitude": 14.5995,
  "longitude": 120.9842,
  "measured_at": "2026-04-20T08:00:00Z",
  "pm2_5": 24.8,
  "pm10": 34.3,
  "carbon_monoxide": 521.0,
  "nitrogen_dioxide": 11.6,
  "sulphur_dioxide": 15.5,
  "ozone": 81.0,
  "european_aqi": 65,
  "us_aqi": 91,
  "aqi_category": "Moderate",
  "source": "Open-Meteo Air Quality",
  "data_retrieved_at": "2026-04-20T00:12:13Z"
}

get_vegetation_index — NASA MODIS via ORNL DAAC

NDVI + EVI at 250m, 16-day composites. MOD13Q1 product. Useful for monitoring crops, droughts, and deforestation. Here — a rice-bowl pixel in Nueva Ecija going through the growing cycle:

$ get_vegetation_index(latitude=15.58, longitude=121.0,
                       start_date="2026-01-01", end_date="2026-04-18")
{
  "latitude": 15.58,
  "longitude": 121.0,
  "product": "MOD13Q1",
  "band": "NDVI+EVI (250m, 16-day composite)",
  "samples": [
    {"composite_date": "2026-01-01", "ndvi": 0.708, "evi": 0.343},
    {"composite_date": "2026-01-17", "ndvi": 0.856, "evi": 0.582},
    {"composite_date": "2026-02-02", "ndvi": 0.898, "evi": 0.703}
  ],
  "source": "NASA MODIS via ORNL DAAC",
  "data_retrieved_at": "2026-04-20T00:12:17Z"
}

get_usgs_earthquakes_ph — USGS FDSN

Global-network seismic catalogue, filtered to the PH bounding box. Useful for cross-validating PHIVOLCS local magnitudes against USGS Mww/Mwc solutions.

$ get_usgs_earthquakes_ph(min_magnitude=5.0, limit=10)
[
  {
    "datetime_utc": "2026-04-06T07:22:42Z",
    "magnitude": 5.2,
    "magnitude_type": "mww",
    "depth_km": 10.0,
    "latitude": 10.8435,
    "longitude": 123.8752,
    "place": "0 km S of Tabonok, Philippines",
    "usgs_event_id": "us6000sn00",
    "felt_reports": 37,
    "tsunami": false,
    "url": "https://earthquake.usgs.gov/earthquakes/eventpage/us6000sn00",
    "source": "USGS FDSN"
  },
  {
    "datetime_utc": "2026-04-04T10:34:28Z",
    "magnitude": 6.0,
    "magnitude_type": "mww",
    "depth_km": 67.0,
    "latitude": 4.8733,
    "longitude": 126.1392,
    "place": "95 km SE of Sarangani, Philippines",
    "usgs_event_id": "us6000smj4",
    "tsunami": false,
    "url": "https://earthquake.usgs.gov/earthquakes/eventpage/us6000smj4",
    "source": "USGS FDSN"
  }
]

get_historical_typhoons_ph — NOAA IBTrACS

Every typhoon that has passed through the Philippine Area of Responsibility, from the authoritative IBTrACS track archive. Aggregates track points per storm, falls back across agency wind/pressure solutions (WMO → JTWC → JMA) to populate peak intensity.

$ get_historical_typhoons_ph(limit=3)
[
  {
    "sid": "2025329N10124",
    "name": "KOTO",
    "season": 2025,
    "basin": "WP",
    "max_wind_kt": 80.0,
    "min_pressure_mb": 975.0,
    "start_time_utc": "2025-11-24T18:00:00Z",
    "end_time_utc": "2025-12-03T00:00:00Z",
    "track_points": 67,
    "passed_within_par": true,
    "source": "NOAA IBTrACS"
  },
  {
    "sid": "2025308N10143",
    "name": "FUNG-WONG",
    "season": 2025,
    "basin": "WP",
    "max_wind_kt": 115.0,
    "min_pressure_mb": 943.0,
    "track_points": 75,
    "passed_within_par": true,
    "source": "NOAA IBTrACS"
  },
  {
    "sid": "2025305N10138",
    "name": "KALMAEGI",
    "season": 2025,
    "basin": "WP",
    "max_wind_kt": 115.0,
    "min_pressure_mb": 948.0,
    "track_points": 43,
    "passed_within_par": true,
    "source": "NOAA IBTrACS"
  }
]

get_world_bank_indicator — World Bank Open Data

Any World Bank indicator for the Philippines. Accepts the canonical WB code (e.g. NY.GDP.MKTP.CD) or a friendly alias from a curated list (gdp, gdp_per_capita, poverty_ratio, inflation, urban_population_pct, internet_users_pct, gini, tax_revenue_pct_gdp, etc. — 25 aliases in total).

$ get_world_bank_indicator(indicator="gdp", per_page=10)
{
  "indicator_id": "NY.GDP.MKTP.CD",
  "indicator_name": "GDP (current US$)",
  "country": "Philippines",
  "country_iso3": "PHL",
  "observations": [
    {"year": 2024, "value": 461617509782.36, "unit": ""},
    {"year": 2023, "value": 437055627244.42, "unit": ""},
    {"year": 2022, "value": 404353369604.63, "unit": ""}
  ],
  "source": "World Bank Open Data"
}

Changelog

Full detail in CHANGELOG.md (Keep a Changelog format). Version summary:

Version Date Highlights
0.4.0 2026-05-18 PSA economy expansion (get_inflation_stats regional CPI, get_labor_stats LFS rates, get_health_indicators) + the auto-stitch get_area_profile one-call cross-source context layer with per-capita normalization. 25 → 29 tools. Browse-discovery preserved (no hardcoded .px); per-table vintage.
0.3.1 2026-05-01 Correctness pass: no fabricated PAGASA advisories, stoplisted hazard tokens, "City of Manila" coordinate bridge, province/agency-alias infra search.
0.3.0 2026-04-27 PH Accountability layer: PSGC resolver, infra spending search, cross-source anomaly indicators. 17 → 25 tools.
0.2.0 2026-04-19 Six no-auth scientific/open-data sources (NASA POWER, Open-Meteo AQ, MODIS, USGS, IBTrACS, World Bank). 11 → 17 tools.
0.1.x Initial release: PHIVOLCS, PAGASA, PhilGEPS, PSA. 11 tools.

Per-version detail is also inlined above under each What's new in vX.Y.Z section.

Roadmap

Requires deeper reverse-engineering than this release — shipped separately when ready:

  • get_active_disasters / get_situational_report via NDRRMC monitoring dashboard (intermittent availability)
  • assess_hazard(lat, lng) via HazardHunterPH — the top-level GeoRisk ArcGIS catalog is public, but the individual PHIVOLCS/MGB hazard layers (flood, landslide, liquefaction) return "code": 499, "message": "Token Required". Needs a different integration strategy
  • get_flood_layers(lat, lng) via Project NOAH — current site is an Angular SPA whose XHR surface needs browser-level capture. Deferred
  • DPWH Transparency portal direct integration — transparency.dpwh.gov.ph and api.transparency.dpwh.gov.ph currently sit behind a Cloudflare bot challenge that returns 403 to every non-browser client regardless of User-Agent. v0.3.0 sidesteps this by sourcing infra notices from the open PhilGEPS listing instead; if/when DPWH lifts the block, sources/infra.py is the single integration point to swap in.

Prior art

Other Philippine civic-data MCP servers, each single-dataset:

Non-MCP libraries that inspired this project:

ph-civic-data-mcp is the first MCP that unifies multiple Philippine civic-data sources (PHIVOLCS, PAGASA, PhilGEPS, PSA) behind one interface, and the first to expose hazards, weather, procurement, statistical data, solar/climate, air quality, satellite vegetation indices, and macro indicators (v0.2.0) as MCP tools. Credit to all of the above.

License

MIT. Xavier Puspus. Not affiliated with PHIVOLCS, PAGASA, PhilGEPS, or PSA.

Contributing

Issues and PRs welcome at github.com/xmpuspus/ph-civic-data-mcp.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ph_civic_data_mcp-0.4.0.tar.gz (4.9 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ph_civic_data_mcp-0.4.0-py3-none-any.whl (82.6 kB view details)

Uploaded Python 3

File details

Details for the file ph_civic_data_mcp-0.4.0.tar.gz.

File metadata

  • Download URL: ph_civic_data_mcp-0.4.0.tar.gz
  • Upload date:
  • Size: 4.9 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.6

File hashes

Hashes for ph_civic_data_mcp-0.4.0.tar.gz
Algorithm Hash digest
SHA256 e8c263ded3ae45bf07bf84f364d1d9ae7abdc866f79f2ae0a8302ae0d0c5a2e9
MD5 db8a630c6d68d8730b36de58a4f31b86
BLAKE2b-256 d35a42073e545703d773ac9846657593cbbd5ec2cba0721369d7267f3422294e

See more details on using hashes here.

File details

Details for the file ph_civic_data_mcp-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ph_civic_data_mcp-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f9895ca2f18fcc19b67831fad75dc4450a468e25c1525597c49fc118a8bc77b7
MD5 5ca085fe6677f442a3c4d3f4a38fbd0c
BLAKE2b-256 4c4ff2648e35b13ac421f4e9bb47462cc978a6094ba15c1da17f48b10fb4bf21

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page