Skip to main content
Glama

QGIS MCP Server

by jjsantos01

QGISMCP - QGIS モデルコンテキストプロトコル統合

QGISMCPは、モデルコンテキストプロトコル(MCP)を介してQGISClaude AIに接続し、ClaudeがQGISを直接操作して制御できるようにします。この統合により、迅速なプロジェクト作成、レイヤーの読み込み、コード実行などの支援が可能になります。

このプロジェクトは、Siddharth AhujaによるBlenderMCPプロジェクトに基づいています。

特徴

  • 双方向通信: ソケットベースのサーバーを介して Claude AI を QGIS に接続します。
  • プロジェクト操作: QGIS でプロジェクトを作成、読み込み、保存します。
  • レイヤー操作: プロジェクトにベクター レイヤーまたはラスター レイヤーを追加および削除します。
  • 処理の実行: 処理アルゴリズムを実行します ( Processing Toolbox )。
  • コード実行:Claude氏によるQGISで任意のPythonコードを実行できます。非常に強力なツールですが、使用には細心の注意が必要です。

コンポーネント

このシステムは、次の 2 つの主要コンポーネントで構成されています。

  1. QGIS プラグイン: コマンドを受信して実行するために QGIS 内にソケット サーバーを作成する QGIS プラグイン。
  2. MCP サーバー: モデル コンテキスト プロトコルを実装し、QGIS プラグインに接続する Python サーバー。

インストール

前提条件

  • QGIS 3.X (3.22 でのみテスト済み)
  • クラウドデスクトップ
  • Python 3.10以降
  • uv パッケージマネージャー:

Macをお使いの場合は、uvをインストールしてください。

brew install uv

Windows PowerShellの場合

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

それ以外の場合、インストール手順はウェブサイトに掲載されています: Install uv

⚠️UVをインストールする前に続行しないでください

ダウンロードコード

このリポジトリをコンピュータにダウンロードしてください。以下のコマンドでクローンできます。

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

QGISプラグイン

フォルダーqgis_mcp_pluginとその内容を 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タブを選択して「QGIS MCP」を検索し、「QGIS MCP」のチェックボックスをオンにします。

デスクトップ統合のクロード

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に移動します。プラグインメニュー
  2. 「サーバーを開始」をクリックしますサーバーを起動する

クロードと一緒に使う

Claude で設定ファイルが設定され、サーバーが QGIS で実行されると、QGIS MCP のツールが表示されたハンマー アイコンが表示されます。

クロードツール

ツール
  • 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.
-
security - not tested
F
license - not found
-
quality - not tested

local-only server

The server can only run on the client's local machine because it depends on local resources.

モデル コンテキスト プロトコルを介して Claude AI を QGIS に接続し、Claude がプロジェクトの作成、レイヤーの操作、コードの実行などのタスクで QGIS と直接対話して制御できるようにします。

  1. 特徴
    1. コンポーネント
      1. インストール
        1. 前提条件
        2. ダウンロードコード
        3. QGISプラグイン
        4. デスクトップ統合のクロード
      2. 使用法
        1. 接続の開始
        2. クロードと一緒に使う
        3. コマンド例

      Related MCP Servers

      • A
        security
        A
        license
        A
        quality
        Connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender for AI-assisted 3D modeling, scene manipulation, and rendering.
        Last updated -
        17
        11,778
        Python
        MIT License
        • Apple
      • -
        security
        F
        license
        -
        quality
        Connects Houdini to Claude AI through Model Context Protocol, enabling AI-assisted 3D modeling, scene creation, simulation setup, and rendering through natural language commands.
        Last updated -
        37
        • Apple
        • Linux
      • -
        security
        A
        license
        -
        quality
        Connects Ableton Live to Claude AI through the Model Context Protocol, enabling AI-assisted music production by allowing Claude to directly interact with and control Ableton Live sessions.
        Last updated -
        881
        Python
        MIT License
        • Apple
      • -
        security
        F
        license
        -
        quality
        Connects QGIS to Claude AI through the Model Context Protocol, enabling AI-assisted project creation, layer manipulation, processing algorithm execution, and Python code running within QGIS.
        Last updated -
        Python
        • Apple

      View all related MCP servers

      MCP directory API

      We provide all the information about MCP servers via our MCP API.

      curl -X GET 'https://glama.ai/api/mcp/v1/servers/jjsantos01/qgis_mcp'

      If you have feedback or need assistance with the MCP directory API, please join our Discord server