QGIS MCP Server: Connect AI to Geospatial Analysis
A QGIS MCP server lets an AI assistant run geospatial queries, execute processing algorithms, and retrieve layer data through a standard tool call. Here is how to set up the connection, verify what the analysis produces, and keep dataset references and review decisions available across sessions.
Updated 4 min read
A QGIS MCP server connects an AI assistant to QGIS through a standard tool interface, letting you ask the assistant to run geospatial queries, apply processing algorithms, read layer attributes, and export results without switching out of your AI app. QGIS exposes a Python API (PyQGIS) that community MCP servers use to control the application and its data. Tools like fenbs keep dataset source links, analysis assumptions, and review decisions across sessions so each new session starts with the agreed context rather than rebuilding it.
QGIS MCP servers are community-built and depend on the QGIS Python API (opens in a new tab). Before setting one up, ensure you have QGIS installed with Python support and that the QGIS Python environment can run external packages.
Connect an AI assistant to QGIS
- Install a QGIS MCP server package into the QGIS Python environment. Check the MCP server directory and GitHub for available packages that expose the PyQGIS API.
- Configure the server to run either as a subprocess using stdio transport or as a local HTTP service. Stdio is simpler for a single-user setup on a desktop machine.
- Add the server to your AI client's MCP config. See MCP server configuration for the config file format.
- Open QGIS with a project loaded, then restart your AI client. Ask the assistant to list available tools and confirm it can read layer names or attribute fields from your current project.
- Run a simple read call first — list the layers in the project or query a feature count — before asking the assistant to run a processing algorithm.
What the AI can do with QGIS
Through the PyQGIS API, an AI assistant can read layer geometry and attributes, run QGIS processing algorithms (buffer, clip, join, reproject, and many more), execute spatial queries, style layers, and export results to common formats. The range of operations available depends on which tools the MCP server chooses to expose.
Write operations — modifying layer data, saving changes to source files, overwriting datasets — are possible through PyQGIS and should only be enabled if the assistant is expected to produce outputs, not just analyze inputs. Keep read access for exploration and limit write access to specific output operations.
Check analysis results before using them
Geospatial analysis is sensitive to coordinate reference systems, projection mismatches, and topology errors that an AI assistant may not detect. After the assistant runs a processing algorithm, check the output layer in QGIS: are the geometries where you expect them? Does the feature count make sense given the inputs?
Record the agreed check steps as rules in your project context — for example, "always verify CRS before any spatial join" or "export to EPSG:4326 before sharing with external parties." These rules travel with the project and apply in every session that touches the analysis.
Preserve dataset links and analysis assumptions
A geospatial project builds on specific data sources: the census boundary file from this vintage, the satellite imagery from that date, the land-use classification from this agency. Those references matter because the analysis is only reproducible if someone else can locate the same inputs.
fenbs keeps those references as Links and listings in the project, alongside the analysis assumptions and review decisions. When the analysis is handed to a colleague or revisited months later, the record shows exactly which data was used, what assumptions were in place, and what findings were reviewed and accepted.
QGIS releases regularly, and the Python API changes between major versions. An MCP server written against one QGIS version may not work with a later one without updates to the PyQGIS calls it uses. Check the QGIS changelog (opens in a new tab) when you update QGIS and test the MCP server against the new version before switching your primary installation. If team members use different QGIS versions, record the minimum required version as a rule in the project context. Also confirm that the server package dependencies do not conflict with other installed QGIS plugins that share the same Python environment, since a dependency conflict can break the plugin silently. Before deploying a QGIS MCP server update to a shared team machine, test it against the installed QGIS version on a development machine first. Check the QGIS Python console for import errors after installation; a console error is faster to diagnose than discovering a conflict through an AI session that returns no tools.
Keep dataset sources and analysis decisions across sessions
Add the data sources your QGIS analysis depends on as Links in fenbs, with the source, version, and access date. Record analysis conventions — coordinate reference systems, default projections, review steps — as Decisions and rules. The next session that opens the same project reads the agreed starting point without reconstructing it.
Create a free accountFree for one person · No credit card · Works with Claude, ChatGPT, Cursor and more
How to do this with fenbs
- Create a free account and add a project for the geospatial analysis work.
- Add each primary dataset as a link: source URL or file path, vintage or date accessed, coordinate reference system, and any known limitations.
- Record analysis conventions as Decisions and rules: CRS standards, required checks before a spatial join, export formats, review sign-off requirements.
- Connect your AI app to fenbs at Integrations. It reads the dataset references and rules before running any analysis.
- After each session, save progress: which analyses were completed, what was verified, and what the next session should check or produce.
fenbs does not connect to QGIS directly. It holds the dataset references and agreed conventions your assistant needs; the QGIS MCP server handles the live geospatial work.