Token导航 LogoToken导航TokenDH.com
qgis MCP logo
搜索检索HTTP官方级别未说明来源级核验

qgis MCP

MCP Server

Model Context Protocol (MCP) that allows LLMs to use QGIS Desktop

工具数

0

提示词数

0

GitHub Stars

949

资源数

0
自动化处理PythonClaudeClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

jjsantos01

提供方

jjsantos01

最后核验

2026/5/18 04:07

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

QGISMCP - QGIS模型上下文协议集成

QGISMCP 连接 QGIS(读作“Q-Eye-ess”,但通常直接称为“QGIS”) 到;向;朝 克劳德AI 通过 模型上下文协议(MCP)这使得克劳德能够直接与QGIS进行交互并控制它。这种集成使得快速创建项目、加载图层、执行代码等操作变得更为便捷。

特点/功能

  • 双向沟通通过基于套接字的服务器将Claude AI连接到QGIS。
  • 项目操纵在QGIS中创建、加载和保存项目。
  • 图层操作向项目中添加或移除矢量图层或栅格图层。
  • 执行处理执行处理算法(处理工具箱)。
  • 代码执行在QGIS中通过Claude运行任意Python代码。功能非常强大,但使用此工具时也需格外谨慎。

组件

该系统由两个主要组件构成:

  1. QGIS插件一个QGIS插件,用于在QGIS内创建一个套接字服务器以接收并执行命令。
  2. MCP 服务器一个实现了模型上下文协议并连接到QGIS插件的Python服务器。

安装

先决条件

  • QGIS 3.X(仅在3.22版本上测试过)
  • Claude 桌面版
  • Python 3.10 或更高版本
  • UV包管理器:

如果你使用的是Mac,请安装uv作为

brew install uv

在 Windows PowerShell 中

powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

否则,安装说明可在其网站上找到: 安装uv

⚠️ 未安装UV前请勿继续

下载代码

将此仓库下载到您的电脑。您可以使用以下命令克隆它:

git clone git@github.com:jjsantos01/qgis_mcp.git

QGIS插件

你需要复制这个文件夹 qgis_mcp_plugin(可译为“QGIS MCP 插件”) 并将其内容放到您的QGIS配置文件插件文件夹中。

你可以在QGIS中通过菜单获取你的配置文件文件夹 Settings -> User profiles -> Open active profile folder 然后,前往 Python/plugins 并粘贴该文件夹 qgis_mcp_plugin

在Windows机器上,插件文件夹通常位于: C:\Users\USER\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins

在MacOS上: ~/Library/Application\ Support/QGIS/QGIS3/profiles/default/python/plugins

然后关闭QGIS并重新打开它。前往菜单选项 Plugins > Installing and Managing Plugins,选择 All 按Tab键并搜索“QGIS MCP”,然后勾选QGIS MCP复选框。

桌面集成版的Claude

首选 Claude > Settings > Developer > Edit Config > claude_desktop_config.json 包括以下内容:

如果你找不到“开发者选项卡”或 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"
            ]
        }

    }
}

使用方法

开始连接

  1. 在QGIS中,前往 plugins > QGIS MCP > QGIS MCP

plugins menu

  1. 点击“启动服务器”

start server

与Claude一起使用

一旦在Claude上设置了配置文件,并且服务器在QGIS上运行,您将看到一个带有QGIS MCP工具的锤子图标。

Claude tools

工具

  • ping - 使用简单的ping命令检查服务器连接性
  • get_qgis_info - 获取当前安装的QGIS信息
  • load_project - 从指定路径加载QGIS项目
  • create_new_project - 创建一个新项目并保存它
  • get_project_info - 获取当前项目信息
  • add_vector_layer - 将一个矢量图层添加到项目中
  • add_raster_layer - 向项目中添加一个栅格图层
  • get_layers - 获取当前项目中的所有图层
  • remove_layer - 通过ID从项目中移除一层
  • zoom_to_layer - 缩放到指定图层的范围
  • get_layer_features - 从矢量图层中检索特征,可选限制数量
  • execute_processing - 使用给定参数执行处理算法
  • save_project - 将当前项目保存到指定路径
  • render_map - 将当前地图视图渲染为图像文件
  • execute_code - 执行作为字符串提供的任意PyQGIS代码

示例命令

这是我用来举的例子 演示:

You have access to the tools to work with QGIS. You will do the following:
	1. Ping to check the connection. If it works, continue with the following steps.
	2. Create a new project and save it at: "C:/Users/USER/GitHub/qgis_mcp/data/cdmx.qgz"
	3. Load the vector layer: ""C:/Users/USER/GitHub/qgis_mcp/data/cdmx/mgpc_2019.shp" and name it "Colonias".
	4. Load the raster layer: "C:/Users/USER/GitHub/qgis_mcp/data/09014.tif" and name it "BJ"
	5. Zoom to the "BJ" layer.
	6. Execute the centroid algorithm on the "Colonias" layer. Skip the geometry check. Save the output to "colonias_centroids.geojson".
	7. Execute code to create a choropleth map using the "POB2010" field in the "Colonias" layer. Use the quantile classification method with 5 classes and the Spectral color ramp.
	8. Render the map to "C:/Users/USER/GitHub/qgis_mcp/data/cdmx.png"
	9. Save the project.

目录标签

目录标签

自动化处理PythonClauderesearch-and-data地理信息系统本地部署AI集成Python脚本QGIS插件

支持客户端

Claude

接入字段

传输方式(transport,传输协议)

HTTP

鉴权方式(authType,认证方式)

none

部署方式(deploymentType,部署类型)

local-only

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

HTTPnonelocal-only

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP