QGIS MCP Server
← Project Index QGIS MCP Server

QGIS MCP Server

A Model Context Protocol server that lets an AI assistant drive a running QGIS session -; loading layers, running geoprocessing, querying features, screenshotting the canvas -; currently being fed historical political-boundary data as test cases.

Active Started: 2026 Updated: 2026

Overview

QGIS is the open-source GIS workhorse; this gives Claude (Code or Desktop) a way to actually drive it -; list and add layers, query features, run Processing algorithms, set the canvas extent, take screenshots, and execute arbitrary PyQGIS when there's no purpose-built tool for the job. The point is to do spatial-data work conversationally instead of clicking through dialogs.

Right now it's being exercised against historical political-boundary data as the test corpus -; a good stress case because it's messy, multi-layer, and full of the kind of geometry and attribute queries the tools need to handle.

How It Works

Two pieces. A QGIS plugin runs inside QGIS, opening a localhost-only TCP server (port 9876) that dispatches JSON commands to PyQGIS on the Qt main thread. A separate Python MCP server (FastMCP) exposes the MCP tools and forwards calls to that bridge over TCP. The plugin only ever listens on 127.0.0.1, so nothing is exposed to the network.

# Claude Code / Desktop  --stdio(MCP)-->  qgis_mcp server
#   --length-prefixed JSON over TCP 127.0.0.1:9876-->  bridge plugin
#   --> PyQGIS (on the Qt main thread)

The tool surface covers the day-to-day: list_layers, get_layer_info, get_features (with optional expression filters), add_vector_layer / add_raster_layer, load_project / save_project, the zoom and extent helpers, list_processing_algorithms / run_processing, and a catch-all execute_code for raw PyQGIS. The screenshot tool is the fiddly one -; it auto-falls back from PNG to progressively-compressed and then downscaled JPEG to stay under Claude Desktop's image size cap.

Current Status

Active and working -; the bridge connects, the tool set is in place, and it's being driven against real boundary data. Installs via a PowerShell script that junctions the plugin into the QGIS profile so edits apply live; the MCP server runs under uv (no dependency on QGIS's bundled Python).

  • Full layer / feature / project / processing tool set wired up.
  • Localhost-only bridge -; nothing exposed to the network.
  • Screenshot tool with automatic format/size fallback for Claude Desktop's image cap.