QGIS Geographic Information System MCP server

Enables remote control of QGIS geographic information system for spatial analysis, map creation, and geographic data management through a JSON-based API
Back to servers
Provider
Syauqi Uqi
Release date
Apr 12, 2025
Language
Python
Stats
3 stars

QGISMCP connects QGIS to Claude AI through the Model Context Protocol (MCP), enabling direct interaction between the two. This integration allows Claude to control QGIS to perform tasks like project creation, layer loading, and code execution, making GIS workflows more accessible through AI assistance.

Installation

Prerequisites

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

Install uv using one of these methods:

For Mac:

brew install uv

For Windows PowerShell:

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

For other systems, follow the installation instructions at the uv documentation site.

⚠️ Do not proceed until uv is properly installed.

Download the Code

Clone the repository to your computer:

git clone https://github.com/syauqi-uqi/qgis_mcp_modify1.git

Install QGIS Plugin

  1. Locate your QGIS profile plugins folder:

    • In QGIS, go to SettingsUser profilesOpen active profile folder
    • Navigate to the Python/plugins directory
    • 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 downloaded repository into the plugins directory

  3. Restart QGIS

  4. Enable the plugin:

    • Go to PluginsInstalling and Managing Plugins
    • Select the All tab
    • Search for "QGIS MCP"
    • Check the box next to "QGIS MCP" to activate it

Configure Claude for Desktop

  1. In Claude, navigate to Claude > Settings > Developer > Edit Config > claude_desktop_config.json
  2. Add the following configuration (replace the directory path with your actual path to the downloaded repository):
{
    "mcpServers": {
        "qgis": {
            "command": "uv",
            "args": [
                "--directory",
                "#change this line to your directory#",
                "run",
                "qgis_mcp_server.py"
            ]
        }
    }
}

Usage

Starting the Connection

  1. In QGIS, go to PluginsQGIS MCPQGIS MCP
  2. Click "Start Server"
  3. Once connected, a hammer icon will appear in Claude with tools for QGIS MCP

Available Tools

  • ping: Check server connectivity
  • 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 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 Usage

Here's an example prompt to test the integration:

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.

Another Example for Advanced Styling

You have access to the tools to work with QGIS. You will do the following:

1. Ping to check the connection. If successful, proceed.  
2. Create a new QGIS project and save it to: "D:/PROJECT/MCP/claudemap.qgz"
3. Load vector layers:  
   a. Load "D:/PROJECT/MCP/map (2).osm"
   b. Load "D:/PROJECT/MCP/Bahan_Mundupesisir/aoi.shp" and name it "aoi".  
4. Zoom to the "aoi" layer to set the initial extent.  
5. Remove/hide unnecessary layers:  
   a. Remove layer "map (2) — points"
   b. Hide layer "aoi"
6. Style layers:  
   a. "map (2) — lines": Line color: #ff6201, Stroke width: 0.5 mm  
   b. "map (2) — multilinestrings": Line color: #8bff07, Stroke width: 0.8 mm  
   c. "map (2) — multipolygons": Fill color: #fff65f, Stroke color: #fff65f, Stroke width: 0.3 mm, Transparency: 80%  
7. Create Print Layout (A4 Portrait) with map item, title, scale bar and legend
8. Export to PNG at "D:/PROJECT/MCP/claudemap.png" with 600 DPI resolution
9. Save the QGIS project.

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