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.
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.
Clone the repository to your computer:
git clone https://github.com/syauqi-uqi/qgis_mcp_modify1.git
Locate your QGIS profile plugins folder:
Settings
→ User profiles
→ Open active profile folder
Python/plugins
directoryC:\Users\USER\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins
~/Library/Application\ Support/QGIS/QGIS3/profiles/default/python/plugins
Copy the qgis_mcp_plugin
folder from the downloaded repository into the plugins directory
Restart QGIS
Enable the plugin:
Plugins
→ Installing and Managing Plugins
All
tabClaude
> Settings
> Developer
> Edit Config
> claude_desktop_config.json
{
"mcpServers": {
"qgis": {
"command": "uv",
"args": [
"--directory",
"#change this line to your directory#",
"run",
"qgis_mcp_server.py"
]
}
}
}
Plugins
→ QGIS MCP
→ QGIS MCP
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.
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.
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.
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"
]
}
}
}
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.
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.