The QGIS Model Context Protocol (MCP) integration allows Claude AI to directly communicate with and control QGIS. This powerful connection enables you to automate QGIS tasks through prompts, including project manipulation, layer handling, and processing algorithm execution.
Before installing the QGIS MCP server, ensure you have:
For macOS:
brew install uv
For Windows PowerShell:
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
Clone the repository to your local machine:
git clone [email protected]:jjsantos01/qgis_mcp.git
Locate your QGIS profile plugins folder:
C:\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 repository into your plugins folder
Restart QGIS
Enable the plugin:
Plugins
→ Installing and Managing Plugins
All
tabConfigure Claude to connect with QGIS:
Go to Claude
> Settings
> Developer
> Edit Config
> claude_desktop_config.json
Add the following configuration (replace the path with your actual repository location):
{
"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 connected, Claude will display a hammer icon with QGIS tools. Here are the main functions:
ping
- Test server connectivityget_qgis_info
- Get QGIS version informationget_project_info
- Get current project detailscreate_new_project
- Create a new QGIS projectload_project
- Load a project from a specified pathsave_project
- Save the current projectadd_vector_layer
- Add a vector layer to the projectadd_raster_layer
- Add a raster layer to the projectget_layers
- List all layers in the current projectremove_layer
- Remove a layer by IDzoom_to_layer
- Focus the map view on a specific layerget_layer_features
- Retrieve features from a vector layerexecute_processing
- Run a QGIS processing algorithmrender_map
- Export the current map view as an imageexecute_code
- Run custom PyQGIS code (use with caution)Here's an example of commands you can send to Claude to automate QGIS:
1. Check connection with ping
2. Create a new project and save it at a specific location
3. Load vector and raster layers
4. Execute a processing algorithm (like creating centroids)
5. Apply styling to create a choropleth map
6. Render the map to an image file
7. Save the project
When properly configured, Claude can execute these commands in sequence, performing complex GIS operations automatically.
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.
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 > 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"
]
}
}
}
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 explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.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