MCP Connector

Control QGIS with Claude AI

Connects Claude to QGIS for project/layer management, processing algorithms, map rendering, and arbitrary PyQGIS code execution.

Works with qgisclaude

90
Spark score
out of 100
Updated 9 months ago
Version 1.0.0
Models

Add to Favorites

Why it matters

Integrate Claude AI with QGIS to automate geospatial tasks. Create projects, manage layers, execute processing algorithms, and run custom Python code directly from Claude.

Outcomes

What it gets done

01

Create and load QGIS projects via prompts.

02

Add, remove, and manage vector and raster layers.

03

Execute QGIS processing algorithms and PyQGIS code.

04

Render maps and save project states.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/vb-qgis | bash

Capabilities

Tools your agent gets

ping

Simple ping command to verify server connection

get_qgis_info

Get information about the current QGIS installation

load_project

Load a QGIS project from a specified path

create_new_project

Create a new project and save it

get_project_info

Get information about the current project

add_vector_layer

Add a vector layer to the project

add_raster_layer

Add a raster layer to the project

get_layers

Get all layers in the current project

+7 tools

Overview

QGIS MCP Server

Bridges Claude and QGIS over a socket-based MCP server with 15 tools for project/layer management, processing algorithms, map rendering, and arbitrary PyQGIS code execution. Use for conversational QGIS project and layer management, spatial processing, and map rendering; the execute_code tool runs arbitrary Python inside a live QGIS session and should be used with caution.

What it does

QGIS MCP Server connects QGIS to Claude through the Model Context Protocol, enabling project creation, layer loading, code execution, and direct QGIS management from natural-language prompts. It exposes 15 tools: ping verifies the server connection; get_qgis_info retrieves information about the current QGIS installation; load_project and create_new_project open or create a project; get_project_info reports on the current project; add_vector_layer and add_raster_layer add layers to the project; get_layers lists all layers currently loaded; remove_layer deletes a layer by its ID; zoom_to_layer zooms the map view to a layer's bounds; get_layer_features retrieves features from a vector layer with an optional result limit; execute_processing runs a Processing Toolbox algorithm with specified parameters; save_project saves the current project to a path; render_map renders the current map view out to an image file; and execute_code runs arbitrary PyQGIS code passed as a string.

Communication is bidirectional over a socket-based server: a QGIS plugin opens the socket server inside QGIS itself, while a separate MCP server implements the Model Context Protocol side that Claude talks to. The project is based on the BlenderMCP project by Siddharth Ahuja, adapting the same socket-bridge pattern for QGIS instead of Blender. The source is explicit that the execute_code tool, while powerful, requires caution given it can run arbitrary Python inside a live QGIS session.

When to use - and when NOT to

Use this when driving QGIS conversationally through Claude: creating a new project, loading vector or raster layers, zooming to a layer's extent, running processing algorithms like centroid calculations, building choropleth maps with classification methods, rendering the resulting map to an image, and saving the project - all demonstrated as a typical workflow in the source's usage examples. Because execute_code can run unrestricted PyQGIS, it should be used with the same caution as any tool that grants arbitrary code execution inside a real, stateful application.

Capabilities

The system requires QGIS 3.x (tested on 3.22), Claude Desktop, Python 3.10 or higher, and the uv package manager.

How to install

Installation clones the repository, installs uv (via Homebrew on Mac or a PowerShell script on Windows), and copies the qgis_mcp_plugin folder into QGIS's plugins directory - C:\Users\USER\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins on Windows, or ~/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins on macOS. Claude Desktop is then configured to run the server via uv, pointing --directory at the local repository's src/qgis_mcp path and running qgis_mcp_server.py.

Who it's for

GIS analysts and developers who want to drive QGIS project creation, layer management, spatial processing, and map rendering conversationally through Claude, including running custom PyQGIS scripts when the built-in tools aren't enough.

Source README

QGISMCP - QGIS Model Context Protocol Integration

QGISMCP connects QGIS to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control QGIS. This integration enables prompt assisted project creation, layer loading, code execution and more.

This project is strongly based on the BlenderMCP project by Siddharth Ahuja

