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
Provider
jjsantos01
Release date
Mar 15, 2025
Language
Python
Stats
488 stars

This MCP server connects QGIS to Claude AI through the Model Context Protocol, enabling direct interaction between Claude and QGIS for project creation, layer manipulation, processing execution, and more. The integration allows for AI-assisted GIS workflows with powerful two-way communication.

Installation

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

Install UV package manager:

Mac:

brew install uv

Windows PowerShell:

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

For other platforms, see the official installation guide.

⚠️ Important: Do not proceed until UV is properly installed.

Download the Code

Clone the repository to your local machine:

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

QGIS Plugin Installation

  1. Locate your QGIS profile plugins folder:

    • In QGIS, go to SettingsUser profilesOpen active profile folder
    • Navigate to Python/plugins
    • Common locations:
      • 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 cloned repository to the QGIS plugins folder

  3. Restart QGIS

  4. Enable the plugin:

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

Claude for Desktop Configuration

  1. In Claude, navigate to ClaudeSettingsDeveloperEdit Configclaude_desktop_config.json

  2. Add the QGIS MCP server configuration:

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

Make sure to replace /ABSOLUTE/PATH/TO/PARENT/REPO/FOLDER with the actual absolute path to where you cloned the repository.

Usage

Starting the Connection

  1. In QGIS, go to PluginsQGIS MCPQGIS MCP
  2. Click "Start Server"

Using with Claude

Once properly configured, Claude will display a hammer icon with tools for QGIS MCP integration.

Available Tools

  • ping: Simple connectivity check
  • get_qgis_info: Retrieve QGIS installation information
  • load_project: Load a QGIS project from a specified path
  • create_new_project: Create and save a new project
  • 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: List all layers in the current project
  • remove_layer: Remove a layer by ID
  • zoom_to_layer: Zoom to a layer's extent
  • get_layer_features: Retrieve features from a vector layer
  • execute_processing: Run a processing algorithm
  • save_project: Save the current project
  • render_map: Generate an image of the current map view
  • execute_code: Run custom PyQGIS code

Example Workflow

Here's a sample prompt to test the functionality:

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.

Make sure to adjust file paths according to your system configuration.

How to add this MCP server to 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 > MCP and click "Add new global MCP server".

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

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

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 explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

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