Skip to main content
Glama

GeoServer MCP Server

MIT License
18
  • Linux
  • Apple

GeoServer MCP 服务器

阿尔法

0.4.0(Alpha)版本正在积极开发中,即将发布。我们欢迎开发者贡献代码,共同构建这个项目。

🎥 演示

📋 目录

🚀 功能

  • 🔍 查询和操作 GeoServer 工作区、图层和样式
  • 🗺️ 对矢量数据执行空间查询
  • 🎨 生成地图可视化
  • 🌐 访问符合 OGC 标准的 Web 服务(WMS、WFS)
  • 🛠️ 轻松与 MCP 兼容客户端集成

📋 先决条件

  • Python 3.10 或更高版本
  • 运行启用 REST API 的 GeoServer 实例
  • MCP 兼容客户端(如 Claude Desktop 或 Cursor)
  • 用于软件包安装的互联网连接

🛠️ 安装

选择最适合您需要的安装方法:

🛠️ 安装(Docker)

Docker 安装是运行 GeoServer MCP 服务器最快捷、最独立的安装方式。它非常适合:

  • 快速测试和评估
  • 生产部署
  • 想要避免 Python 依赖的环境
  • 跨不同系统的一致部署
  1. 运行 geoserver-mcp:
docker pull mahdin75/geoserver-mcp docker run -d mahdin75/geoserver-mcp
  1. 配置客户端:

如果您使用的是 Claude Desktop,请编辑claude_desktop_config.json如果您使用的是 Cursor,请创建.cursor/mcp.json

{ "mcpServers": { "geoserver-mcp": { "command": "docker", "args": [ "run", "-i", "--rm", "-e", "GEOSERVER_URL=http://localhost:8080/geoserver", "-e", "GEOSERVER_USER=admin", "-e", "GEOSERVER_PASSWORD=geoserver", "-p", "8080:8080", "mahdin75/geoserver-mcp" ] } } }

🛠️ 安装(pip)

对于大多数希望直接在系统上运行服务器的用户,建议使用 pip 安装。此方法最适合:

  • 想要在本地运行服务器的普通用户
  • 安装了 Python 3.10+ 的系统
  • 想要自定义服务器配置的用户
  • 开发和测试目的
  1. 安装 uv 包管理器。
pip install uv
  1. 创建虚拟环境(Python 3.10+):

Linux/Mac:

uv venv --python=3.10

Windows PowerShell:

uv venv --python=3.10
  1. 使用 pip 安装包:
uv pip install geoserver-mcp
  1. 配置GeoServer连接:

Linux/Mac:

export GEOSERVER_URL="http://localhost:8080/geoserver" export GEOSERVER_USER="admin" export GEOSERVER_PASSWORD="geoserver"

Windows PowerShell:

$env:GEOSERVER_URL="http://localhost:8080/geoserver" $env:GEOSERVER_USER="admin" $env:GEOSERVER_PASSWORD="geoserver"
  1. 启动服务器:

如果您要使用 Claude 桌面,则无需执行此步骤。对于游标或您自己的自定义客户端,您应该运行以下代码。

Linux:

source .venv/bin/activate geoserver-mcp

或者

source .venv/bin/activate geoserver-mcp --url http://localhost:8080/geoserver --user admin --password geoserver --debug

Windows PowerShell:

.\.venv\Scripts\activate geoserver-mcp

或者

.\.venv\Scripts\activate geoserver-mcp --url http://localhost:8080/geoserver --user admin --password geoserver --debug
  1. 配置客户端:

如果您使用的是 Claude Desktop,请编辑claude_desktop_config.json如果您使用的是 Cursor,请创建.cursor/mcp.json

视窗:

{ "mcpServers": { "geoserver-mcp": { "command": "C:\\path\\to\\geoserver-mcp\\.venv\\Scripts\\geoserver-mcp", "args": [ "--url", "http://localhost:8080/geoserver", "--user", "admin", "--password", "geoserver" ] } } }

Linux:

{ "mcpServers": { "geoserver-mcp": { "command": "/path/to/geoserver-mcp/.venv/bin/geoserver-mcp", "args": [ "--url", "http://localhost:8080/geoserver", "--user", "admin", "--password", "geoserver" ] } } }

🛠️ 开发安装

开发安装是为想要修改代码库的贡献者和开发者设计的。此方法适用于:

  • 为项目做出贡献的开发人员
  • 需要修改源代码的用户
  • 测试新功能
  • 调试和开发目的
  1. 安装 uv 包管理器。
pip install uv
  1. 创建虚拟环境(Python 3.10+):
uv venv --python=3.10
  1. 使用 pip 安装包:
uv pip install -e .
  1. 配置GeoServer连接:

Linux/Mac:

export GEOSERVER_URL="http://localhost:8080/geoserver" export GEOSERVER_USER="admin" export GEOSERVER_PASSWORD="geoserver"

Windows PowerShell:

$env:GEOSERVER_URL="http://localhost:8080/geoserver" $env:GEOSERVER_USER="admin" $env:GEOSERVER_PASSWORD="geoserver"
  1. 启动服务器:

如果您要使用 Claude 桌面,则无需执行此步骤。对于游标或您自己的自定义客户端,您应该运行以下代码。

Linux:

source .venv/bin/activate geoserver-mcp

或者

source .venv/bin/activate geoserver-mcp --url http://localhost:8080/geoserver --user admin --password geoserver --debug

Windows PowerShell:

.\.venv\Scripts\activate geoserver-mcp

或者

