qgis_mcp
QGISMCP: Connect QGIS to AI for automated geospatial analysis via the Model Context Protocol (MCP).

qgis_mcp Solution Overview
QGISMCP is a powerful MCP solution that bridges the gap between QGIS and AI models like Claude, enabling seamless interaction and control of QGIS functionalities. As a server within the MCP ecosystem, it allows AI to directly manipulate QGIS projects, load and manage layers (both vector and raster), execute processing algorithms, and even run custom Python code within QGIS.
This integration empowers developers to automate complex geospatial tasks, create AI-driven mapping workflows, and build intelligent GIS applications. By providing tools for project creation, data loading, and geoprocessing, QGISMCP eliminates manual steps and accelerates geospatial analysis. The solution leverages a socket-based server within a QGIS plugin to receive commands from the AI client, offering a streamlined and efficient communication channel. QGISMCP unlocks the potential of AI-assisted GIS, making geospatial workflows more accessible and efficient.
qgis_mcp Key Capabilities
QGIS Project Management
QGISMCP empowers AI models to manage QGIS projects directly. It allows Claude AI to create new projects, load existing ones from specified paths, and save modified projects. This functionality is crucial for automating geospatial workflows, enabling AI to set up environments for specific tasks, such as disaster response planning or urban development analysis. For example, an AI could create a new QGIS project, load relevant layers like satellite imagery and infrastructure data, and save the project for further analysis, all without human intervention. This feature leverages the create_new_project
, load_project
, and save_project
tools, which interact with the QGIS API through the QGIS plugin's socket server.
Layer Manipulation and Integration
This feature enables AI models to dynamically add, remove, and manage layers within a QGIS project. Using tools like add_vector_layer
, add_raster_layer
, and remove_layer
, Claude AI can integrate various geospatial data sources into a project, tailoring the data environment to the specific analytical needs. For instance, an AI could add a shapefile containing city boundaries and a raster layer representing population density to analyze urban sprawl. The AI can also retrieve information about existing layers using get_layers
. This dynamic layer management is essential for automated data processing pipelines and allows AI to adapt to changing data availability and project requirements. The QGIS plugin handles the communication between the MCP server and QGIS, ensuring seamless layer integration.
Geospatial Processing Execution
QGISMCP allows AI models to execute QGIS processing algorithms directly, unlocking powerful geospatial analysis capabilities. The execute_processing
tool enables Claude AI to run algorithms from the QGIS Processing Toolbox, such as buffer analysis, spatial joins, and network analysis. For example, an AI could execute a buffer analysis on a layer of schools to identify areas within a certain distance of educational facilities, aiding in resource allocation planning. The ability to automate these processes significantly reduces the manual effort required for geospatial analysis and allows AI to perform complex tasks autonomously. This functionality relies on the QGIS Processing Framework, which is accessed through the QGIS plugin.
Arbitrary Code Execution
The execute_code
tool allows the execution of arbitrary Python code within the QGIS environment. This provides immense flexibility, enabling AI models to perform custom operations and analyses beyond the built-in QGIS functionalities. However, this feature requires caution due to potential security risks. For example, an AI could use this tool to implement a custom spatial analysis algorithm or to automate complex data transformations. This feature is particularly useful for advanced users who need to extend QGIS capabilities with custom scripts. The QGIS plugin executes the provided Python code within the QGIS environment, providing access to the PyQGIS API.