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
687 stars

QGISMCP connects QGIS to Claude AI through the Model Context Protocol (MCP), enabling Claude to directly interact with and control QGIS. This integration allows for prompt-assisted project creation, layer loading, code execution, and more through a two-way communication system.

Installation

Prerequisites

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

To install the uv package manager:

On Mac:

brew install uv

On Windows PowerShell:

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

For other platforms, visit the uv installation guide.

Download the Code

Clone the repository to your computer:

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

Install 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
    • Or navigate to SettingsUser profilesOpen active profile folder and then go to Python/plugins
  2. Copy the qgis_mcp_plugin folder from the downloaded repository to your QGIS plugins folder

  3. Restart QGIS

  4. Enable the plugin by going to PluginsInstalling and Managing Plugins, select the All tab, search for "QGIS MCP", and check the QGIS MCP checkbox

Configure Claude Desktop

  1. Open Claude for Desktop
  2. Navigate to ClaudeSettingsDeveloperEdit Configclaude_desktop_config.json
  3. Add the following configuration (replace the path with the absolute path to your repository):
{
    "mcpServers": {
        "qgis": {
            "command": "uv",
            "args": [
                "--directory",
                "/ABSOLUTE/PATH/TO/PARENT/REPO/FOLDER/qgis_mcp/src/qgis_mcp",
                "run",
                "qgis_mcp_server.py"
            ]
        }
    }
}

Using QGISMCP

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 the connection is established, you'll see a hammer icon in Claude with the following tools:

  • ping: Check server connectivity
  • get_qgis_info: Get information about the QGIS installation
  • 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 its ID
  • zoom_to_layer: Zoom to a specified layer's extent
  • get_layer_features: Retrieve features from a vector layer
  • execute_processing: Run a processing algorithm with given parameters
  • save_project: Save the current project
  • render_map: Render the current map view to an image file
  • execute_code: Execute arbitrary PyQGIS code

Example Workflow

Here's a sample prompt you can use with Claude:

You have access to the tools to work with QGIS. Please:
1. Ping to check the connection
2. Create a new project and save it at: "C:/Users/USER/Projects/my_project.qgz"
3. Load the vector layer: "C:/Users/USER/Data/boundaries.shp" and name it "Boundaries"
4. Load the raster layer: "C:/Users/USER/Data/elevation.tif" and name it "Elevation"
5. Zoom to the "Boundaries" layer
6. Execute the centroid algorithm on the "Boundaries" layer, saving to "centroids.geojson"
7. Execute code to create a choropleth map using the "Population" field
8. Render the map to "C:/Users/USER/Projects/map.png"
9. Save the project

Claude will execute these commands sequentially, interacting with QGIS through the MCP connection.

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