# qgis_mcp

> MCP Client

QGISMCP integrates QGIS with Claude AI via the Model Context Protocol, enabling Claude to control QGIS for tasks like project creation, layer manipulation, and code execution. It uses a QGIS

## Overview

- **Category:** AI
- **Language:** Python
- **Stars:** 1037
- **Forks:** 38
- **Owner:** jjsantos01
- **GitHub:** https://github.com/jjsantos01/qgis_mcp
- **Created:** 2025-03-12T21:09:53+00:00
- **Updated:** 2025-03-28T20:45:07+00:00
- **Source:** https://model-context-protocol.com/clients/qgis-plugin-llm-model-context-protocol

## Setup

## Setup

1.  **Prerequisites:** Install QGIS 3.X, Cloud desktop, Python 3.10 or newer, and the uv package manager.
2.  **Install uv:** Use `brew install uv` on Mac, `powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"` on Windows Powershell, or follow the instructions on the [Install uv](https://docs.astral.sh/uv/getting-started/installation/) website.
3.  **Download code:** Clone the repository using `git clone git@github.com:jjsantos01/qgis_mcp.git`.
4.  **QGIS plugin:** Copy the `qgis_mcp_plugin` folder to your QGIS profile plugins folder (e.g., `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), then enable the QGIS MCP plugin in QGIS.
5.  **Claude for Desktop Integration:** Add the QGIS MCP server configuration to `claude_desktop_config.json` (accessible via `Claude` > `Settings` > `Developer` > `Edit Config`):

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

    }
}
```

6. **Starting the Connection:** In QGIS, go to `plugins` -> `QGIS MCP`-> `QGIS MCP` and click "Start Server".

## Tools

## Available Tools

1.  Two-way communication (Connect Claude AI to QGIS through a socket-based server).
2.  Project manipulation (Create, load and save projects in QGIS).
3.  Layer manipulation (Add and remove vector or raster layers to a project).
4.  Execute processing (Execute processing algorithms from the Processing Toolbox).
5.  Code execution (Run arbitrary Python code in QGIS from Claude).
6.  `ping` (Simple ping command to check server connectivity).
7.  `get_qgis_info` (Get QGIS information about the current installation).
8.  `load_project` (Load a QGIS project from the specified path).
9.  `create_new_project` (Create a new project and save it).
10. `get_project_info` (Get current project information).
11. `add_vector_layer` (Add a vector layer to the project).
12. `add_raster_layer` (Add a raster layer to the project).
13. `get_layers` (Retrieve all layers in the current project).
14. `remove_layer` (Remove a layer from the project by its ID).
15. `zoom_to_layer` (Zoom to the extent of a specified layer).
16. `get_layer_features` (Retrieve features from a vector layer with an optional limit).
17. `execute_processing` (Execute a processing algorithm with the given parameters).
18. `save_project` (Save the current project to the given path).
19. `render_map` (Render the current map view to an image file).
20. `execute_code` (Execute arbitrary PyQGIS code provided as a string)
