With the Model Context Protocol (MCP) you can connect Claude Desktop directly to QGIS, allowing the AI to execute PyQGIS commands in your open session. This means adding layers, applying symbology, executing geoprocessing tasks, and generating reports, all from the chat.
Prerequisites
Make sure you have the following:
- QGIS installed on your computer.
- Claude Desktop: The Windows desktop application from claude.ai/downloads (does not work from the browser).
- Claude Pro Account (paid): It is mandatory to enable developer features and MCP usage.
Step 1: Installing the UV Utility
We will install uv, the Python package manager that allows Claude to execute the QGIS server. Open Windows PowerShell as Administrator and run:
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
Important: To verify the UV installation path (you will need it later), type in the same PowerShell: where.exe uv. Note the path that appears and do not close the window yet.
Step 2: Installing the Plugin in QGIS
Download the ZIP file or clone the repository from github.com/jjsantos01/qgis_mcp. If you prefer to clone, run in your terminal:
git clone git@github.com:jjsantos01/qgis_mcp.git
Although the repository is called qgis_mcp, the folder that QGIS recognizes is the one inside it: qgis_mcp_plugin. You must copy it to the plugins directory of your QGIS profile:
- Locate the
qgis_mcp_pluginfolder inside the downloaded repository. - Copy it to the QGIS plugins folder. On Windows, the path is:
C:\Users\YOUR_USERNAME\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins. - Restart QGIS. Go to Plugins → Manage and Install Plugins, search for “QGIS MCP”, and check the box to activate it.
Step 3: Configuring Claude Desktop
Now we need to edit Claude’s configuration file. Go to Profile → Settings → Developer → Edit Config. The folder containing the claude_desktop_config.json file will open; you can edit it with Notepad.
This is the step where most people make mistakes. To avoid syntax errors (missing commas or brackets), especially if you already have other MCPs configured, the best approach is to copy the current content of your JSON file, your user path, and the example code, and paste it all into the Claude chat asking it to generate the complete and correct JSON. The block to be added has this structure:
{ "mcpServers": { "qgis": { "command": "uv", "args": [ "--directory", "C:/YOUR_PATH_TO_REPOSITORY/qgis_mcp/src/qgis_mcp", "run", "qgis_mcp_server.py" ] } } }
Important: The path in --directory must point specifically to the folder where the qgis_mcp_server.py file is located (inside src/qgis_mcp of the downloaded repository). Once you have the corrected JSON, paste it into the file and save with File → Save.
Step 4: Restart and Verification
This step is critical for the connection to work properly:
- Close QGIS and Claude Desktop.
- Open Task Manager (
Ctrl + Shift + Esc) and make sure to end any Claude processes still running in the background (right-click → End task). - It is recommended to restart your computer to avoid connection conflicts.
- Open QGIS, click on the QGIS MCP icon in the toolbar and press “Start Server”. You will see a message indicating that the server is running on port 9876.
- Open Claude Desktop – in the developer section, qgis-mcp should be running.
Testing the Connection
With both programs open and the MCP server started, you can ask Claude things like:
- Electoral analysis: “Add the canton layer, symbolize it by the winning party, and generate a Word report with the statistics.”
- Terrain analysis: “Read this Excel file of coordinates, draw the property polygon, and calculate the boundaries.”
- Modeling: “Use the DEM to generate contour lines every 20 meters and give them attractive symbology.”
- Cleanup: “Remove all duplicate layers from the layer panel.”
From here, Claude can execute PyQGIS commands, manage layers, and perform geoprocessing tasks in your QGIS project directly from the chat.
