qgis-mcp
Provides headless access to QGIS 4.x through PyQGIS standalone, enabling agents to create and load projects, add vector and raster layers, inspect layer metadata and attribute tables, calculate fields, list and run Processing algorithms (buffers, overlays, zonal statistics), apply layer styles, set map extents, export map images, and build/export print layouts as PDF — all without opening QGIS Desktop. Also includes an unsandboxed execute_pyqgis escape hatch for arbitrary PyQGIS scripting.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@qgis-mcpclip the parcels layer to the project boundary and export a map image"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
qgis-mcp
A headless MCP server for QGIS 4.x: load layers, run Processing algorithms, style and export maps from Claude, without opening QGIS Desktop.
Built on PyQGIS standalone and the Model Context Protocol. It is in daily use with Claude Code against QGIS 4.2.1 for spatial overlay work in environmental and mining projects (project area vs. restriction layers, buffers, zonal statistics, map figures).
📄 Notes in Spanish: README.es.md
Why headless, not a Desktop plugin
A headless server doesn't depend on an open QGIS Desktop session with a plugin running, so it's sturdier for long-lived agent use. It covers Processing, field calculation, vector overlay and static image export, which is nearly the whole overlay use case. A future "desktop" mode (plugin + socket) could reuse the exact same tool interface; the implementation underneath would change, but what Claude sees would not.
Related MCP server: QGISMCP
Tools
Module | Tools |
|
|
|
|
|
|
|
|
|
|
Design decisions
Every write tool goes through
resolve_layer(). It accepts a reallayer_idor a name, and fails explicitly on ambiguity or a missing layer; it never guesses.run_processing_algorithmauto-resolves any string parameter that matches a loaded layer id or name, so the agent only passes ids it already saw inlist_layers().The
QgsProcessingFeedbacklog is captured and returned, so failures can be diagnosed instead of retried blindly.Server instructions encode verification rules for the agent: confirm CRS before any geometric operation between two layers, and verify the output layer after a Processing run, because an algorithm can finish without error and still produce 0 features.
QGIS 4 / Qt6 migration handled: PyQt6 requires scoped enums (
QgsMapLayer.LayerType.VectorLayer,QMetaType.Type.Int,QgsLayoutExporter.ExportResult.Success…) where QGIS 3.x accepted flat ones.execute_pyqgisis deliberately unsandboxed and documented as such, rather than wrapped in a layer of fake "security". The server is meant for local stdio use only, with no network surface.Nothing overwrites files by default.
save_projectwithout a path reuses the loaded path and never creates silent copies.
Setup
PyQGIS is not installable with pip; use a Python interpreter that already ships with it.
# Option A: the Python bundled with QGIS (Windows)
"C:\Program Files\QGIS 4.2.1\bin\python-qgis.bat" -m pip install -e .
# Option B: conda-forge
conda create -n qgis-mcp -c conda-forge python=3.11 qgis
conda activate qgis-mcp
pip install -e .Smoke test:
python -c "from qgis_mcp.qgis_backend import backend; backend.start(); print('OK', backend.qgs_app.processingRegistry().providers())"Register with Claude Code:
{
"mcpServers": {
"qgis": {
"command": "cmd.exe",
"args": ["/c", "C:\\Program Files\\QGIS 4.2.1\\bin\\python-qgis.bat", "-m", "qgis_mcp.server"]
}
}
}Roadmap
Automated test suite (today it's validated through live use, not a test bench).
Optional desktop mode (plugin + socket) reusing the same tool schema.
Authentication and permissions if it ever stops being local-only.
Built by Oscar Daniel Montero Miranda. Independent project, not affiliated with the QGIS project. Code comments are in
Spanish; docstrings mention internal design notes (00-mcp-tools-y-modo-agente.md) that are not part of this repository.
This server cannot be deployed
Maintenance
Related MCP Connectors
Zotero MCP server for Claude and ChatGPT: search, citations, safe writes, PDF passages and pages.
133- platform7nOAuthtech.p7n
Connect Claude to your Platform7n workspaces — chat, links, and tasks. One-click OAuth.
Create projects, nodes, and tasks in UluP Spaces by conversation with Claude.
- AurentiaOAuthfr.aurentia
Your Aurentia workspace — projects, CRM, tasks, deliverables — in Claude, Cursor or any MCP client.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceConnects QGIS to Claude AI through the Model Context Protocol, enabling AI-assisted project creation, layer manipulation, processing algorithm execution, and Python code running within QGIS.7-
- FlicenseBqualityDmaintenanceQGISMCP connects QGIS to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control QGIS for project creation, layer loading, code execution, and more.151-
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to interact with QGIS, supporting project management, layer inspection, spatial queries, styling, and map export in both headless and desktop modes.-
- AlicenseAqualityCmaintenanceConnect QGIS to Claude AI through the Model Context Protocol (MCP), enabling Claude to directly control QGIS — manage layers, edit features, run processing algorithms, render maps, and more.1001MIT