AWS Builder Center
Maps that talk back: serving interactive maps from an MCP App

Maps that talk back: serving interactive maps from an MCP App

An MCP App answers a plain-language geospatial question with a live, interactive map in the chat — explorable, auditable, and serverless on AWS.

Most MCP servers hand the model text or JSON. The agent reads it, maybe summarizes it, and the richest thing the user sees is a table the model retyped into chat. That's fine for a lot of tools. It's a poor fit for a question like:
What part of the Mesa Verde formation in the San Juan basin has the highest gas production rates?
That's a map-shaped question. The honest answer is the basin, shaded by how much gas each area makes, so the eye lands on the sweet spot. A standard text-returning MCP tool can't give you that — but an MCP App can. This post shows a mapping server that answers spatial questions with a live, interactive map rendered right in the chat, and explains why that's a better pattern than a plain MCP tool for this kind of work — and how it's built.

Ask the question, get a map

The user types the question verbatim — no SQL, no tool names, no column hints. The agent figures out the data, writes the query, and calls the server's  plot_surface  tool. The server runs the query in its own process, bins the wells into ~3 km cells, colors each cell by its average gas rate, and returns an interactive map — which the host drops straight into the conversation:
A LibreChat conversation. The user's message reads "What part of the Mesa Verde formation in the San Juan basin has the highest gas production rates?" The agent runs describe_catalog, notes the data is in the upstream database and that the formation is the pool 'BLANCO-MESAVERDE (PRORATED GAS)', then runs plot_surface. Below is an A4E "Operations map" (header: 1 layers · 577 cells): a smooth, tiling blue surface over the San Juan basin (Farmington, Aztec, Bloomfield, Dulce, Jicarilla Apache Nation labelled), darkest — highest average gas rate — across a north-central band and fading pale toward the margins, with a hover tooltip on one cell and the exact join SQL in a provenance panel.

The answer is immediate: a dark, high-rate fairway runs across the north-central basin, fading pale toward the margins. And because it's a real map widget — not a picture — the user can pan, zoom, and hover any area to read its value and well count:
Close-up of the operations-map widget: a seamless grid of filled cells shaded light→dark on a quantile "avg_gas_rate_mcfd" ramp (0.4–49.6 up to 123–372 MCF/d/well). The darkest cells cluster in the north-central basin around Rosa Mesa / north of Aztec; cells thin and pale toward the southern and south-eastern edges.


Why an MCP App beats a plain MCP tool here

The difference isn't cosmetic — it changes what the user can do with the answer.
  • Plain language in, a map out. No SQL, no column names, no tool-picking. The engineer asks a sentence and gets something they can read at a glance, not a result set to interpret.
  • It's explorable, not static. A text tool (or even a server that returns a rendered PNG) gives a dead artifact. The MCP App returns a real map: pan, zoom, hover a cell for its exact value and well count, toggle layers.
  • The model picks the right picture. Ask "which area is highest" and the server renders an averaged surface — a value-per-area view — rather than a dot-density blob. Choosing the right cartography is part of answering honestly, and the pack owns that decision so the user doesn't have to.
  • Every answer is auditable. The exact SQL, row count, and bytes scanned sit in a panel under the map, so a skeptical engineer can verify the number behind a decision. The map is not a black box.
  • It stays in the flow. The map lives inside the chat the user already has open, and the model stays in the loop to drive the next question.
A standard MCP server could return the 8,124 rows as JSON and let the client figure out rendering — but then every host needs its own charting, the user gets nothing until someone builds that, and the "answer" is still a table. The MCP App ships the visualization with the data.

How it works

Three pieces, all standard MCP:
  1. The map is a first-class resource the server owns. Via the MCP Apps extension ( io.modelcontextprotocol/ui ), the server ships a self-contained interactive map bundle that the host renders in a sandboxed iframe. Each tool —  plot_surface ,  plot_well_sites ,  add_heatmap_layer ,  describe_map  — mutates one conversation-scoped map (adds a layer, refits the view) and returns the whole  MapState , bound to that App. Layers accumulate; the state is persisted and addressable by a  maps://…  URI, so the map can be re-opened without re-querying.
  1. The server runs the analytics itself. It queries the data lake directly (Athena/Glue over existing S3 data — no copy, no new warehouse) and turns rows into map features in one step. A short data brief the server ships as MCP  instructions , plus a  describe_catalog  tool, teach the agent the schema and conventions — e.g. that the San Juan Mesa Verde is the  BLANCO-MESAVERDE  pool — so plain-language questions resolve to the right query without the user spelling anything out.
  1. It's host-agnostic and serverless. The server runs on AWS Lambda behind a streaming API Gateway endpoint with single sign-on via Cognito, and the same server renders in any MCP-Apps-capable host — the chat client shown here, or Claude.ai / Claude Desktop connectors — with one login.
Notably, the mapping server doesn't call the analytics server over the wire to get its data. MCP has no server-to-server primitive, and reaching across would add a network hop and a second identity for no gain; instead the query engine is a shared library both packs run in-process. Composition, when you want it, is the host orchestrating tools — not servers phoning each other.

Why it matters

Returning a table — or a flat PNG — would have been easier, and dead. By treating the map as an owned, provenance-stamped resource and shipping it as an MCP App, the server turns "which part of the Mesa Verde has the best gas?" into something an engineer can actually explore, while the model stays in the loop.
The pattern generalizes well past gas wells. Any domain whose answer is spatial or otherwise visual — reservoir quality, pipeline throughput, emissions intensity, fleet telemetry — is a candidate: a server that owns a rich UI resource, tools that mutate and return it, provenance baked in, and the analytics run right where the data lives. If your tool's answer is a picture, serve the picture — interactively — as an MCP App.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article