QGIS MCP server

Enables AI systems to perform complex GIS operations in QGIS through a socket-based architecture that exposes geospatial capabilities like adding layers, executing processing algorithms, and rendering maps.
Back to servers
Setup instructions
Provider
jjsantos01
Release date
Mar 15, 2025
Language
Python
Stats
647 stars

The QGIS Model Context Protocol (MCP) integration allows Claude AI to directly communicate with and control QGIS. This powerful connection enables you to automate QGIS tasks through prompts, including project manipulation, layer handling, and processing algorithm execution.

Installation Requirements

Prerequisites

Before installing the QGIS MCP server, ensure you have:

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

Installing the UV Package Manager

For macOS:

brew install uv

For Windows PowerShell:

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

Download the Repository

Clone the repository to your local machine:

git clone [email protected]:jjsantos01/qgis_mcp.git

Setting Up the QGIS Plugin

  1. Locate your QGIS profile plugins folder:

    • Windows: C:\Users\USER\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins
    • macOS: ~/Library/Application\ Support/QGIS/QGIS3/profiles/default/python/plugins
  2. Copy the qgis_mcp_plugin folder from the repository into your plugins folder

  3. Restart QGIS

  4. Enable the plugin:

    • Navigate to PluginsInstalling and Managing Plugins
    • Select the All tab
    • Search for "QGIS MCP"
    • Check the QGIS MCP checkbox

Claude Desktop Integration

Configure Claude to connect with QGIS:

  1. Go to Claude > Settings > Developer > Edit Config > claude_desktop_config.json

  2. Add the following configuration (replace the path with your actual repository location):

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

Using the QGIS MCP Integration

Starting the Connection

  1. In QGIS, navigate to PluginsQGIS MCPQGIS MCP
  2. Click "Start Server" in the dialog that appears

Available Tools in Claude

Once connected, Claude will display a hammer icon with QGIS tools. Here are the main functions:

Basic Operations

  • ping - Test server connectivity
  • get_qgis_info - Get QGIS version information
  • get_project_info - Get current project details

Project Management

  • create_new_project - Create a new QGIS project
  • load_project - Load a project from a specified path
  • save_project - Save the current project

Layer Manipulation

  • add_vector_layer - Add a vector layer to the project
  • add_raster_layer - Add a raster layer to the project
  • get_layers - List all layers in the current project
  • remove_layer - Remove a layer by ID
  • zoom_to_layer - Focus the map view on a specific layer
  • get_layer_features - Retrieve features from a vector layer

Advanced Features

  • execute_processing - Run a QGIS processing algorithm
  • render_map - Export the current map view as an image
  • execute_code - Run custom PyQGIS code (use with caution)

Example Usage

Here's an example of commands you can send to Claude to automate QGIS:

1. Check connection with ping
2. Create a new project and save it at a specific location
3. Load vector and raster layers
4. Execute a processing algorithm (like creating centroids)
5. Apply styling to create a choropleth map
6. Render the map to an image file
7. Save the project

When properly configured, Claude can execute these commands in sequence, performing complex GIS operations automatically.

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

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

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

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

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

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

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later