Skip to main content
Glama
joshdels

free-transmission-wildlife

by joshdels

基于 MCP 的 AI 辅助输电线路与野生动物分析

使用场景

一个野生动物保护组织希望监测加利福尼亚州圣华金谷的输电基础设施对野生动物和受保护土地的潜在影响。

该组织资金有限,无法持续进行人工 GIS 分析,也无法使用传统 GIS 软件检查大型空间数据集。他们需要一种简单的方式,就输电线路和野生动物区域提出空间问题并获得分析结果,而无需手动编写 SQL 或执行 GIS 操作。

本项目使用 Model Context Protocol (MCP) 将 Claude 连接到存储在 GIS 文件中并通过 DuckDB 查询的空间数据。

用户无需手动打开 GIS 软件并执行空间分析,而是可以用自然语言向 Claude 提问。

示例:

Which wildlife areas intersect transmission lines?

Which transmission lines pass through public access lands?

How many transmission line segments intersect wildlife areas?

What wildlife areas are within 1 kilometer of a transmission line?

Show me the transmission lines that have potential impacts on wildlife areas.

Claude 会解读请求,使用 MCP 服务器访问空间数据,执行所需的 DuckDB 空间查询,并以可读格式返回结果。

Related MCP server: PostGIS Yukon MCP

目标

主要目标是演示如何将 AI、MCP、DuckDB 和空间数据结合起来,打造一个轻量级的 GIS 分析助手。

本项目重点包括:

  1. 以自然语言访问空间数据集

  2. 无需用户编写 SQL 即可进行空间查询

  3. 输电线路与野生动物区域分析

  4. 低成本 GIS 数据处理

  5. 通过 DuckDB 进行可复现的空间分析

  6. 直接通过 Claude 返回分析结果

数据

本项目目前使用两个空间数据集:

输电线路

以 Shapefile 表示的输电线路基础设施。

data/
└── transmission_lines/
    └── TransmissionLine_CEC.shp

野生动物 / 公共开放土地

以 Shapefile 表示的 California Department of Fish and Wildlife 公共开放土地数据。

data/
└── public_lands/
    └── CDFW_Public_Access_Lands_[ds3077].shp

这些数据集通过 DuckDB Spatial 扩展加载到 DuckDB 中。

架构

基本架构如下:

User
  |
  | Natural-language question
  v
Claude
  |
  | MCP
  v
MCP Server
  |
  | DuckDB Spatial SQL
  v
Spatial Datasets
  |
  +-- Transmission Lines
  |
  +-- Wildlife / Public Access Lands
  |
  v
Analysis Result
  |
  v
Claude Response

MCP 服务器充当 Claude 与空间数据库层之间的桥梁。

DuckDB 执行实际的数据处理和空间操作。

技术栈

  1. Python 3.14

  2. DuckDB

  3. DuckDB Spatial

  4. MCP Python

  5. PyArrow

  6. Pandas

  7. Claude

项目结构

free-transmission-wildlife/
│
├── app/
│   ├── db/
│   │   ├── load_data.py
│   │   └── queries.py
│   │
│   └── server/
│       └── server.py
│
├── data/
│   ├── transmission_lines/
│   │   └── TransmissionLine_CEC.shp
│   │
│   └── public_lands/
│       └── CDFW_Public_Access_Lands_[ds3077].shp
│
├── pyproject.toml
├── uv.lock
├── Makefile
└── README.md

快速开始

本项目使用 uv 进行 Python 环境与依赖管理。

安装项目依赖:

uv sync

开发

以开发模式启动 MCP 服务器:

make dev

这会运行:

uv run mcp dev app/server/server.py

开发服务器可用于测试 MCP 工具并检查其行为。

Claude 安装

为 Claude 安装 MCP 服务器:

make install

这相当于运行:

uv run mcp install app/server/server.py

安装完成后,MCP 服务器即可供 Claude 使用。

运行应用程序

安装 MCP 服务器后,打开 Claude 并开始询问有关空间数据集的问题。

例如:

Show me the schema of the transmission lines dataset.
Show me the schema of the wildlife lands dataset.
Find transmission lines that intersect wildlife lands.
How many wildlife areas intersect transmission lines?
Which transmission lines have the greatest number of wildlife intersections?

