跳到主要内容
StableGIS & Geospatial

MCP for QGIS — Connect AI Agents to QGIS

地理空间工作的失败往往是安静的。坐标系不匹配、几何无效、字段类型错误,会产出看起来合理、实际错误的结果——所以每一步操作都要校验。

Read-only by default8 typed toolsCheckpointed writes
Technical specification
宿主软件
QGIS 3.34 LTR, 3.40 and newer
运行时
Python 3.11+ with the QGIS Python bindings
传输方式
stdio (desktop) and streamable HTTP (server deployments)
安装方式
QGIS plugin + npx dccmcp-qgis
运算引擎
Processing framework, GDAL/OGR, GRASS, SAGA (when installed)
支持平台
Windows, macOS, Linux
Last reviewed
2026-09-20
概述

什么是 MCP for QGIS?

MCP for QGIS is a local MCP server plus a QGIS plugin that connects AI agents to a real QGIS session. Agents discover 8 typed tools — including project.inspect, layer.load, layer.style_apply and crs.reproject — and call them to inspect, create, modify and validate work inside the live application.

Unlike generated QGIS scripts, every call is validated against your current document, classified as read, write or execute, and recorded in an audit log. QGIS stays open, the document stays live, and destructive operations are checkpointed so they can be rolled back.

It works with Claude Code, Codex, Cursor, GitHub Copilot, Claude Desktop, Gemini CLI, Trae, Doubao, Qwen Code, CodeBuddy, Custom MCP clients, Server-side automation over stdio or streamable HTTP.

  • 宿主软件: QGIS 3.34 LTR, 3.40 and newer
  • 运行时: Python 3.11+ with the QGIS Python bindings
  • 传输方式: stdio (desktop) and streamable HTTP (server deployments)
为什么会失败

没有契约时,让 Agent 驱动 QGIS 会出什么问题

01

坐标系错误会产出「自信的废话」

在错误的时机做投影转换,或混用不同坐标系的图层,会得到差几个数量级的量测结果,而地图渲染起来毫无异常。

02

无效几何会拖垮下游工具

自相交与碎屑多边形会在叠加运算中一路传播,直到交付给客户一份坏数据集。

03

分析过程不可复现

当算法、参数与输入版本都没被记录时,没人能重跑上季度的分析并得到相同结果。

如何工作

MCP for QGIS 如何保住设计意图、结构与可追溯性

一个 MCP Server 加一个 QGIS 插件,把 PyQGIS、处理框架与布局/图集工具暴露为类型化工具,让 Agent 能带着完整来源信息分析与发布空间数据。

从构造上就感知坐标系

每个几何工具都会声明工作坐标系,服务会确定性地做投影转换,而不是预设各图层一致。

先校验,再分析

几何有效性、字段类型与拓扑检查在叠加运算之前执行,自动修复会被报告而不是被隐藏。

算法来源记录

处理调用会记录算法 ID、参数、QGIS 版本与输入图层指纹,让结果可以精确复现。

可直接发布的布局

Agent 更新打印布局、地图范围、图例与图集覆盖层设置,然后导出可印刷的 PDF。

工具参考

MCP for QGIS 工具清单与风险等级

Agent 在连接时就能发现这份清单。你可以决定哪些自动放行、哪些需要人工确认、哪些在生产文件中直接禁用。

工具名与参数签名保持英文——它们是 Agent 实际调用的接口。

  • project.inspectProject CRS, layer tree, data sources, styles and layout inventory.read
  • layer.loadLoad vector or raster layers from files, databases or remote services.write
  • layer.style_applyApply categorized, graduated or rule-based symbology from a specification.write
  • crs.reprojectReproject layers or selections with explicit source and target CRS validation.write
  • geometry.validateDetect invalid geometry, report the failure type and optionally repair.write
  • processing.runExecute any registered processing algorithm with typed parameters and provenance capture.execute
  • sql.queryRun read-only SQL against vector layers through the QGIS expression engine.read
  • layout.exportUpdate layouts and atlases, then export PDF, PNG or SVG outputs.execute
安装

四步安装 MCP for QGIS

全部本地运行。服务默认只绑定回环地址,且只暴露你在 QGIS 中批准的工具。

预发布。 以下命令描述的是我们即将发布的接口,软件包尚未发布。 Get notified when MCP for QGIS launches.

STEP 01

安装 QGIS 插件

通过 QGIS 插件管理器安装 DCCMCP 插件,并在「插件」菜单里启用。

STEP 02

启动服务

服务会挂接到正在运行的 QGIS 实例,并注册你安装环境里可用的处理算法。

npx dccmcp-qgis@latest serve --project inbox.qgz
STEP 03

注册客户端

把服务注册到 Claude Code、Codex、Cursor、OpenClaw 或任何其他 MCP 客户端。共享部署请使用带令牌鉴权的 HTTP 传输。

{
  "mcpServers": {
    "qgis": { "command": "npx", "args": ["dccmcp-qgis", "serve"] }
  }
}
STEP 04

锁定工作坐标系

定义 Agent 允许写入的项目坐标系,避免分析在坐标系之间悄悄漂移。

dccmcp policy crs --project EPSG:3857 --allow-read-any

MCP for QGIS works with the agents you already use

  • Claude Code
  • Codex
  • Cursor
  • GitHub Copilot
  • Claude Desktop
  • Gemini CLI
  • Trae
  • Doubao
  • Qwen Code
  • CodeBuddy
  • Custom MCP clients
  • Server-side automation

Any other MCP-compatible client works too — one config entry, stdio by default.

Read the docs
常见问题

团队在安装前最常问的问题

如果没有覆盖到你的问题,直接写信给我们——技术问题我们给技术回答。
  • 投影转换是独立的显式工具调用,源与目标坐标系始终会被报告。只读工具绝不会修改底层数据。

  • 支持。处理框架是通用暴露的,因此你 QGIS 配置里安装的任何算法提供者都能被 Agent 发现。

  • 布局与图集都可以更新并导出为 PDF、PNG 或 SVG。图集覆盖层、过滤表达式与地图范围都可脚本化。

  • 每次写入与执行调用都会记录项目指纹、工具参数与产出结果,因此项目可以跨会话做差异比对。

  • 不是。它运行在你自己或自建的 QGIS 环境上。共享服务器部署可选用 HTTP 传输,且完全停留在你的基础设施内。

npx dccmcp-blender@latest serve

Put an agent inside your real tools — without putting your pipeline at risk

Install an integration, set a policy, and let your agent inspect, build and validate work in Blender, Maya, Houdini, 3ds Max, Rhino, ZBrush, Photoshop, FreeCAD, QGIS or OpenCV. Free to start, local by default.

macOS · Windows · Linux — no cloud dependency required