Sandbox
@JordanGunn/gdal-mcp

MCP server for GDAL geospatial tools

gdal-mcp exposes raster and vector geospatial operations through an MCP server. Agents can discover workspace catalogs, inspect metadata, and run tools for conversion, reprojection, clipping, buffering, querying, and raster statistics. It also includes reflection prompts and middleware that require a structured justification before certain operations run, so the agent has to explain choices like CRS and resampling method before acting.

80 stars7 forksPythonUpdated 3mo ago
Who it's for

Builders who want their agent to work with raster and vector geospatial data from a local workspace.

What it delivers

You can let your agent inspect and process geospatial files without hand-driving GDAL workflows, while keeping important method choices documented.

What it does

Raster tools

`raster_info`, `raster_convert`, `raster_reproject`, `raster_stats`, and `raster_query` for common raster workflows.

Vector tools

`vector_info`, `vector_convert`, `vector_reproject`, `vector_clip`, `vector_buffer`, `vector_simplify`, and `vector_query` for vector data work.

Workspace and metadata resources

Resources for catalog browsing, metadata lookup, reference material, and saved query results through `workspace://`, `metadata://`, `reference://`, and `query://result/{id}`.

Reflection middleware

Structured justification is required for methodology-sensitive tools, with cached rationale reused across later calls.

Prompt set

Prompts such as `justify_crs_selection`, `justify_resampling_method`, and `justify_query_extent` guide the agent through the reflection step.

Workspace scoping

`GDAL_MCP_WORKSPACES` limits which directories the server may access, with optional `RASTER=true` and `VECTOR=true` tool-surface flags.

How to get it

  1. 1Run
    uvx --from gdal-mcp gdal --transport stdio
  2. 2Run
    docker build -t gdal-mcp .
    docker run -i gdal-mcp gdal --transport stdio
  3. 3Run
    git clone https://github.com/Wayfinder-Foundry/gdal-mcp.git
    cd gdal-mcp
    uv sync
    uv run gdal --transport stdio

README

gdal-mcp

MCP server exposing GDAL/Rasterio operations to AI agents, with a reflection middleware that requires structured justification before executing operations whose methodology matters (CRS choice, resampling method, query extent).

CI License: MIT Python 3.11+ FastMCP 2.0 PyPI Downloads

Install

Via uvx (recommended)

uvx --from gdal-mcp gdal --transport stdio

Via Docker

docker build -t gdal-mcp .
docker run -i gdal-mcp gdal --transport stdio

Local development

git clone https://github.com/Wayfinder-Foundry/gdal-mcp.git
cd gdal-mcp
uv sync
uv run gdal --transport stdio

Configure your MCP client

Claude Desktop

Add to claude_desktop_config.json (macOS: ~/Library/Application Support/Claude/, Windows: %APPDATA%\Claude\, Linux: ~/.config/Claude/):

{
  "mcpServers": {
    "gdal-mcp": {
      "command": "uvx",
      "args": ["--from", "gdal-mcp", "gdal", "--transport", "stdio"],
      "env": {
        "GDAL_MCP_WORKSPACES": "/path/to/your/geospatial/data"
      }
    }
  }
}

Restart Claude Desktop. The MCP server indicator should appear, and the raster_* and vector_* tools become available.

Workspace scoping

GDAL_MCP_WORKSPACES is a colon-separated list of directories the server is allowed to touch. If unset, all paths are allowed and a warning is logged.

Optional tool-surface flags: RASTER=true, VECTOR=true. See docs/ENVIRONMENT_VARIABLES.md for the full set.

Tools

  • Raster: raster_info, raster_convert, raster_reproject, raster_stats, raster_query
  • Vector: vector_info, vector_convert, vector_reproject, vector_clip, vector_buffer, vector_simplify, vector_query
  • Resources: catalog (workspace://...), metadata (metadata://...), reference (reference://...), query results (query://result/{id})
  • Prompts: justify_crs_selection, justify_resampling_method, justify_query_extent (and more under src/prompts/)

See TOOLS.md for parameters, return shapes, and worked examples.

The reflection middleware

Tools whose methodology matters refuse to execute until the calling agent produces a structured justification. The flow is:

  1. Agent calls e.g. raster_reproject(dst_crs="EPSG:3857", resampling="cubic", ...).
  2. Middleware checks .preflight/justifications/{domain}/ for a matching hash.
  3. On miss, the call raises ToolError with a hint pointing at the relevant prompt (e.g. justify_crs_selection).
  4. Agent calls the prompt, fills out the Justification schema (intent, alternatives considered, choice, tradeoffs, confidence), and re-invokes the tool with a __reflection payload.
  5. The justification is cached domain-keyed, so a CRS rationale for EPSG:3857 satisfies both raster_reproject and vector_reproject on subsequent calls.

See docs/REFLECTION.md for the schema and cache layout, and docs/PHILOSOPHY.md for why this exists.

Documentation

Troubleshooting

Access denied: path outside allowed workspaces — set GDAL_MCP_WORKSPACES to include the directory in question (see "Workspace scoping").

MCP client doesn't see the server — verify uvx --from gdal-mcp gdal --help runs on its own, then restart the client after editing its config file.

License

MIT — see LICENSE.

Built on FastMCP, Rasterio, pyogrio, and Shapely.

Files in the repo

Repository payload21 top-level entries
  • .devcontainer
  • .github
  • docs
  • src
  • test
  • .dockerignore
  • .fastmcp.json.example
  • .gitignore
  • .pre-commit-config.yaml
  • .ruff.toml
  • CHANGELOG.md
  • CODE_OF_CONDUCT.md
  • CONTRIBUTING.md
  • Dockerfile
  • fastmcp.json
  • LICENSE
  • mypy.ini
  • pyproject.toml
  • README.md
  • TOOLS.md
  • uv.lock

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More connectors

Real-time global intelligence dashboard. AI-powered news aggregation, geopolitical monitoring, and infrastructure tracking in a unified situational awareness interface

86k

High-performance code intelligence MCP server. Indexes codebases into a persistent knowledge graph — average repo in milliseconds. 158 languages, sub-ms queries, 99% fewer tokens. Single static binary, zero dependencies.

43k

Universal provider proxy for OpenAI Codex & Claude Code — use any LLM (Claude, Gemini, Grok, DeepSeek, Ollama…) with Codex CLI, App, SDK, and Claude Code

14k
okf-memory/
okf-agent-memory

Git-native persistent memory for AI coding agents. Implements Google OKF v0.2 with sub-300µs in-memory BM25 search, embedded MCP server, and progressive disclosure. Slashes token bloat by 80% with zero external databases or dependencies. Built in pure Go.

547
tirth8205/
code-review-graph

Local-first code intelligence graph for MCP and CLI. Builds a persistent map of your codebase so AI coding tools read only what matters, with benchmarked context reductions on reviews and large-repo workflows.

31k
2akouwu/
reverify

Stop your AI from making things up — it proposes, deterministic tools decide, every claim checked against ground truth with evidence. Grounded facts and context survive resets. Reverse engineering is the proving ground. MCP server + CLI.

1.1k