.\.venv\Scripts\activate geoserver-mcp --url http://localhost:8080/geoserver --user admin --password geoserver --debug
  1. 配置客户端:

如果您使用的是 Claude Desktop,请编辑claude_desktop_config.json如果您使用的是 Cursor,请创建.cursor/mcp.json

视窗:

{ "mcpServers": { "geoserver-mcp": { "command": "C:\\path\\to\\geoserver-mcp\\.venv\\Scripts\\geoserver-mcp", "args": [ "--url", "http://localhost:8080/geoserver", "--user", "admin", "--password", "geoserver" ] } } }

Linux:

{ "mcpServers": { "geoserver-mcp": { "command": "/path/to/geoserver-mcp/.venv/bin/geoserver-mcp", "args": [ "--url", "http://localhost:8080/geoserver", "--user", "admin", "--password", "geoserver" ] } } }

🛠️ 可用工具

🛠️ 工作区和图层管理

工具描述
list_workspaces获取可用的工作空间
create_workspace创建新工作区
get_layer_info获取详细的图层元数据
list_layers列出工作空间中的图层
create_layer创建新图层
delete_resource删除资源

🛠️ 数据操作

工具描述
query_features对矢量数据执行 CQL 查询
update_features修改要素属性
delete_features根据条件删除特征

🛠️ 可视化

工具描述
generate_map创建样式化的地图图像
create_style定义新的 SLD 样式
apply_style将现有样式应用于图层

🛠️ 客户端开发

如果您计划开发自己的客户端来与 GeoServer MCP 服务器交互,可以从examples/client.py的示例客户端实现中找到灵感。此示例演示了:

  • 如何与 MCP 服务器建立连接
  • 如何发送请求和处理响应
  • 基本错误处理和连接管理
  • 各种工具和操作的使用示例

示例客户端是理解协议和实现您自己的客户端应用程序的良好起点。

另外,这里是使用示例:

列出工作区

Tool: list_workspaces Parameters: {} Response: ["default", "demo", "topp", "tiger", "sf"]

获取图层信息

Tool: get_layer_info Parameters: { "workspace": "topp", "layer": "states" }

查询功能

Tool: query_features Parameters: { "workspace": "topp", "layer": "states", "filter": "PERSONS > 10000000", "properties": ["STATE_NAME", "PERSONS"] }

生成地图

Tool: generate_map Parameters: { "layers": ["topp:states"], "styles": ["population"], "bbox": [-124.73, 24.96, -66.97, 49.37], "width": 800, "height": 600, "format": "png" }

🔮 计划功能

  • [ ] 覆盖范围和栅格数据管理
  • [ ] 安全和访问控制
  • [ ] 高级造型功能
  • [ ] WPS处理操作
  • [ ] GeoWebCache 集成

🤝 贡献

欢迎您贡献力量!您可以通过以下方式提供帮助:

  1. 分叉存储库
  2. 创建功能分支( git checkout -b feature/AmazingFeature
  3. 提交您的更改( git commit -m 'Add some AmazingFeature'
  4. 推送到分支( git push origin feature/AmazingFeature
  5. 打开拉取请求

请确保您的 PR 描述清晰地描述了问题和解决方案。如适用,请包含相关的问题编号。

📄 许可证

该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅LICENSE文件。

🔗 相关项目

📞 支持

如需支持,请打开一个问题

🏆 徽章

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

模型上下文协议服务器将大型语言模型连接到 GeoServer REST API,使 AI 助手能够通过自然语言查询和操作地理空间数据。

  1. 🎥 演示
    1. 📋 目录
      1. 🚀 功能
        1. 📋 先决条件
          1. 🛠️ 安装
            1. 🛠️ 安装(Docker)
            2. 🛠️ 安装(pip)
            3. 🛠️ 开发安装
          2. 🛠️ 可用工具
            1. 🛠️ 工作区和图层管理
            2. 🛠️ 数据操作
            3. 🛠️ 可视化
          3. 🛠️ 客户端开发
            1. 列出工作区
            2. 获取图层信息
            3. 查询功能
            4. 生成地图
          4. 🔮 计划功能
            1. 🤝 贡献
              1. 📄 许可证
                1. 🔗 相关项目
                  1. 📞 支持
                    1. 🏆 徽章

                      Related MCP Servers

                      • A
                        security
                        A
                        license
                        A
                        quality
                        A production-ready Model Context Protocol server that enables language models to leverage AI-powered web scraping capabilities, offering tools for transforming webpages to markdown, extracting structured data, and executing AI-powered web searches.
                        Last updated -
                        3
                        16
                        Python
                        MIT License
                        • Apple
                      • -
                        security
                        A
                        license
                        -
                        quality
                        A Model Context Protocol server enabling AI agents to access and manipulate ServiceNow data through natural language interactions, allowing users to search for records, update them, and manage scripts.
                        Last updated -
                        9
                        Python
                        MIT License
                      • -
                        security
                        A
                        license
                        -
                        quality
                        A server that enables Large Language Models to discover and interact with REST APIs defined by OpenAPI specifications through the Model Context Protocol.
                        Last updated -
                        378
                        96
                        TypeScript
                        MIT License
                        • Apple
                      • -
                        security
                        A
                        license
                        -
                        quality
                        A Model Context Protocol server that enables AI agents to query Erick Wendel's talks, blog posts, and videos across different platforms using natural language.
                        Last updated -
                        55
                        TypeScript
                        MIT License

                      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/mahdin75/geoserver-mcp'

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