GeoServer MCP Server

GeoServer MCP Server

A Model Context Protocol server that connects Large Language Models to the GeoServer REST API, enabling AI assistants to query and manipulate geospatial data through natural language.

Category
访问服务器

Tools

create_layer

Create a new layer in GeoServer. Args: workspace: The workspace for the new layer layer: The name of the layer to create data_store: The data store to use source: The source data (file, table name, etc.) Returns: Dict with status and layer information

delete_resource

Delete a resource from GeoServer. Args: resource_type: Type of resource to delete (workspace, layer, style, etc.) workspace: The workspace containing the resource name: The name of the resource Returns: Dict with status and result information

query_features

Query features from a vector layer using CQL filter. Args: workspace: The workspace containing the layer layer: The layer to query filter: Optional CQL filter expression properties: Optional list of properties to return max_features: Maximum number of features to return Returns: GeoJSON FeatureCollection with query results

generate_map

Generate a map image using WMS GetMap. Args: layers: List of layers to include (format: workspace:layer) styles: Optional styles to apply (one per layer) bbox: Bounding box [minx, miny, maxx, maxy] width: Image width in pixels height: Image height in pixels format: Image format (png, jpeg, etc.) Returns: Dict with map information and URL

create_style

Create a new SLD style in GeoServer. Args: name: Name for the style sld: SLD XML content workspace: Optional workspace for the style Returns: Dict with status and style information

list_workspaces

List available workspaces in GeoServer.

create_workspace

Create a new workspace in GeoServer. Args: workspace: Name of the workspace to create Returns: Dict with status and result information

get_layer_info

Get detailed information about a layer. Args: workspace: The workspace containing the layer layer: The name of the layer Returns: Dict with layer metadata

list_layers

List layers in GeoServer, optionally filtered by workspace. Args: workspace: Optional workspace to filter layers Returns: List of layer information dictionaries

README

GeoServer MCP Server

<a href="https://badge.mcpx.dev?type=server 'MCP Server'"> <img src="https://badge.mcpx.dev?type=server" title="MCP Server"/> </a> <p align="center"> A Model Context Protocol (MCP) server implementation that connects Large Language Models (LLMs) to the GeoServer REST API, enabling AI assistants to interact with geospatial data and services. </p>

<div align="center"> <img src="docs/images/geoserver-mcp.png" alt="GeoServer MCP Server Logo" width="400"/> </div>

🏆 Badges & Indexes

<div align="center"> <a href="https://glama.ai/mcp/servers/@mahdin75/geoserver-mcp"> <img width="380" height="200" src="https://glama.ai/mcp/servers/@mahdin75/geoserver-mcp/badge" alt="GeoServer Server MCP server" /> </a> <br/><br/><br/> <a href="https://mcp.so/server/Geoserver%20MCP%20Server/mahdin75"> <img src="https://mcp.so/logo.png" alt="MCP.so Badge" width="150"/> </a> </div>

📋 Table of Contents

🚀 Features

  • 🔍 Query and manipulate GeoServer workspaces, layers, and styles
  • 🗺️ Execute spatial queries on vector data
  • 🎨 Generate map visualizations
  • 🌐 Access OGC-compliant web services (WMS, WFS)
  • 🔄 Real-time interaction with GeoServer REST API
  • 📊 Support for complex spatial operations
  • 🛠️ Easy integration with MCP-compatible clients

📋 Prerequisites

  • Python 3.10 or higher
  • Running GeoServer instance with REST API enabled
  • MCP-compatible client (like Claude Desktop or Cursor)
  • geoserver-rest package
  • Internet connection for package installation

🛠️ Installation

  1. Clone the repository:
git clone https://github.com/mahdin75/geoserver-mcp.git
cd geoserver-mcp
  1. Install the package:
pip install -e .
  1. Configure GeoServer connection:

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. Start the server:
geoserver-mcp-server

🔧 Configuration

Command-line Arguments

geoserver-mcp-server --url http://localhost:8080/geoserver --user admin --password geoserver --debug

Environment Variables

Variable Description Default
GEOSERVER_URL GeoServer instance URL http://localhost:8080/geoserver
GEOSERVER_USER Admin username admin
GEOSERVER_PASSWORD Admin password geoserver

MCP Client Integration

Claude Desktop

Edit claude_desktop_config.json:

{
  "mcpServers": {
    "geoserver-mcp-server": {
      "command": "geoserver-mcp-server",
      "args": [
        "--url",
        "http://localhost:8080/geoserver",
        "--user",
        "admin",
        "--password",
        "geoserver"
      ]
    }
  }
}

Cursor

Create .cursor/mcp.json:

{
  "mcpServers": {
    "geoserver-mcp-server": {
      "command": "geoserver-mcp-server",
      "args": [
        "--url",
        "http://localhost:8080/geoserver",
        "--user",
        "admin",
        "--password",
        "geoserver"
      ]
    }
  }
}

🛠️ Available Tools

Catalog Management

Tool Description
list_workspaces Get available workspaces
create_workspace Create a new workspace
get_layer_info Get detailed layer metadata
list_layers List layers in a workspace
create_layer Create a new layer
delete_resource Remove resources

Data Operations

Tool Description
query_features Execute CQL queries on vector data
update_features Modify feature attributes
delete_features Remove features based on criteria

Visualization

Tool Description
generate_map Create styled map images
create_style Define new SLD styles
apply_style Apply existing styles to layers

📚 Example Usage

List Workspaces

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

List of GeoServer Workspaces

Get Layer Information

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

Query Features

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

Generate Map

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

🔮 Planned Features

  • [ ] Coverage and raster data management
  • [ ] Security and access control
  • [ ] Advanced styling capabilities
  • [ ] WPS processing operations
  • [ ] GeoWebCache integration
  • [ ] Batch operations support
  • [ ] Performance optimizations
  • [ ] Extended query capabilities

🤝 Contributing

We welcome contributions! Here's how you can help:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Please ensure your PR description clearly describes the problem and solution. Include the relevant issue number if applicable.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🔗 Related Projects

📞 Support

For support, please Open an issue

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选