Skip to main content
Glama
PostGIS MCP Server

PostGIS MCP Server

by receptopalak

PostGIS MCPサーバー

English | Türkçe

PostGIS MCPサーバー

このプロジェクトは、Model Context Protocol (MCP) を使用してPostGISデータベース接続を提供するサーバーアプリケーションです。

🚀 特徴

  • TypeScriptで開発

  • Model Context Protocol (MCP) 統合

  • PostGISデータベースサポート

  • 開発および本番環境向けの構成

  • ホットリロードサポート

Related MCP server: GeoServer MCP Server

📋 要件

  • Node.js (v14以上)

  • PostgreSQL (PostGIS拡張機能付き)

  • npm または yarn

🛠️ インストール

  1. プロジェクトをクローンします:

git clone https://github.com/receptopalak/postgis-mcp.git
cd postgis-mcp
  1. 依存関係をインストールします:

npm install
  1. .env ファイルを作成します:

NODE_ENV=development
DB_URL_1=postgres://user:password@host:5432/database_one
DB_URL_2=postgres://user:password@host:5432/database_two
DB_URL_3=postgres://user:password@host:5432/database_three

従来の単一データベース用 DB_HOST / DB_NAME / DB_USER / DB_PASSWORD 変数もフォールバックとして引き続きサポートされています。

  1. オプション: 自然言語でのテーブル選択を改善するために、domain-aliases.json でテーブル/ドメインのエイリアスをカスタマイズします。

🚀 使用方法

開発モード

npm run dev

本番モード

npm run build
npm start

🔧 MCP構成

MCPサーバーには以下の構成例を使用できます:

{
  "mcpServers": {
    "postgis": {
      "command": "npx",
      "args": ["tsx", "server.ts"],
      "env": {
        "NODE_ENV": "development",
        "DB_URL_1": "postgres://user:pass@host:5432/db_one",
        "DB_URL_2": "postgres://user:pass@host:5432/db_two"
      }
    }
  }
}

📦 依存関係

  • @modelcontextprotocol/sdk: ^1.12.1

  • dotenv: ^16.5.0

  • pg: ^8.16.0

  • zod: ^3.25.64

🤝 貢献

  1. このリポジトリをフォークします

  2. フィーチャーブランチを作成します (git checkout -b feature/amazing-feature)

  3. 変更をコミットします (git commit -m 'feat: Add some amazing feature')

  4. ブランチにプッシュします (git push origin feature/amazing-feature)

  5. プルリクエストを作成します

📝 ライセンス

このプロジェクトはISCライセンスの下でライセンスされています。詳細については LICENSE ファイルを参照してください。

📧 連絡先

プロジェクトオーナー - @receptopalak

プロジェクトリンク: https://github.com/receptopalak/postgis-mcp


PostGIS MCPサーバー

Bu proje, Model Context Protocol (MCP) kullanarak PostGIS veritabanı bağlantısını sağlayan bir sunucu uygulamasıdır.

🚀 Özellikler

  • TypeScript ile geliştirilmiş

  • Model Context Protocol (MCP) entegrasyonu

  • PostGIS veritabanı desteği

  • Geliştirme ve üretim ortamları için yapılandırma

  • Hot-reload desteği

📋 Gereksinimler

  • Node.js (v14 veya üzeri)

  • PostgreSQL (PostGIS eklentisi ile)

  • npm veya yarn

🛠️ Kurulum

  1. Projeyi klonlayın:

git clone https://github.com/receptopalak/postgis-mcp.git
cd postgis-mcp
  1. Bağımlılıkları yükleyin:

npm install
  1. .env dosyası oluşturun:

NODE_ENV=development
DB_URL_1=postgres://user:password@host:5432/database_one
DB_URL_2=postgres://user:password@host:5432/database_two
DB_URL_3=postgres://user:password@host:5432/database_three

Eski tek veritabanlı DB_HOST / DB_NAME / DB_USER / DB_PASSWORD değişkenleri de fallback olarak desteklenir.

  1. Opsiyonel: doğal dilde tablo seçimini iyileştirmek için domain-aliases.json dosyasını özelleştirin.

🚀 Kullanım

Geliştirme Modu

npm run dev

Üretim Modu

npm run build
npm start

🔧 MCP Yapılandırması

MCP sunucu yapılandırması için aşağıdaki örnek yapılandırmayı kullanabilirsiniz:

{
  "mcpServers": {
    "postgis": {
      "command": "npx",
      "args": ["tsx", "server.ts"],
      "env": {
        "NODE_ENV": "development",
        "DB_URL_1": "postgres://user:pass@host:5432/db_one",
        "DB_URL_2": "postgres://user:pass@host:5432/db_two"
      }
    }
  }
}

📦 Bağımlılıklar

  • @modelcontextprotocol/sdk: ^1.12.1

  • dotenv: ^16.5.0

  • pg: ^8.16.0

  • zod: ^3.25.64

