QGIS MCP
Connects QGIS to an LLM through the Model Context Protocol, allowing agentic interaction with and control of QGIS for prompt-assisted project creation, layer loading, code execution, and more.
README
QGIS MCP (hardened fork)
QGIS MCP connects QGIS to an LLM through the Model Context Protocol (MCP), allowing agentic interaction with and control of QGIS. This enables prompt-assisted project creation, layer loading, code execution and more.
Attribution & lineage
This is a hardened fork, distributed under GPL v3 (see LICENSE). Credit to the chain it builds on:
- BlenderMCP by Siddharth Ahuja — the original concept.
- QGIS MCP by Juan Santos Ochoa (jjsantos01) — the QGIS adaptation this is based on.
- QGIS2OllamaMCP by Anita Graser — the immediate upstream of this fork.
What this fork changes
See CHANGELOG.md for details. In short, two security hardening changes (both untested against a live QGIS — verify locally before relying on them):
- Shared-secret token on the plugin socket (port 9876). The plugin generates a random token in
~/.qgis_mcp/tokenon first run; the MCP server reads the same file and must present the token, so other local processes can't drive QGIS just by reaching the socket. - Loopback-only MCP server. The MCP server (port 9877) now binds explicitly to
127.0.0.1, so it is never exposed to your network regardless of library defaults.
⚠️ Security note: by design this tool lets the LLM run arbitrary Python inside QGIS (the
execute_codetool). Only run the plugin/server while you are actively using it, and only on a machine you trust. After starting, confirm port 9877 is on127.0.0.1withnetstat -ano | findstr 9877.The token check is fail-open: if the plugin cannot read or write
~/.qgis_mcp/token, it logs a warning and runs without authentication rather than refusing to start. Watch the QGIS log to confirm the token loaded.
Components
The system consists of two main components:
- QGIS plugin: A QGIS plugin that creates a socket server within QGIS to receive and execute commands.
- MCP Server: A Python server that implements the Model Context Protocol and connects to the QGIS plugin.
Installation
Prerequisites
- QGIS 3.X (tested with 3.38)
- Ollama and model with support for agents (tested with ministral-3:latest)
- For the MCP server Python environment:
pip install fastmcp ollama(the upstreamrequestsandlupaare not used by this code and are omitted)
QGIS plugin
To install the plugin, you need to copy the folder qgis_mcp_hardened and its content into your QGIS plugins folder. The folder is named qgis_mcp_hardened (not qgis_mcp_plugin) on purpose, so it does not collide with the official qgis_mcp_plugin on plugins.qgis.org.
Usage
Starting the connection in QGIS
- In QGIS, go to
plugins>QGIS2OllamaMCP>QGIS2OllamaMCP
- Click "Start Server"
Will launch on localhost:9876 by default. - Check the logs to see the connection status

Starting the MCP server
python src/qgis_mcp/qgis_mcp_server.py
Will launch on localhost:9877/sse by default (bound to 127.0.0.1).
Tools
ping- Simple ping command to check server connectivityget_qgis_info- Get QGIS information about the current installationload_project- Load a QGIS project from the specified pathcreate_new_project- Create a new project and save itget_project_info- Get current project informationadd_vector_layer- Add a vector layer to the projectadd_raster_layer- Add a raster layer to the projectget_layers- Retrieve all layers in the current projectremove_layer- Remove a layer from the project by its IDzoom_to_layer- Zoom to the extent of a specified layerget_layer_features- Retrieve features from a vector layer with an optional limitexecute_processing- Execute a processing algorithm with the given parameterssave_project- Save the current project to the given pathrender_map- Render the current map view to an image fileexecute_code- Execute arbitrary PyQGIS code provided as a string
Starting the conversation
You can launch an example conversation using:
python src/qgis_mcp/qgis_mcp_client.py
Note: you need to update the project file path to point to a project file on your machine.
Then launch the interactive client to start experimenting:
python src/qgis_mcp/qgis_mcp_client_interactive.py
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。