How jjsantos01/qgis_mcp works
Project type and purpose
• This is a specialized full‑stack integration tool connecting the QGIS desktop application to an LLM (Claude AI) via the Model Context Protocol (MCP).
• Its goal is to allow Claude AI to manipulate QGIS projects (load/save projects, layers, run processing algorithms, execute arbitrary Python code) by sending commands to a QGIS plugin over a socket.
File structure
• Top level:
• main.py – entry‑point (could be a CLI wrapper or legacy)
• pyproject.toml, uv.lock – Python packaging and lock files
• assets/ – screenshots and UI assets for the README
• qgis_mcp_plugin/ – the QGIS plugin directory:
• __init__.py, metadata.txt – plugin manifest
• qgis_mcp_plugin.py – initializes a socket server inside QGIS and dispatches commands to the PyQGIS API
• src/qgis_mcp/ – the MCP server implementation:
• qgis_mcp_server.py – an MCP server (using uv) that speaks the MCP JSON‑RPC over stdio to Claude
• qgis_socket_client.py – a TCP socket client that connects to the QGIS plugin’s internal socket server to forward MCP commands
• main responsibilities:
• QGIS plugin → hosts a socket server inside QGIS
• MCP server → speaks MCP to Claude, forwards requests to plugin via socket client
Extract additional insights from the README
• Two main components are explicitly called out: “QGIS plugin” and “MCP Server.”
• Claude desktop is configured to launch the MCP server via uv run qgis_mcp_server.py.
• A suite of tools (ping, load_project, add_layer, execute_processing, execute_code, etc.) define the RPC surface exposed by the MCP server.
Key points to capture
– Two separate processes (MCP server vs. QGIS plugin) linked via a TCP socket
– The MCP protocol layer decoupled from the QGIS domain logic
– File system interactions as a core part of project and data manipulation
– Ability to expand with new MCP methods by adding handlers in the server and plugin