Skip to main content

A GeoServer MCP server implementation that enhances LLM capabilities with geospatial data and mapping services via GeoServer REST API

Project description

PyPI Downloads

GeoServer MCP Server

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.

GeoServer MCP Server Logo

Beta

Version 0.5.0 (Beta) is under active development and will be released shortly. We are open to contributions and welcome developers to join us in building this project.

🎥 Demo

GeoServer MCP Server Demo

📋 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)
  • 🛠️ 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)
  • Internet connection for package installation

🛠️ Installation

Choose the installation method that best suits your needs:

🛠️ Installation (Docker)

The Docker installation is the quickest and most isolated way to run the GeoServer MCP server. It's ideal for:

  • Quick testing and evaluation
  • Production deployments
  • Environments where you want to avoid Python dependencies
  • Consistent deployment across different systems
  1. Run geoserver-mcp:
docker pull mahdin75/geoserver-mcp
docker run -d mahdin75/geoserver-mcp
  1. Configure the clients:

If you are using Claude Desktop, edit claude_desktop_config.json If you are using Cursor, Create .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"
      ]
    }
  }
}

🛠️ Installation (pip)

The pip installation is recommended for most users who want to run the server directly on their system. This method is best for:

  • Regular users who want to run the server locally
  • Systems where you have Python 3.10+ installed
  • Users who want to customize the server configuration
  • Development and testing purposes
  1. Install uv package manager.
pip install uv
  1. Create the Virtual Environment (Python 3.10+):

Linux/Mac:

uv venv --python=3.10

Windows PowerShell:

uv venv --python=3.10
  1. Install the package using pip:
uv pip install geoserver-mcp
  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:

If you are going to use Claude desktop you don't need this step. For cursor or your own custom client you should run the following code.

Linux:

source .venv/bin/activate

geoserver-mcp

or

source .venv/bin/activate

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

Windows PowerShell:

.\.venv\Scripts\activate
geoserver-mcp

or

.\.venv\Scripts\activate
geoserver-mcp --url http://localhost:8080/geoserver --user admin --password geoserver --debug
  1. Configure Clients:

If you are using Claude Desktop, edit claude_desktop_config.json If you are using Cursor, Create .cursor/mcp.json

Windows:

{
  "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"
      ]
    }
  }
}

🛠️ Development installation

The development installation is designed for contributors and developers who want to modify the codebase. This method is suitable for:

  • Developers contributing to the project
  • Users who need to modify the source code
  • Testing new features
  • Debugging and development purposes
  1. Install uv package manager.
pip install uv
  1. Create the Virtual Environment (Python 3.10+):
uv venv --python=3.10
  1. Install the package using pip:
uv 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:

If you are going to use Claude desktop you don't need this step. For cursor or your own custom client you should run the following code.

Linux:

source .venv/bin/activate

geoserver-mcp

or

source .venv/bin/activate

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

Windows PowerShell:

.\.venv\Scripts\activate
geoserver-mcp

or

.\.venv\Scripts\activate
geoserver-mcp --url http://localhost:8080/geoserver --user admin --password geoserver --debug
  1. Configure Clients:

If you are using Claude Desktop, edit claude_desktop_config.json If you are using Cursor, Create .cursor/mcp.json

Windows:

{
  "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"
      ]
    }
  }
}

File Storage and --storage Usage

GeoServer MCP server supports an optional --storage flag to specify a base directory for all file read/write operations, such as uploading shapefiles, GeoTIFFs, or exporting results.

Overview

  • The --storage flag sets the root folder for file operations from all data-related tools.
  • You may supply relative paths (relative to storage root) or absolute paths (bypassing the storage root) as arguments to relevant tools.
  • If --storage is not set, paths are resolved as provided by the user (relative to working directory or absolute).

CLI Example

python -m geoserver_mcp.main --storage D:/my/data/dir

This sets D:/my/data/dir as the base path for all files.

Example tool call in Python:

# Will read from D:/my/data/dir/roads.zip if --storage is set to D:/my/data/dir
create_shp_datastore('workspace', 'datastore_name', 'roads.zip')

Absolute paths (e.g. 'C:/input/other.shp') are always used as-is.

When Running in Docker

If using Docker, ensure the storage directory is mounted as a volume, e.g.:

docker run -v D:/my/data:/opt/data ...

Then launch the server with:

python -m geoserver_mcp.main --storage /opt/data

Best Practices

  • Use relative paths when interacting with the API/tools as it keeps your setup portable.
  • For remote or container deployment, always ensure your file data is accessible within the container (use Docker volumes if needed).
  • Check tool docstrings for which arguments use the storage system.

The --storage system streamlines file management for all users and makes deployment much more flexible!

🛠️ Available Tools

🛠️ Workspace and Layer 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

🛠️ Client Development

If you're planning to develop your own client to interact with the GeoServer MCP server, you can find inspiration in the example client implementation at examples/client.py. This example demonstrates:

  • How to establish a connection with the MCP server
  • How to send requests and handle responses
  • Basic error handling and connection management
  • Example usage of various tools and operations

The example client serves as a good starting point for understanding the protocol and implementing your own client applications.

Also, here is the example usgage:

List Workspaces


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

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

🤝 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

🌐 See Also: GIS MCP

For broader geospatial data automation and even more GIS-related MCP features, see GIS MCP by mahdin75.

📞 Support

For support, please Open an issue

🏆 Badges

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

geoserver_mcp-0.4.0.tar.gz (1.0 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

geoserver_mcp-0.4.0-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file geoserver_mcp-0.4.0.tar.gz.

File metadata

  • Download URL: geoserver_mcp-0.4.0.tar.gz
  • Upload date:
  • Size: 1.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.0

File hashes

Hashes for geoserver_mcp-0.4.0.tar.gz
Algorithm Hash digest
SHA256 7ad1bd59205ab71bfc0159752ab4f75c9182fb8b0fc319a0da01c14c0517b266
MD5 2c97a61263ef2ce761c1b56845797915
BLAKE2b-256 8f61bbe023408aec8a2ea31ec60301e8b6967ab0bf8f129a47dcab90fb99503b

See more details on using hashes here.

File details

Details for the file geoserver_mcp-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: geoserver_mcp-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 15.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.0

File hashes

Hashes for geoserver_mcp-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f91540f63fc92d5b0a106f4e843f7b18afad6f7b2bf7277b412081f72b12d3bf
MD5 5b6fd459dd4b5644740ea76d3bb787de
BLAKE2b-256 e900ea76b5c2650df7cba6ab68a9c4ae2d1c52d60e9915d4aa8fabecbad7cef1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page