MCP 服务器会将这些请求转换为对 DuckDB 的操作。

空间分析

本项目旨在支持以下空间操作:

  • 相交

  • 包含于

  • 距离分析

  • 缓冲区分析

  • 几何检查

  • 空间过滤

  • 聚合

  • 相交要素计数

  • 面积计算

  • 长度计算

例如,相交分析在概念上可以表示为:

SELECT
    t.*,
    w.*
FROM transmission_lines t
JOIN wildlife_lands w
    ON ST_Intersects(t.geom, w.geom);

这样,DuckDB 可以执行空间分析,而 Claude 提供自然语言界面。

输出

结果通过 Claude 以 Markdown 形式返回。

示例:

Transmission lines intersecting wildlife lands

| Transmission Line | Wildlife Area | Intersection |
|-------------------|---------------|--------------|
| Line A             | Area 001      | Yes          |
| Line B             | Area 014      | Yes          |
| Line C             | Area 021      | Yes          |

Total intersecting transmission lines: 3

目标是让用户无需理解 SQL 或 DuckDB 即可看懂分析结果。

为什么选择 DuckDB

DuckDB 提供了一个轻量级分析数据库,无需传统数据库服务器即可直接查询数据。

结合 Spatial 扩展,它可以在保持相对简单架构的同时执行 GIS 操作。

因此,本项目原型不需要 PostgreSQL/PostGIS。

架构如下:

Shapefile / GeoParquet
        |
        v
      DuckDB
        |
        v
  DuckDB Spatial
        |
        v
    MCP Server
        |
        v
      Claude

这使本项目适合用于 AI 辅助 GIS 分析的实验。

未来发展

未来可能的改进包括:

  1. 从 Shapefile 迁移到 GeoParquet

  2. 添加更多加利福尼亚州野生动物数据集

  3. 添加宗地数据集

  4. 添加保护区

  5. 添加环境约束数据集

  6. 添加距离与缓冲区分析

  7. 添加自动化空间报告

  8. 添加地图可视化

  9. 为 Web 地图返回 GeoJSON 结果

  10. 将空间数据部署到云对象存储

  11. 添加更大规模的空间数据集

  12. 构建 AI 辅助的 GIS 分析工作流

项目目标

长期目标是证明:将传统 GIS 数据处理与自然语言 AI 界面相结合,可以让空间分析变得更加易于使用。

无需要求每位用户都掌握 GIS 软件、SQL 和空间数据库操作,用户可以用自然语言描述问题,然后让 Claude 通过 MCP 和 DuckDB 协调分析。

F
license - not found
Not graded
quality - not tested
A
maintenance

Maintenance

Maintainers
Response time
0dRelease cycle
2Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • F
    license
    Not graded
    quality
    Not graded
    maintenance
    An Iceberg-native geospatial MCP server powered by DuckDB that provides tools for spatial SQL queries, catalog discovery, and data management. It enables LLM agents to interact with Apache Iceberg lakehouses to perform complex spatial analysis, joins, and aggregations.
    1
  • A
    license
    Not graded
    quality
    F
    maintenance
    Enables natural language and geospatial queries on PostGIS databases, with 32 tools for spatial analysis, geometry operations, and database management.
    4
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    An MCP server that connects AI agents to cloud-native geospatial data via STAC metadata and DuckDB with H3 spatial indexing, enabling zero-configuration SQL queries on terabyte-scale datasets over S3.
    23
    BSD 3-Clause
  • A
    license
    Not graded
    quality
    C
    maintenance
    Connects AI assistants (Claude, Cursor, etc.) to QGIS 4.x via MCP, enabling natural language-driven GIS workflows through 37+ tools, including data loading, processing, and spatial analysis.
    GPL 2.0

View all related MCP servers

Related MCP Connectors

  • MCP server giving Claude AI access to 22+ NYC public-record databases for real estate due diligence

  • Analytical memory for AI agents: a real Postgres queried in plain English over MCP. One command.

  • GibsonAI MCP server: manage your databases with natural language

View all MCP Connectors

Latest Blog Posts

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/joshdels/free-transmission-wildlife'

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