MapSmith
Professional-grade geoprocessing for AI agents — with provenance you can verify.
MapSmith is an open-source MCP server that gives an AI agent real GIS analysis — buffers, overlays, reprojections, zonal statistics, terrain and hydrology — executed by GeoPandas, DuckDB Spatial, exactextract and Whitebox Workflows, never written by the model. Every dataset it produces lands on disk next to a lineage manifest: inputs with checksums, the exact parameters, the CRS decisions and why, engine versions, and the deterministic checks that ran on the result.
Ask for the result. The agent picks the tools. You can check the work afterwards.
Evidence before promises: an A/B on GABench whose headline is a null result — with the analysis that took our own positive number apart — notebooks on a real USGS DEM of Mount St. Helens, and an in-chat map panel that shows the verification status of every layer it draws.
Quickstart
Add MapSmith to any MCP client over stdio (Claude Desktop, Claude Code, Cursor, VS Code):
{
"mcpServers": {
"mapsmith": {
"command": "uvx",
"args": ["mapsmith"]
}
}
}
Docker is the supported path, and confines the server to the directory you mount:
{
"mcpServers": {
"mapsmith": {
"command": "docker",
"args": ["run", "-i", "--rm",
"-v", "/absolute/path/to/your/data:/data",
"-e", "MAPSMITH_WORKSPACE=/data",
"ghcr.io/mapsmith-ai/mapsmith"]
}
}
}
One-click installs:
or from a terminal: code --add-mcp '{"name":"mapsmith","command":"uvx","args":["mapsmith"]}'
To check it runs before wiring a client, uvx mapsmith starts the server on stdio
(Ctrl-C to quit) — it speaks MCP, not a CLI, so a silent prompt means it is working.
Then ask your agent things like:
"Take parcels.gpkg, keep only the parcels within 300 m of the river in rivers.gpkg, and give me the result with the analysis lineage."
The Docker image includes the [raster] and [whitebox] extras. With uvx, pick your
own: uvx --from "mapsmith[raster,whitebox]" mapsmith. Docker — or uvx on a machine
with working wheels — is the only supported installation path: geospatial native
dependencies across three OSes are a support black hole, and issues about broken local
environments will be redirected here.
What you get back
Every dataset comes with the file below, written next to it as
<output>.provenance.json — enough to re-run the analysis without the model that asked
for it:
{
"mapsmith_version": "0.2.1",
"operation": "buffer_layer",
"parameters": {"distance_meters": 300.0},
"inputs": [{"path": "rivers.gpkg", "sha256": "9f2c…", "crs": "EPSG:4326"}],
"crs_decisions": {"analysis_crs": "EPSG:32632", "reason": "estimated UTM zone for metric buffering"},
"engine": {"name": "geopandas", "version": "1.0.1"},
"started_at": "2026-08-18T10:15:03Z",
"finished_at": "2026-08-18T10:15:04Z"
}
The full manifest also carries the verification checks that ran, and any geometry MapSmith
had to repair. get_provenance returns it for any output.
Why MapSmith
- Real geoprocessing, not map CRUD. Built on the proven open geospatial stack: GDAL, GeoPandas, Shapely, DuckDB Spatial, Whitebox Workflows and exactextract ship today (more to come: PDAL, QGIS Processing via sidecar).
- Provenance by design. Every layer MapSmith produces ships with a machine-readable lineage manifest — source datasets with checksums, tools executed, exact parameters, CRS decisions, software versions, timestamps. Everything needed to re-run the analysis without the LLM is in there. No AI slop.
- The engines compute, the model orchestrates. Geometry and numbers only ever come from deterministic tool executions — never from model output.
- Semantic tools, not a tool dump. 16 goal-level tools plus a searchable operation catalog (progressive discovery), because agent accuracy collapses when you expose hundreds of raw tools.
- Model-agnostic infrastructure. Claude, GPT, Qwen, Kimi, GLM — anything that speaks MCP, cloud or local. The leverage is better contracts (typed plans, actionable error codes, a searchable catalog), not weights we would have to maintain. See the manifesto.
Tools
| Tool | What it does |
|---|---|
describe_dataset |
CRS, geometry types, schema, extent, feature count of any vector dataset |
buffer_layer |
Metric buffer with automatic UTM estimation for geographic CRS |
clip_layer |
Clip a layer with a mask layer |
reproject_layer |
Reproject to any CRS (EPSG code or WKT) |
spatial_join |
Join by spatial predicate, auto-routed to the fastest engine (SedonaDB > DuckDB > GeoPandas) |
run_sql |
Spatial SQL (DuckDB dialect) over GeoParquet and GDAL formats |
zonal_statistics |
Raster statistics per vector zone with exact fractional pixel coverage ([raster] extra) |
hillshade |
Shaded relief from a DEM, in-memory Whitebox engine ([whitebox] extra) |
flow_accumulation |
D8 flow accumulation with automatic depression filling ([whitebox] extra) |
watershed |
Watershed delineation from a DEM and pour points ([whitebox] extra) |
preview_map |
Interactive in-chat map (MCP Apps) of any datasets, with a provenance card and verification status per layer |
validate_plan |
Statically validate a multi-step plan before running anything: operations, arguments, references, input files, simulated CRS flow |
execute_plan |
Validate then run a plan step by step, with per-step provenance and a plan-level manifest |
get_provenance |
Return the full lineage manifest of any MapSmith output |
list_operations |
BM25-ranked catalog search; detail=true returns parameters and worked examples |
server_info |
Version, license, available engines |
Verification, in and out
Every tool that writes a dataset also writes <output>.provenance.json beside it and
verifies its own work — CRS agreement, geometry validity, raster dimensions, count and
extent invariants — recording the results in the manifest before raising anything, so
the audit trail survives the error.
Verification runs on the way in as well. Before an operation touches your data, MapSmith checks the failures that produce plausible junk: an input with no CRS is refused outright, because metric maths on unknown units is how a confidently wrong answer gets made; an empty input, or two layers whose extents cannot possibly overlap, comes back as a named warning with a hint — in the tool result, not only in the manifest, so the agent sees it instead of assuming success. (The join fast paths, DuckDB and SedonaDB, only ever receive inputs that already share a known CRS; they verify their output and diagnose an empty join.)
An output whose geometry is mechanically broken — typically invalidity inherited from an
invalid input — is repaired deterministically: make_valid, at most two rounds, written
to a temporary file and swapped in only once it is complete, and skipped rather than
risked where a rewrite could drop data (a multi-layer GeoPackage is refused, not
rewritten). Every attempt lands in the manifest and in the tool result, because a
repaired output must never look like one that was right the first time. Failures that need
judgement are never "fixed": an empty result, or geometries eroded away by a wrong
distance, come back as warnings with hints for the agent to act on.
See results inside the chat
preview_map renders your layers on an interactive map panel inside the chat — pan,
zoom, toggle layers, and read each layer's provenance card (operation, engine, and one of
three honest states: verified ✓, verification failed, or not verifiable when no
critical check ran) right next to the geometry it explains. Field-tested on Claude
Desktop; it renders in any client that implements the official
MCP Apps extension, and on
clients without it the same call returns the preview as structured data.
The panel is self-contained — no CDN, no bundled libraries, no telemetry — with one outbound request named here rather than buried: the OpenStreetMap background tiles, which reveal the map view you are looking at (never your data) and which the panel drops to a plain backdrop when the host blocks them. The preview is deliberately lossy (simplified geometry, capped feature counts): the dataset of record stays on disk with its manifest.
Plans: reject wrong analyses before they run
In GISAgentBench — 349 practitioner-sourced tasks over 128 GIS APIs — the best frontier agent completes 32.7% of tasks under strict scoring, and planning defects dominate the failures: missing operations in 28.3% of failed runs and wrong operation order in 18.4% (multi-label, so up to ~47% involve a planning mistake), against 7.8% for parameter errors. MapSmith attacks this where it is cheapest: the agent submits a typed plan, and static validation rejects unknown operations (with suggestions), missing arguments, forward references, absent input files and CRS-unsuitable steps before anything executes — with machine-actionable error codes the agent can repair.
{
"goal": "buildings within 300 m of rivers",
"steps": [
{"id": "buf", "operation": "buffer_layer",
"arguments": {"input_path": "rivers.gpkg", "distance_meters": 300,
"output_path": "rivers_300m.parquet"}},
{"id": "cut", "operation": "clip_layer",
"arguments": {"input_path": "buildings.parquet", "mask_path": "$buf",
"output_path": "at_risk.parquet"}}
]
}
"$buf" consumes the output of step buf; references may only point backwards, so plans
are acyclic by construction. validate_plan also simulates the CRS of every intermediate
dataset from the real input files. execute_plan then runs the chain with per-step
provenance plus a plan-level manifest (<output>.plan.json) fingerprinting the exact plan
that produced the result.
Confinement
UNC hosts and NTFS alternate data streams are refused in every path argument of every
tool call, before anything touches the filesystem (on Windows even an existence check on a
UNC path talks to an attacker-chosen host). Remote and virtual forms — GDAL /vsi*,
https:// COGs — stay available while the server is unconfined, because cloud-native data
is a feature, and are refused once a workspace is set. Validated plans are stricter by
design and reject every non-local form.
Set MAPSMITH_WORKSPACE=/data to confine the server to one directory:
- every path argument of every tool must resolve inside the workspace (checked at the MCP boundary, and again by plan validation with stable error codes);
- the
run_sqlDuckDB connection is sandboxed in the engine itself, because SQL text is out of reach of a textual path check: filesystem whitelisted to the workspace (allowed_directories+ external access off, which also covers GDAL-backedST_Read), extension install and load refused, memory and temp disk capped (MAPSMITH_DUCKDB_MEMORY, default 4GB;MAPSMITH_DUCKDB_TEMP_LIMIT, default 8GB), configuration locked. SQL can name any path it likes; the engine refuses to open it.
Without a workspace, file access is deliberately unconfined — fine for a local stdio
server on your own files — and plan validation flags run_sql steps with a
SQL_NOT_SANDBOXED warning. Code execution is still closed: extension autoloading and
community extensions are off (shellfs turns a filename into a shell command), unsigned
extensions are refused, DuckDB's HTTP and S3 filesystems are disabled, and the
configuration is locked, so untrusted SQL cannot turn file access into code execution.
The network is not closed in that mode, by the same decision that keeps cloud-native
data working: GDAL carries its own HTTP client, so ST_Read('/vsicurl/https://…') in raw
SQL reads whatever the host can reach — internal services and link-local metadata
endpoints included — and the URL is chosen by whoever wrote the SQL, so it can also carry a
string out. Setting MAPSMITH_WORKSPACE closes all of it, GDAL included, and the test
suite asserts both halves (tests/test_duckdb_sandbox.py). If your run_sql input is not
trusted and your host sits somewhere interesting, set a workspace. The full threat model —
and what is explicitly not covered — is in SECURITY.md.
Fine print, because it changes how you deploy this: the path jail assumes a single trusted
writer of the workspace filesystem (paths are resolved at check time, so a symlink swap by
another local process is out of scope); the DuckDB spatial extension is fetched once per
environment, so on air-gapped machines pre-install it (python -c "import duckdb; duckdb.connect().install_extension('spatial')") before locking the network down; and the
HTTP transport has no authentication in this release, so keep it on loopback or a trusted
network. For real isolation, run the container and mount only the data you want it to see.
We measured whether this actually helps
Claims about agent performance are cheap, so docs/benchmarks.md reports an A/B on GABench — 57 executable GIS tasks over a 133-tool server, scored by its deterministic evaluator — where the only variable is whether the agent's typed plan is validated before the solver runs.
The honest headline is a null result, on a frontier model and on a small one, and the interesting part is why:
| Arm A (no gate) | Arm B (gate) | |
|---|---|---|
| Sonnet 5 — TAO / PEA | 0.824 / 0.430 | 0.781 / 0.425 |
| Haiku 4.5 — TAO / PEA | 0.660 / 0.320 | 0.714 / 0.366 |
Haiku looks like a clean win until you notice the gate only fired on 4 of 57 plans, and that the 53 tasks it never touched moved by just as much: the aggregate delta is run-to-run variance, and measuring that noise floor (2–5 points per metric on a single repetition) is the reusable result. What survives is narrower — on the plans it did repair, tool selection improved by +0.19 TAO — and it points at where the failures actually are: PEA around 0.4 in every arm, i.e. wrong parameters and missing outputs at execution time, which is why MapSmith enforces its plans at the execution boundary and verifies inputs and outputs at runtime rather than advising an agent that improvises.
The harness is in benchmarks/gabench-ab/, including
the split_analysis.py that took our own win apart.
Notebook gallery
Three executable walkthroughs in examples/: verified buffer+clip with
provenance manifests, terrain and hydrology on a real 520×520 USGS DEM of Mount St.
Helens, and a deliberately wrong plan rejected before execution and then repaired. The
terrain notebook also shows what happens when reality bites: that DEM is stored with the
standard TIFF predictor, which Whitebox Workflows 2.x does not undo when reading
(upstream report), so MapSmith
detects it, converts the input first, and discloses the workaround in the manifest.
Architecture
AI agent (Claude / ChatGPT / Copilot / your app)
│ MCP (stdio local · Streamable HTTP remote)
▼
┌─────────────────────────────────────────────┐
│ MapSmith server │
│ · semantic tools + operation catalog │
│ · parameter validation, CRS discipline │
│ · provenance recorder (lineage manifests) │
├─────────────────────────────────────────────┤
│ Engines │
│ · vector: GeoPandas/Shapely (built-in) │
│ · SQL/analytics: DuckDB Spatial (built-in) │
│ · heavy joins: SedonaDB ([sedona] extra) │
│ · zonal stats: exactextract ([raster]) │
│ · terrain/hydro: Whitebox NG ([whitebox]) │
│ · qgis_process / GRASS sidecar (roadmap, │
│ GPL-isolated via subprocess) │
└─────────────────────────────────────────────┘
When not to use MapSmith
- You need an authenticated remote server today. The Streamable HTTP transport has no authentication in this release: anyone who can reach the endpoint can run every tool against everything the process can see. Loopback or a trusted network only (SECURITY.md).
- You want a sandbox for arbitrary agent code. MapSmith confines paths and the SQL engine; there is no code-execution tool yet, and a path jail is not a container.
- You need cartography. No styling, no layouts, no print composer. Outputs are datasets, plus a lossy read-only preview panel — not maps you publish.
- Your data lives in a database. MapSmith reads and writes files (GeoParquet,
GeoPackage, anything GDAL opens). There is no PostGIS engine and no database catalog —
the
[postgres]extra is for the optional job ledger, not for data. - You want the full breadth of a desktop GIS. 16 tools plus a catalog that tells the agent what does not exist yet. The ~900 QGIS Processing algorithms are on the roadmap, not in the box.
- You expect plan validation to make a weak model strong. Our own A/B says advisory validation upstream of an improvising solver does approximately nothing at aggregate level; MapSmith's answer is enforcement at the execution boundary, and that hypothesis is not measured yet.
- You want us to debug your local geospatial toolchain. Docker, or
uvxwhere the wheels work, are the only supported paths; a hand-built native GDAL stack is not, on purpose.
Roadmap
- Zonal statistics (exactextract, exact fractional coverage)
- Whitebox Next Gen adapter: hillshade, flow accumulation, watershed (in-memory, open tier)
- Typed analysis plans: static validation against the operation registry + simulated CRS flow before execution
- Runtime verification: input preconditions, warnings with hints in the tool result, bounded deterministic repair recorded in the manifest
- MCP Apps in-chat map panel with provenance cards (self-contained, works under the default host sandbox)
- Agent-loop repair: hand verification failures back to the agent for a bounded number of retries
- More terrain & hydrology: slope/aspect, stream network extraction
- QGIS Processing sidecar (subprocess-isolated): ~900 algorithms
- Sandboxed code-execution tool for the long tail
- Map panel: MapLibre vector rendering and shareable viewer URLs (raster OSM tiles already ship)
- Authenticated remote mode (OAuth on the existing Streamable HTTP transport) and long-job progress via MCP Tasks
License and project
- MapSmith server and engines: AGPL-3.0-or-later (see LICENSE)
- Client SDK and tool-schema definitions (future
sdk/): Apache-2.0
You can self-host MapSmith freely, forever. If you modify it and offer it as a service, the AGPL asks you to share your changes — or talk to us about a commercial license.
Release notes are in CHANGELOG.md, how to contribute in CONTRIBUTING.md, how to report a vulnerability in SECURITY.md. "MapSmith" is a trademark of the MapSmith project — see TRADEMARKS.md. Updates: @mapsmith_ai · Bluesky.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mapsmith-0.2.1.tar.gz.
File metadata
- Download URL: mapsmith-0.2.1.tar.gz
- Upload date:
- Size: 822.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71f54ce737aab9fe51c17160e3ba56fded24b1837d24c2cbab667fc6793e8fae
|
|
| MD5 |
0567621886f75597e5f8d367f86d01ca
|
|
| BLAKE2b-256 |
17f798dc4459f0b6debd66707d19451fe5292d66aa333d11a4ac1b509254179c
|
File details
Details for the file mapsmith-0.2.1-py3-none-any.whl.
File metadata
- Download URL: mapsmith-0.2.1-py3-none-any.whl
- Upload date:
- Size: 91.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e681d875366ec117fd448a78e909108eb3df3f6588279062d5b4d06cdfcc7c9
|
|
| MD5 |
3c0a4ed3d26091fa032b5dc9934354ac
|
|
| BLAKE2b-256 |
481d4f665448d9dc23436380f6e7da373d1f90a4a8a0eda98c8d8a2db84be0e8
|