Features

  • Two-way communication: Connect Claude AI to QGIS through a socket-based server.
  • Project manipulation: Create, load and save projects in QGIS.
  • Layer manipulation: Add and remove vector or raster layers to a project.
  • Execute processing: Execute processing algorithms (Processing Toolbox).
  • Code execution: Run arbitrary Python code in QGIS from Claude. Very powerful, but also be very cautious using this tool.

Components

The system consists of two main components:

  1. QGIS plugin: A QGIS plugin that creates a socket server within QGIS to receive and execute commands.
  2. MCP Server: A Python server that implements the Model Context Protocol and connects to the QGIS plugin.

Installation

Prerequisites

  • QGIS 3.X (only tested on 3.22)
  • Claude desktop
  • Python 3.10 or newer
  • uv package manager:

If you're on Mac, please install uv as

brew install uv

On Windows Powershell

powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

Otherwise installation instructions are on their website: Install uv

⚠️ Do not proceed before installing UV

Download code

Download this repo to your computer. You can clone it with:

git clone git@github.com:jjsantos01/qgis_mcp.git

QGIS plugin

You need to copy the folder qgis_mcp_plugin and its content on your QGIS profile plugins folder.

You can get your profile folder in QGIS going to menu Settings -> User profiles -> Open active profile folder Then, go to Python/plugins and paste the folder qgis_mcp_plugin.

On a Windows machine the plugins folder is usually located at: C:\Users\USER\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins

and on MacOS: ~/Library/Application\ Support/QGIS/QGIS3/profiles/default/python/plugins

Then close QGIS and open it again. Go to the menu option Plugins > Installing and Managing Plugins, select the All tab and search for "QGIS MCP", then mark the QGIS MCP checkbox.

Claude for Desktop Integration

Go to Claude > Settings > Developer > Edit Config > claude_desktop_config.json to include the following:

If you can't find the "Developers tab" or the claude_desktop_config.json look at this documentation.

{
    "mcpServers": {
        "qgis": {
            "command": "uv",
            "args": [
                "--directory",
                "/ABSOLUTE/PATH/TO/PARENT/REPO/FOLDER/qgis_mcp/src/qgis_mcp",
                "run",
                "qgis_mcp_server.py"
            ]
        }

    }
}

Usage

Starting the Connection

  1. In QGIS, go to plugins > QGIS MCP > QGIS MCP

  2. Click "Start Server"

Using with Claude

Once the config file has been set on Claude, and the server is running on QGIS, you will see a hammer icon with tools for the QGIS MCP.

Tools
  • ping - Simple ping command to check server connectivity
  • get_qgis_info - Get QGIS information about the current installation
  • load_project - Load a QGIS project from the specified path
  • create_new_project - Create a new project and save it
  • get_project_info - Get current project information
  • add_vector_layer - Add a vector layer to the project
  • add_raster_layer - Add a raster layer to the project
  • get_layers - Retrieve all layers in the current project
  • remove_layer - Remove a layer from the project by its ID
  • zoom_to_layer - Zoom to the extent of a specified layer
  • get_layer_features - Retrieve features from a vector layer with an optional limit
  • execute_processing - Execute a processing algorithm with the given parameters
  • save_project - Save the current project to the given path
  • render_map - Render the current map view to an image file
  • execute_code - Execute arbitrary PyQGIS code provided as a string

Example Commands

This is the example I used for the demo:

You have access to the tools to work with QGIS. You will do the following:
	1. Ping to check the connection. If it works, continue with the following steps.
	2. Create a new project and save it at: "C:/Users/USER/GitHub/qgis_mcp/data/cdmx.qgz"
	3. Load the vector layer: ""C:/Users/USER/GitHub/qgis_mcp/data/cdmx/mgpc_2019.shp" and name it "Colonias".
	4. Load the raster layer: "C:/Users/USER/GitHub/qgis_mcp/data/09014.tif" and name it "BJ"
	5. Zoom to the "BJ" layer.
	6. Execute the centroid algorithm on the "Colonias" layer. Skip the geometry check. Save the output to "colonias_centroids.geojson".
	7. Execute code to create a choropleth map using the "POB2010" field in the "Colonias" layer. Use the quantile classification method with 5 classes and the Spectral color ramp.
	8. Render the map to "C:/Users/USER/GitHub/qgis_mcp/data/cdmx.png"
	9. Save the project.

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.