by JordanGunn
Provides AI agents with Python‑native geospatial workflow capabilities, including raster and vector processing, while enforcing methodological justification through a reflection middleware and caching system.
Gdal Mcp is a Model Context Protocol (MCP) server that wraps GDAL‑style geospatial libraries (Rasterio, GeoPandas, PyProj, etc.) to expose raster and vector operations to AI agents. Before executing a tool, the server requires the agent to justify choices such as CRS, resampling method, or query extent, creating an audit trail of reasoning.
uvx):
uvx --from gdal-mcp gdal --transport stdio
gdal-mcp server, setting the GDAL_MCP_WORKSPACES environment variable to the folder containing your geospatial data.raster_reproject, vector_clip, or any *_info request. The first call triggers a reflection dialogue; subsequent calls reuse cached justifications.Q: Do I need to write Python code to call the tools? A: No. Interactions occur via the MCP protocol; the client (e.g., Claude, LangChain, custom agents) sends JSON requests and receives structured responses.
Q: What happens if the AI proposes an unsupported operation? A: The reflection middleware intercepts the request, prompts the agent to choose a supported alternative, and records the decision.
Q: Can I disable the reflection step? A: The system is designed to always capture justification; however, cached justifications make subsequent calls instantaneous, effectively bypassing repeated prompts.
Q: How are large datasets handled? A: Tools operate on file paths within defined workspaces; streaming and VRT support are planned for future releases (Phase 3).
Q: Is the server compatible with other MCP implementations? A: Yes. It follows the FastMCP 2.0 specification, allowing seamless integration with any compliant client.
Geospatial AI with epistemic reasoning
GDAL MCP is a Model Context Protocol (MCP) server that provides AI agents with geospatial analysis capabilities while requiring them to justify their methodological choices through a reflection middleware system.
🎉 v1.1.1 Released (2025-10-26) — Vector tool parity + cross-domain reflection validated
🧠 Reflection System — Domain-based epistemic reasoning that transcends data types
⚡ 75% Cache Hit Rate — Methodology reasoning carries across raster ↔ vector operations
Most AI tool systems execute operations immediately when requested. GDAL MCP requires the AI to justify methodological decisions before execution, creating a conversation about the "why" rather than just executing the "what."
Traditional AI tool approach:
User: "Reproject this DEM to Web Mercator"
AI: *silently executes operation*
Result: DEM reprojected (but with what resampling? why that CRS? what tradeoffs?)
GDAL MCP with reflection:
User: "Reproject this DEM to Web Mercator for my web map"
AI: *reflection middleware intercepts*
AI: "Before reprojecting to EPSG:3857, let me justify this CRS choice:
Intent: Web Mercator preserves angles (conformal projection),
essential for web tile rendering and navigation
Alternatives considered:
- EPSG:4326 (WGS84) → rejected: not conformal, distorts shapes
- Local UTM → rejected: limited extent, not web-standard
Tradeoffs: Area distortion increases at high latitudes
(acceptable for web visualization)
Confidence: High - this is the standard for web mapping"
*justification stored, operation proceeds*
Result: DEM reprojected with documented methodology
1. Utilizes Full MCP Protocol Capabilities
The Model Context Protocol isn't just about tool execution—it's about agentic reasoning and interaction. The reflection system leverages MCP's design to enable:
2. Prevents Silent Failures
Geospatial operations can execute successfully while producing methodologically incorrect results:
The reflection system surfaces these choices for validation.
3. Educational, Not Restrictive
The AI isn't blocked from executing operations—it's required to demonstrate understanding:
4. Creates Audit Trail
Every methodological decision is documented with:
This enables reproducible geospatial science.
User: "I need to reproject this DEM to UTM for accurate slope analysis,
then reproject this vector layer to the same CRS for overlay"
AI Workflow:
1. Inspects DEM metadata (raster_info)
2. REFLECTION: Justifies UTM Zone 10N choice (accurate distance/area)
3. REFLECTION: Justifies cubic resampling (smooth gradients for derivatives)
4. Reprojects DEM (raster_reproject)
5. Inspects vector metadata (vector_info)
6. CACHE HIT: Reuses UTM justification (cross-domain!)
7. Reprojects vector (vector_reproject) - instant, no re-prompting
8. Both datasets now aligned in UTM Zone 10N
Result: 2 operations, 2 reflections (not 3!)
Cache hit rate: 50% → Saves time, maintains methodology
The Key Innovation: The CRS justification from step 2 is reused in step 6 because the methodology (why UTM Zone 10N?) is domain-based, not tool-based. It doesn't matter if you're working with raster or vector data—the projection choice reasoning is the same.
See Tools Reference for detailed examples of all available tools.
query://result/{id})# Run directly from PyPI
uvx --from gdal-mcp gdal --transport stdio
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"gdal-mcp": {
"command": "uvx",
"args": ["--from", "gdal-mcp", "gdal", "--transport", "stdio"],
"env": {
"GDAL_MCP_WORKSPACES": "/path/to/your/geospatial/data"
}
}
}
}
See QUICKSTART.md for:
See docs/ENVIRONMENT_VARIABLES.md for all runtime flags
including workspace scoping, tool registration toggles (RASTER/VECTOR), and query registry TTL/capacity.
GDAL MCP provides 13 production-ready tools across three categories:
raster_info - Inspect metadata (CRS, resolution, bands, nodata)raster_convert - Format conversion with compression & overviews (COG support)raster_reproject ⚡ - CRS transformation (with reflection)raster_stats - Statistical analysis with histogramsraster_query ⚡ - Spatial window query (bbox or geometry)vector_info - Inspect metadata (CRS, geometry, attributes)vector_reproject ⚡ - CRS transformation (with reflection)vector_convert - Format migration (SHP ↔ GPKG ↔ GeoJSON)vector_clip - Spatial subsettingvector_buffer - Proximity analysisvector_simplify - Geometry simplificationvector_query ⚡ - Spatial/attribute query (bbox or geometry)store_justification - Cache epistemic reasoning (used internally)⚡ = Reflection-enabled: These tools require methodological justification on first use, then cache for instant subsequent execution.
See TOOLS.md for complete documentation with examples and parameters.
Note: Spatial query tools currently provide core querying only (Phase 3a). Indexing/VRT optimizations are deferred to future phases.
# Run all tests
uv run pytest test/ -v
# With coverage
uv run pytest test/ --cov=src --cov-report=term-missing
Status: ✅ 72 passing tests including reflection system integration
Python-Native Stack (ADR-0017):
Key Design Decisions (26 ADRs guide development):
We welcome contributions! See CONTRIBUTING.md for:
MIT License - see LICENSE for details.
Current Status: v1.1.1 - Phase 2 Complete ✅
Next: Phase 3 - Workflow Intelligence (v2.0+)
See Vision for the complete long-term roadmap.
Built with ❤️ for the geospatial AI community
Geospatial operations that think, not just execute.
Please log in to share your review and rating for this MCP.
Explore related MCPs that share similar capabilities and solve comparable challenges
by modelcontextprotocol
A Model Context Protocol server for Git repository interaction and automation.
by zed-industries
A high‑performance, multiplayer code editor designed for speed and collaboration.
by modelcontextprotocol
Model Context Protocol Servers
by modelcontextprotocol
A Model Context Protocol server that provides time and timezone conversion capabilities.
by cline
An autonomous coding assistant that can create and edit files, execute terminal commands, and interact with a browser directly from your IDE, operating step‑by‑step with explicit user permission.
by upstash
Provides up-to-date, version‑specific library documentation and code examples directly inside LLM prompts, eliminating outdated information and hallucinated APIs.
by daytonaio
Provides a secure, elastic infrastructure that creates isolated sandboxes for running AI‑generated code with sub‑90 ms startup, unlimited persistence, and OCI/Docker compatibility.
by continuedev
Enables faster shipping of code by integrating continuous AI agents across IDEs, terminals, and CI pipelines, offering chat, edit, autocomplete, and customizable agent workflows.
by github
Connects AI tools directly to GitHub, enabling natural‑language interactions for repository browsing, issue and pull‑request management, CI/CD monitoring, code‑security analysis, and team collaboration.