PostGIS MCP Server
The PostGIS MCP Server is a TypeScript-based server that connects to PostGIS databases via the Model Context Protocol (MCP), enabling natural language queries and spatial data operations.
Database Management
Test PostGIS database connections
Analyze database schemas and collect table information (with optional cache refresh)
Retrieve detailed information about specific tables
Create spatial indexes on table geometry columns
Support multiple database connections via environment variables (e.g.,
DB_URL_1,DB_URL_2)
Natural Language Querying
Ask questions in English or Turkish (e.g., "How many stations are in Istanbul?") and have them automatically translated into SQL queries
Improve table selection using customizable
domain-aliases.json
Geometry Creation
Create point geometries from longitude/latitude coordinates
Create linestring geometries from coordinate arrays
Create polygon geometries with exterior and optional interior rings
Geometry Analysis & Operations
Get detailed info about a geometry (area, length, dimensions) from WKT format
Validate geometry correctness
Find the centroid or convex hull of a geometry
Find intersections between two geometries
Union multiple geometries into one
Spatial Calculations
Calculate distance between two points (with optional geographic calculation)
Create buffers around geometries at a specified distance
Simplify geometries using the Douglas-Peucker algorithm
Transform coordinates between different spatial reference systems (SRIDs)
Spatial Queries
Find nearby features within a specified distance from a point
Perform spatial joins between two tables (intersects, within, contains, touches)
Raster Data
Retrieve metadata and information about raster data in a table
Extract raster values at specific coordinates
Enables environment variable configuration for development and production environments, supporting database connection parameters and application settings.
Enables version control and collaborative development workflow for the project codebase.
Hosts the project repository, allowing for project sharing, issue tracking, and collaboration.
Runs the server application on Node.js runtime (v14 or higher), providing the execution environment for the MCP server.
Manages package dependencies and provides scripts for development, building, and running the application.
Provides PostGIS database connection capabilities, allowing spatial data querying and manipulation through PostgreSQL with the PostGIS extension.
Implements server functionality with TypeScript, providing type safety and modern JavaScript features for robust application development.
Offers an alternative package manager for installing dependencies and running the application.
Provides schema validation for data structures, ensuring type safety and data integrity when processing database queries and responses.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@PostGIS MCP Serverfind all coffee shops within 2 miles of my current location"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
PostGIS MCP Server
PostGIS MCP Server
This project is a server application that provides PostGIS database connection using Model Context Protocol (MCP).
🚀 Features
Developed with TypeScript
Model Context Protocol (MCP) integration
PostGIS database support
Configuration for development and production environments
Hot-reload support
Related MCP server: MCP PostgreSQL Server
📋 Requirements
Node.js (v14 or higher)
PostgreSQL (with PostGIS extension)
npm or yarn
🛠️ Installation
Clone the project:
git clone https://github.com/receptopalak/postgis-mcp.git
cd postgis-mcpInstall dependencies:
npm installCreate
.envfile:
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_threeLegacy single-database DB_HOST / DB_NAME / DB_USER / DB_PASSWORD variables are still supported as a fallback.
Optional: customize table/domain aliases in
domain-aliases.jsonto improve natural-language table selection.
🚀 Usage
Development Mode
npm run devProduction Mode
npm run build
npm start🔧 MCP Configuration
You can use the following example configuration for MCP server:
{
"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"
}
}
}
}📦 Dependencies
@modelcontextprotocol/sdk: ^1.12.1
dotenv: ^16.5.0
pg: ^8.16.0
zod: ^3.25.64
🤝 Contributing
Fork this repository
Create your feature branch (
git checkout -b feature/amazing-feature)Commit your changes (
git commit -m 'feat: Add some amazing feature')Push to the branch (
git push origin feature/amazing-feature)Open a Pull Request
📝 License
This project is licensed under the ISC License. See the LICENSE file for more information.
📧 Contact
Project Owner - @receptopalak
Project Link: https://github.com/receptopalak/postgis-mcp
PostGIS MCP Server
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
Projeyi klonlayın:
git clone https://github.com/receptopalak/postgis-mcp.git
cd postgis-mcpBağımlılıkları yükleyin:
npm install.envdosyası 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_threeEski tek veritabanlı DB_HOST / DB_NAME / DB_USER / DB_PASSWORD değişkenleri de fallback olarak desteklenir.
Opsiyonel: doğal dilde tablo seçimini iyileştirmek için
domain-aliases.jsondosyası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
Bu depoyu fork edin
Yeni bir özellik dalı oluşturun (
git checkout -b feature/amazing-feature)Değişikliklerinizi commit edin (
git commit -m 'feat: Add some amazing feature')Dalınıza push edin (
git push origin feature/amazing-feature)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
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
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/receptopalak/postgis-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server