🤝 Katkıda Bulunma

  1. Bu depoyu fork edin

  2. Yeni bir özellik dalı oluşturun (git checkout -b feature/amazing-feature)

  3. Değişikliklerinizi commit edin (git commit -m 'feat: Add some amazing feature')

  4. Dalınıza push edin (git push origin feature/amazing-feature)

  5. Bir Pull Request oluşturun

📝 Lisans

Bu proje ISC lisansı altında lisanslanmıştır. Daha fazla bilgi için LICENSE dosyasına bakın.

📧 İletişim

Proje Sahibi - @receptopalak

Proje Linki: https://github.com/receptopalak/postgis-mcp

Available Tools

22 tools
analyze-databaseC

Veritabanı şemasını analiz et ve tablo bilgilerini topla

Inputs: force_refresh.

calculate-distanceC

İki nokta arasındaki mesafeyi hesapla

Inputs: point1_lat (required), point1_lon (required), point2_lat (required), point2_lon (required), +1 more.

create-bufferC

Geometri etrafında buffer oluştur

Inputs: distance_meters (required), geometry_wkt (required).

create-linestringB

Koordinat dizisinden çizgi geometrisi oluştur

Inputs: coordinates (required), srid.

create-pointC

Koordinatlardan nokta geometrisi oluştur

Inputs: latitude (required), longitude (required), srid.

create-polygonC

Koordinat dizisinden poligon geometrisi oluştur

Inputs: exterior_ring (required), interior_rings, srid.

create-spatial-indexD

Mekansal indeks oluştur

Inputs: table_name (required), geometry_column.

extract-raster-valueC

Belirli koordinattaki raster değerini çıkar

Inputs: latitude (required), longitude (required), table_name (required), raster_column.

find-nearbyC

Belirli bir noktanın çevresindeki özellikleri bul

Inputs: distance_km (required), latitude (required), longitude (required), table_name (required), +1 more.

geometry-centroidC

Geometrinin merkez noktasını bul

Inputs: geometry_wkt (required).

geometry-convex-hullC

Geometrinin konveks zarfını hesapla

Inputs: geometry_wkt (required).

geometry-infoC

Geometri hakkında detaylı bilgi al (alan, uzunluk, boyut vs.)

Inputs: geometry_wkt (required).

geometry-intersectionC

İki geometrinin kesişimini bul

Inputs: geometry1_wkt (required), geometry2_wkt (required).

geometry-unionC

Birden fazla geometriyi birleştir

Inputs: geometries_wkt (required).

get-table-infoC

Belirli bir tablo hakkında detaylı bilgi al

Inputs: table_name (required).

raster-infoC

Raster verisinin bilgilerini al

Inputs: table_name (required), raster_column.

simplify-geometryC

Geometriyi basitleştir (Douglas-Peucker algoritması)

Inputs: geometry_wkt (required), tolerance (required), preserve_collapsed.

smart-queryC

Doğal dilde sorulan soruyu anla ve uygun veritabanı sorgusuna çevir

Inputs: question (required), language.

spatial-joinC

İki tablo arasında mekansal join işlemi yap

Inputs: join_type (required), table1 (required), table2 (required), geometry_column1, +2 more.

test-connectionB

PostGIS veritabanı bağlantısını test et

Inputs: no named parameters.

transform-coordinatesD

Koordinat sistemini dönüştür

Inputs: geometry_wkt (required), source_srid (required), target_srid (required).

validate-geometryC

Geometrinin geçerliliğini kontrol et

Inputs: geometry_wkt (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.1/5.0

    Scored across 22 tools

    Disambiguation5/5

    Every tool has a clearly distinct purpose targeting specific PostGIS operations like geometry creation, analysis, spatial queries, and database management. There is no overlap; for example, 'create-point' and 'create-puffer' serve different functions, and descriptions help differentiate even similar-sounding tools like 'geometry-info' and 'get-table-info'.

    Naming Consistency5/5

    Tool names follow a consistent verb-noun pattern with hyphens throughout, such as 'create-point', 'calculate-distance', and 'validate-geometry'. This predictable naming scheme makes it easy for agents to understand and select tools without confusion or mixed conventions.

    Tool Count4/5

    With 22 tools, the count is slightly high but reasonable for a comprehensive PostGIS server covering geometry operations, spatial analysis, raster data, and database utilities. It might feel heavy, but each tool appears to earn its place in the domain without being excessive.

    Completeness5/5

    The tool set provides complete coverage for PostGIS operations, including CRUD-like functions (e.g., create, analyze, validate), spatial calculations (e.g., distance, intersection), database management (e.g., test-connection, get-table-info), and advanced features like natural language querying. No obvious gaps are present for the domain.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      A Model Context Protocol server that enables powerful PostgreSQL database management capabilities including analysis, schema management, data migration, and monitoring through natural language interactions.
      18
      10,856 npm
      204
      AGPL 3.0
    • A
      license
      A
      quality
      D
      maintenance
      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.
      9
      97
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      A Model Context Protocol server implementation that provides a simple interface to interact with PostgreSQL databases, enabling SQL queries, database operations, and schema management through MCP.
      -