QGIS MCP
An MCP server that enables AI assistants to directly control QGIS for tasks like layer management, feature editing, and map rendering. It provides a suite of 50 tools to execute processing algorithms and manage GIS projects through natural language commands.
README
QGIS MCP
Connect QGIS to Claude AI through the Model Context Protocol (MCP), enabling Claude to directly control QGIS — manage layers, edit features, run processing algorithms, render maps, and more.
50 MCP tools covering layer management, feature editing, processing, rendering, styling, plugin development, and system management. Compatible with QGIS 3.28–4.x.
Architecture
Claude ←→ MCP Server (FastMCP) ←→ TCP socket ←→ QGIS Plugin (QTimer) ←→ PyQGIS API
- QGIS Plugin (
qgis_mcp_plugin/) — Runs inside QGIS. Non-blocking TCP socket server that processes JSON commands within QGIS's event loop. - MCP Server (
src/qgis_mcp/server.py) — Runs outside QGIS. Exposes QGIS operations as MCP tools via FastMCP.
Prerequisites
- QGIS 3.28 or newer
- Python 3.12+
- uv package manager — install uv
Installation
1. Clone the repository
git clone https://github.com/nkarasiak/qgis-mcp.git
cd qgis-mcp
2. Install the QGIS plugin
Copy (or symlink) the qgis_mcp_plugin/ folder into your QGIS plugins directory:
Find your plugins folder: In QGIS, go to Settings > User Profiles > Open Active Profile Folder, then navigate to python/plugins/.
| OS | Typical path |
|---|---|
| Linux | ~/.local/share/QGIS/QGIS3/profiles/default/python/plugins/ |
| macOS | ~/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/ |
| Windows | %APPDATA%\QGIS\QGIS3\profiles\default\python\plugins\ |
# Example on Linux (symlink recommended for development)
ln -s /path/to/qgis-mcp/qgis_mcp_plugin ~/.local/share/QGIS/QGIS3/profiles/default/python/plugins/qgis_mcp_plugin
Restart QGIS, then enable the plugin: Plugins > Manage and Install Plugins > search "QGIS MCP" > check the box.
3. Connect your MCP client
Claude Code — project-level config (recommended)
Create a .mcp.json file at the root of your clone:
{
"mcpServers": {
"qgis": {
"command": "uv",
"args": ["run", "src/qgis_mcp/server.py"],
"cwd": "/path/to/qgis-mcp"
}
}
}
Claude Code automatically detects .mcp.json when you open the project — no manual claude mcp add needed.
Claude Code — one-liner (remote install)
claude mcp add --transport stdio qgis-mcp -- uvx --from git+https://github.com/nkarasiak/qgis-mcp qgis-mcp-server
Claude Desktop
Go to Claude > Settings > Developer > Edit Config and add:
{
"mcpServers": {
"qgis": {
"command": "uv",
"args": ["run", "src/qgis_mcp/server.py"],
"cwd": "/path/to/qgis-mcp"
}
}
}
Or for a remote install without cloning:
{
"mcpServers": {
"qgis": {
"command": "uvx",
"args": [
"--from", "git+https://github.com/nkarasiak/qgis-mcp",
"qgis-mcp-server"
]
}
}
}
Cursor / other MCP clients
Use the same JSON configuration above in your client's MCP settings file.
Usage
- Start the plugin — In QGIS, click the MCP toolbar button (or
Plugins>QGIS MCP) and click "Start Server" - Talk to Claude — The MCP tools will appear automatically. Ask Claude to work with your QGIS project.
Example prompt
You have access to QGIS tools. Do the following:
1. Ping to check the connection
2. Create a new project and save it at "/tmp/my_project.qgz"
3. Load the vector layer "/data/cities.shp" and name it "Cities"
4. Get field statistics for the "population" field
5. Create a graduated symbology on the "population" field with 5 classes
6. Render the map and show me the result
7. Save the project
Tools (50)
| Category | Tools |
|---|---|
| Project | load_project, create_new_project, save_project, get_project_info |
| Layers | get_layers, add_vector_layer, add_raster_layer, remove_layer, find_layer, create_memory_layer, set_layer_visibility, zoom_to_layer, get_layer_extent, set_layer_property |
| Features | get_layer_features, add_features, update_features, delete_features, select_features, get_selection, clear_selection, get_field_statistics |
| Styling | set_layer_style (single, categorized, graduated) |
| Rendering | render_map, get_canvas_screenshot, get_canvas_extent, set_canvas_extent |
| Processing | execute_processing, list_processing_algorithms, get_algorithm_help |
| Layouts | list_layouts, export_layout |
| Layer tree | get_layer_tree, create_layer_group, move_layer_to_group |
| Plugins | list_plugins, get_plugin_info, reload_plugin |
| System | ping, get_qgis_info, get_raster_info, get_message_log, execute_code, batch_commands, validate_expression, get_project_variables, set_project_variable, get_setting, set_setting, transform_coordinates |
All tools are async with human-readable titles and annotations (readOnly, destructive, idempotent). Destructive tools ask for confirmation via MCP elicitation when supported; clients without elicitation proceed normally (fail-open) since tools are already gated by ToolAnnotations. Long-running tools report progress via MCP logging.
Configuration
| Environment variable | Default | Description |
|---|---|---|
QGIS_MCP_HOST |
localhost |
Host for socket connection |
QGIS_MCP_PORT |
9876 |
Port for socket connection |
QGIS_MCP_TRANSPORT |
stdio |
MCP transport: stdio or streamable-http |
Development
# Run unit tests (no QGIS needed — mocked socket)
uv run --no-sync pytest tests/test_mcp_tools.py -v
# Run integration tests (requires QGIS plugin running)
uv run --no-sync pytest tests/test_qgis_live.py -v
License
This project is open source. See CONTRIBUTING.md for guidelines.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。
mcp-server-qdrant
这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。