地理服务器管理服务

基于Python 3.11和FastAPI开发的GeoServer REST API管理服务,提供Workspace、Datastore、Layer、Style和GWC的管理功能。

  • by mgurbuz-tr
  • Python
  • 本地部署
  • 3 星标
  • 更新于
在 GitHub 查看 mgurbuz-tr/geoserver-mcp

使用说明

GeoServer Yönetim Servisi (MCPS)

Python 3.11+ ve FastAPI ile geliştirilmiş, GeoServer REST API üzerinden Workspace, Datastore (PostGIS, GeoPackage), Layer, Style ve GWC yönetimi sağlayan servis. MCP tool mantığında operasyonlar hem REST endpoint hem de tool olarak sunulur.

Özellikler

  • Workspace: Listeleme, oluşturma, güncelleme, silme (idempotent, force/recurse)
  • Datastore: PostGIS ve GeoPackage CRUD, connection test, rollback
  • Style (SLD): Listeleme, upload, güncelleme, silme, layer'a atama
  • Layer: Listeleme, vector/coverage publish, güncelleme, silme
  • GWC: Cache config, seed, truncate, job status

MCP: Tüm bu alanlar için toplam 24 tool REST API ile aynı işlemleri sunar (workspace, datastore, style, layer, GWC).

Gereksinimler

  • Python 3.11+
  • GeoServer (REST API erişilebilir)

Kurulum

cd MCPS
pip install -e ".[dev]"
cp .env.example .env
# .env içinde GEOSERVER_BASE_URL ve GEOSERVER_USER/PASSWORD ayarlayın

Çalıştırma

uvicorn geoserver_mgmt.main:app --reload --host 0.0.0.0 --port 8000
  • API: http://localhost:8000
  • OpenAPI: http://localhost:8000/docs

Yapılandırma

.env veya ortam değişkenleri:

  • GEOSERVER_BASE_URL: GeoServer REST base (örn. http://localhost:8080/geoserver/rest)
  • GEOSERVER_USER, GEOSERVER_PASSWORD: GeoServer admin kimlik bilgileri
  • IDEMPOTENT_CREATE_WORKSPACE: already_exists | noop_success (aynı isimde workspace create davranışı)

Proje Yapısı

  • src/geoserver_mgmt/: Ana uygulama
    • config.py: Pydantic Settings
    • models/: Domain ve API modelleri
    • client/: GeoServer REST client (httpx)
    • services/: İş kuralları katmanı
    • api/: FastAPI router'lar
    • tools/: MCP tool tanımları
  • tests/: Birim ve entegrasyon testleri
  • .cursor/specs/geoserver-management/: Gereksinim spec'leri