QGISMCP connects QGIS to Claude AI through the Model Context Protocol (MCP), enabling Claude to directly interact with and control QGIS. This integration allows for prompt-assisted project creation, layer loading, code execution, and more through a two-way communication system.
To install the uv package manager:
On Mac:
brew install uv
On Windows PowerShell:
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
For other platforms, visit the uv installation guide.
Clone the repository to your computer:
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/pluginsSettings → User profiles → Open active profile folder and then go to Python/pluginsCopy the qgis_mcp_plugin folder from the downloaded repository to your QGIS plugins folder
Restart QGIS
Enable the plugin by going to Plugins → Installing and Managing Plugins, select the All tab, search for "QGIS MCP", and check the QGIS MCP checkbox
Claude → Settings → Developer → Edit Config → claude_desktop_config.json{
"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 MCPOnce the connection is established, you'll see a hammer icon in Claude with the following tools:
Here's a sample prompt you can use with Claude:
You have access to the tools to work with QGIS. Please:
1. Ping to check the connection
2. Create a new project and save it at: "C:/Users/USER/Projects/my_project.qgz"
3. Load the vector layer: "C:/Users/USER/Data/boundaries.shp" and name it "Boundaries"
4. Load the raster layer: "C:/Users/USER/Data/elevation.tif" and name it "Elevation"
5. Zoom to the "Boundaries" layer
6. Execute the centroid algorithm on the "Boundaries" layer, saving to "centroids.geojson"
7. Execute code to create a choropleth map using the "Population" field
8. Render the map to "C:/Users/USER/Projects/map.png"
9. Save the project
Claude will execute these commands sequentially, interacting with QGIS through the MCP connection.
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.json2. 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