by jjsantos01
QGISMCP connects QGIS to Claude AI through the Model Context Protocol (MCP), enabling AI-powered interaction and control over QGIS Desktop for various geospatial tasks.
QGISMCP (QGIS Model Context Protocol) is a Python-based project that integrates QGIS Desktop with Claude AI via the Model Context Protocol (MCP). This allows users to control and interact with QGIS using natural language prompts through Claude AI, effectively bridging the gap between AI capabilities and geospatial data processing.
To use QGISMCP, you need to set up both the QGIS plugin and the MCP Server, and then configure Claude for Desktop to recognize the QGIS MCP server.
uv
package manager installed.qgis_mcp_plugin
folder into your QGIS profile plugins directory. Restart QGIS and enable the "QGIS MCP" plugin from the Plugins menu.claude_desktop_config.json
file in Claude's developer settings to include the QGIS MCP server configuration, specifying the command to run the qgis_mcp_server.py
.plugins
-> QGIS MCP
-> QGIS MCP
and click "Start Server".ping
, load_project
, add_vector_layer
, execute_processing
, and execute_code
.QGISMCP is ideal for users who want to streamline their geospatial workflows and leverage AI for more intuitive interaction with QGIS. Potential use cases include:
Q: What are the main components of QGISMCP? A: The system consists of two main components: a QGIS plugin that creates a socket server within QGIS, and an MCP Server (a Python server) that implements the Model Context Protocol and connects to the QGIS plugin.
Q: What versions of QGIS are supported? A: QGISMCP has been tested on QGIS 3.22, but it should be compatible with QGIS 3.X versions.
Q: Can I run arbitrary Python code in QGIS using Claude?
A: Yes, the execute_code
tool allows you to run arbitrary PyQGIS code. However, it's a very powerful tool and should be used with caution.
Q: How do I know if the connection between Claude and QGIS is working?
A: You can use the ping
command through Claude to check server connectivity. Once configured, Claude will also display a hammer icon with tools for the QGIS MCP, indicating that the integration is active.
Q: Where can I find more documentation or examples? A: The project's README provides detailed installation instructions, usage examples, and links to relevant documentation for both QGIS and the Model Context Protocol.
QGISMCP connects QGIS to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control QGIS. This integration enables prompt assisted project creation, layer loading, code execution and more.
This project is strongly based on the BlenderMCP project by Siddharth Ahuja
The system consists of two main components:
If you're on Mac, please install uv as
brew install uv
On Windows Powershell
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
Otherwise installation instructions are on their website: Install uv
⚠️ Do not proceed before installing UV
Download this repo to your computer. You can clone it with:
git clone git@github.com:jjsantos01/qgis_mcp.git
You need to copy the folder qgis_mcp_plugin and its content on your QGIS profile plugins folder.
You can get your profile folder in QGIS going to menu Settings
-> User profiles
-> Open active profile folder
Then, go to Python/plugins
and paste the folder qgis_mcp_plugin
.
On a Windows machine the plugins folder is usually located at:
C:\Users\USER\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins
and on MacOS:~/Library/Application\ Support/QGIS/QGIS3/profiles/default/python/plugins
Then close QGIS and open it again. Go to the menu option Plugins
-> Installing and Managing Plugins
, select the All
tab and search for "QGIS MCP", then mark the QGIS MCP checkbox.
Go to Claude
> Settings
> Developer
> Edit Config
> claude_desktop_config.json
to include the following:
If you cann't find the "Developers tab" or the
claude_desktop_config.json
look at this documentation.
{
"mcpServers": {
"qgis": {
"command": "uv",
"args": [
"--directory",
"/ABSOLUTE/PATH/TO/PARENT/REPO/FOLDER/qgis_mcp/src/qgis_mcp",
"run",
"qgis_mcp_server.py"
]
}
}
}
plugins
-> QGIS MCP
-> QGIS MCP
Once the config file has been set on Claude, and the server is running on QGIS, you will see a hammer icon with tools for the QGIS MCP.
ping
- Simple ping command to check server connectivityget_qgis_info
- Get QGIS information about the current installationload_project
- Load a QGIS project from the specified pathcreate_new_project
- Create a new project and save itget_project_info
- Get current project informationadd_vector_layer
- Add a vector layer to the projectadd_raster_layer
- Add a raster layer to the projectget_layers
- Retrieve all layers in the current projectremove_layer
- Remove a layer from the project by its IDzoom_to_layer
- Zoom to the extent of a specified layerget_layer_features
- Retrieve features from a vector layer with an optional limitexecute_processing
- Execute a processing algorithm with the given parameterssave_project
- Save the current project to the given pathrender_map
- Render the current map view to an image fileexecute_code
- Execute arbitrary PyQGIS code provided as a stringThis is the example I used for the demo:
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.
Please log in to share your review and rating for this MCP.