
stuzero/pg-mcp-server
Developer tools이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기
AI 에이전트를 위한 향상된 기능을 갖춘 PostgreSQL 데이터베이스용 모델 컨텍스트 프로토콜(MCP) 서버입니다.
개요
AI 에이전트를 위한 향상된 기능을 갖춘 PostgreSQL 데이터베이스용 모델 컨텍스트 프로토콜(MCP) 서버입니다. PG-MCP는 PostgreSQL 데이터베이스를 위한 모델 컨텍스트 프로토콜(Model Context Protocol)의 서버 구현체입니다. 이 프로토콜은 MCP의 자원 지향 아키텍처를 통해 AI 에이전트가 PostgreSQL 데이터베이스를 발견, 연결, 쿼리 및 이해할 수 있도록 포괄적인 API를 제공합니다. 이 구현은 참조 Postgres MCP 구현을 기반으로 여러 주요 개선 사항을 추가하여 확장합니다: 1. : 운영 용도의 SSE 전송을 지원하는 완전한 서버로 구축됨 2. : 여러 PostgreSQL 데이터베이스에 동시에 연결 3. : 데이터베이스 카탈로그에서 테이블/컬럼 설명을 추출 및 노출 4. : PostGIS 및 pgvector 5와 같은 PostgreSQL 확장에 대한 상세한 YAML 기반 지식을 제공합니다. : 쿼리 실행 계획을 분석하는 전용 도구 포함 6.
개요(AI 번역)
AI 에이전트를 위한 향상된 기능을 갖춘 PostgreSQL 데이터베이스용 모델 컨텍스트 프로토콜(MCP) 서버입니다.
PG-MCP 프로젝트에 대한 자세한 정보는 여기에서 확인할 수 있습니다:
https://stuzero.github.io/pg-mcp/
개요
PG-MCP는 PostgreSQL 데이터베이스를 위한 모델 컨텍스트 프로토콜(Model Context Protocol)의 서버 구현체입니다. 이 프로토콜은 MCP의 자원 지향 아키텍처를 통해 AI 에이전트가 PostgreSQL 데이터베이스를 발견, 연결, 쿼리 및 이해할 수 있도록 포괄적인 API를 제공합니다.
이 구현은 참조 Postgres MCP 구현을 기반으로 여러 주요 개선 사항을 추가하여 확장합니다:
- 완전한 서버 구현: 운영 용도로 SSE 전송을 갖춘 완전한 서버로 구축됨
- 다중 데이터베이스 지원: 여러 PostgreSQL 데이터베이스에 동시에 연결
- 풍부한 카탈로그 정보: 데이터베이스 카탈로그에서 테이블/컬럼 설명을 추출하고 노출
- 확장 컨텍스트: PostGIS와 pgvector 같은 PostgreSQL 확장 기능에 대한 상세한 YAML 기반 지식을 제공합니다
- 쿼리 설명: 쿼리 실행 계획을 분석하는 전용 도구 포함
- 견고한 연결 관리: 안전한 연결 ID 처리가 가능한 데이터베이스 연결의 적절한 수명주기
특징
이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요.
README
원문 README의 일부입니다. 원문 보기.
PostgreSQL Model Context Protocol (PG-MCP) Server
A Model Context Protocol (MCP) server for PostgreSQL databases with enhanced capabilities for AI agents.
More info on the pg-mcp project here:
https://stuzero.github.io/pg-mcp/
Overview
PG-MCP is a server implementation of the Model Context Protocol for PostgreSQL databases. It provides a comprehensive API for AI agents to discover, connect to, query, and understand PostgreSQL databases through MCP’s resource-oriented architecture.
This implementation builds upon and extends the reference Postgres MCP implementation with several key enhancements:
- Full Server Implementation: Built as a complete server with SSE transport for production use
- Multi-database Support: Connect to multiple PostgreSQL databases simultaneously
- Rich Catalog Information: Extracts and exposes table/column descriptions from the database catalog
- Extension Context: Provides detailed YAML-based knowledge about PostgreSQL extensions like PostGIS and pgvector
- Query Explanation: Includes a dedicated tool for analyzing query execution plans
- Robust Connection Management: Proper lifecycle for database connections with secure connection ID handling
Features
Connection Management
- Connect Tool: Register PostgreSQL connection strings and get a secure connection ID
- Disconnect Tool: Explicitly close database connections when done
- Connection Pooling: Efficient connection management with pooling
Query Tools
- pg_query: Execute read-only SQL queries using a connection ID
- pg_explain: Analyze query execution plans in JSON format
Schema Discovery Resources
- List schemas with descriptions
- List tables with descriptions and row counts
- Get column details with data types and descriptions
- View table constraints and indexes
- Explore database extensions
Data Access Resources
- Sample table data (with pagination)
- Get approximate row counts
Extension Context
Built-in contextual information for PostgreSQL extensions like:
- PostGIS: Spatial data types, functions, and examples
- pgvector: Vector similarity search functions and best practices
Additional extensions can be easily added via YAML config files.
Installation
Prerequisites
- Python 3.13+
- PostgreSQL database(s)
Using Docker
# Clone the repository
git clone https://github.com/stuzero/pg-mcp-server.git
cd pg-mcp-server
# Build and run with Docker Compose
docker-compose up -d
Manual Installation
# Clone the repository
git clone https://github.com/stuzero/pg-mcp-server.git
cd pg-mcp-server
# Install dependencies and create a virtual environment ( .venv )
uv sync
# Activate the virtual environment
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Run the server
설치
This server does not publish a one-line install command.
Open the repository installation guide MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →