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

  1. 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.
  2. 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.
  3. Add the server to your AI client's MCP config. See MCP server configuration for the config file format.
  4. 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.
  5. 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.

How fenbs helps

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 account

Free for one person · No credit card · Works with Claude, ChatGPT, Cursor and more

How to do this with fenbs

  1. Create a free account and add a project for the geospatial analysis work.
  2. Add each primary dataset as a link: source URL or file path, vintage or date accessed, coordinate reference system, and any known limitations.
  3. Record analysis conventions as Decisions and rules: CRS standards, required checks before a spatial join, export formats, review sign-off requirements.
  4. Connect your AI app to fenbs at Integrations. It reads the dataset references and rules before running any analysis.
  5. 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.

Questions people ask.

Is there an official QGIS MCP server?

QGIS does not publish an official MCP server. Community servers use the PyQGIS API to expose QGIS functionality. Search GitHub for available packages, and check the QGIS Python API documentation at qgis.org/pyqgis/ to understand what operations are available.

What does the AI assistant need to run QGIS through MCP?

QGIS must be running with a project loaded, and the MCP server must be running in the same Python environment. The AI client connects to the MCP server, which in turn calls the PyQGIS API to interact with the QGIS application.

How do I prevent the AI from overwriting my source data?

Configure the MCP server to expose only read operations and designated output paths. Keep write access limited to specific export or scratch layer operations. Document the permitted write paths as a rule in your project context.

What geospatial operations can an AI run through QGIS MCP?

Read layer attributes and geometry, run processing algorithms (buffer, clip, join, dissolve, reproject, and others in the QGIS processing toolbox), execute spatial queries, and export results. The exact set of operations depends on what the MCP server chooses to expose.

Where should I record which datasets a QGIS analysis used?

Add them as links in a shared project tool such as fenbs, with the source, version or access date, and coordinate reference system. This makes the analysis reproducible and gives the next session a clear starting point without re-querying the QGIS project file.

More in Connect your AI tools

All Connect your AI tools articles

Start with one thing.

Free for one person · No credit card · Works with Claude, ChatGPT, Cursor and more

There is nothing to set up first. Write one line and you’ve started.