Inspiration

Nearcast began as a Canadian iPhone app that pulls official hazard data. Hazard maps are exactly the kind of interface generic browser agents struggle with: hundreds of clustered markers, a dozen filter combinations, geographic bounds, a selection, and six agencies' worth of heterogeneous records. WebMCP lets the page say what it can do instead of making the agent infer it from the DOM.

What it does

Nearcast WebMCP shows current wildfires, weather alerts and earthquakes across Canada and the United States on one MapLibre map, normalized from six official sources (ECCC, NRCan CWFIS, Earthquakes Canada, NWS, NIFC, USGS) with explicit attribution and freshness. Every source fails independently; if a feed is down the app says so and keeps working.

It exposes eight WebMCP tools that read and mutate the same application state the human is looking at:

  • get_current_view — map bounds, zoom, filters, selected hazard, counts, source freshness
  • get_visible_hazards — concise list of what is on screen after all filters
  • set_focus_area — move the map to regions (["BC","WA"]), bounds, or a point
  • set_hazard_filters — countries, hazard types, minimum weather severity, minimum magnitude
  • focus_hazard — select a hazard exactly like a human click (highlight, pan, details panel)
  • get_hazard_details — full record with agency classifications and the official link
  • compare_regions — deterministic counts for provinces/states
  • create_situation_context — structured facts for an area; the agent writes the prose

An Agent Activity panel logs every tool call, so people can see what the agent did.

Why WebMCP fits this use case

Map applications hold large amounts of visual state. Screen-scraping and clicking is brittle and slow. WebMCP gives the agent typed, described operations while keeping human and agent in the same visible workspace: the human zooms and clicks, the agent reads that through get_current_view, changes filters or focus, and the human sees it happen and refines by hand.

Better UX

Instead of manually toggling countries, filtering hazard types and scanning hundreds of markers, the user says "Focus on British Columbia and Washington and show only wildfires and important weather alerts" — and still sees and controls the resulting map. Verified live in the ChatGPT desktop app's built-in browser with GPT-5.6.

What humans and agents do together

  • Human: explores visually, selects incidents, validates context, controls decisions.
  • Agent: manipulates filters, compares regions, retrieves structured details, surfaces relevant information, writes the narrative.
  • Application: authoritative normalized data, deterministic geographic calculations and counts, visual state — and never a "you are safe" claim.

How we built it

React + TypeScript + Vite + MapLibre GL (OpenFreeMap basemap, no tokens). One TypeScript Lambda behind API Gateway HTTP API with six source adapters (Promise.allSettled, per-source timeouts, stale-snapshot fallback), a shared hazard model, and severity translation kept alongside raw agency classifications. CloudFront serves the SPA from a private S3 bucket (OAC) and routes /api/* to API Gateway so everything is same-origin; Terraform provisions all of it. Tools are registered with document.modelContext.registerTool() and wrap the app's own store actions — the same functions a click uses. No AI API keys anywhere: WebMCP is the AI integration.

Challenges

  • Government feeds are inconsistent: CWFIS's national fire layer is temporal (189k rows; only rows whose validity window includes "now" are current), most NWS alerts have no polygon (placed at Census county centroids and flagged approximate), Earthquakes Canada is pipe-delimited text.
  • Keeping severity honest: earthquakes and US wildfires have no agency severity, so we expose magnitude/hectares plus a clearly labelled display significance instead of inventing one.
  • Demo robustness: per-source failure handling, stale snapshots, and a clearly labelled demo-data mode.

Accomplishments

Live cross-border six-source hazard workspace; eight well-described tools; shared state proven by get_current_view reflecting manual pans and clicks; 44 unit tests; reproducible Terraform deployment; verified end-to-end in ChatGPT's built-in browser.

What we learned

Tool descriptions and strict schemas matter more than tool count. Deterministic, structured outputs (counts, ids, source status) let the agent explain without hallucinating, and a visible activity log makes the collaboration legible to people.

What's next

Evacuation orders (BC first), air quality, time-windowed regional summaries, and Chrome origin-trial enrollment.

Safety

Nearcast is an awareness tool, not an emergency service. It always shows the issuing agency, timestamps and the official link, and reminds users to follow local emergency authorities.

Built With

Share this project:

Updates

Submission history