PostgreSQL용 MCP 서버
PostgreSQL을 위한 MCP(Model Context Protocol) 서버 구현으로, MCP를 통해 PostgreSQL 데이터베이스와 상호 작용할 수 있는 간단한 인터페이스를 제공합니다.
특징
- 매개변수화된 입력으로 SQL 쿼리 실행
- INSERT/UPDATE/DELETE 작업 실행
- 새로운 데이터베이스 생성
- 테이블 스키마 생성 또는 업데이트
- PostgreSQL 연결 디버깅
- Docker로 컨테이너화하여 쉽게 배포 가능
- 환경 기반 구성
필수 조건
- 파이썬 3.8 이상
- 포스트그레SQL 10+
- Docker(컨테이너화된 배포를 위한 선택 사항)
- Docker Compose(선택 사항, 개발용)
설치
Docker 사용(권장)
- 저장소를 복제합니다.지엑스피1
- 예제 환경 파일을 복사하세요.
- PostgreSQL 자격 증명으로
.env
파일을 업데이트합니다. - Docker Compose를 사용하여 서비스를 시작합니다.
수동 설치
- 저장소를 복제합니다.
- 가상 환경을 만들고 활성화하세요.
- 종속성 설치:
- 예제 환경 파일을 복사하여 업데이트합니다.
- 서버를 실행합니다:
용법
MCP 서버는 다음과 같은 엔드포인트를 제공합니다.
sql_query
SELECT 쿼리를 실행하고 결과를 JSON으로 반환합니다.
매개변수:
query
: SQL 쿼리 문자열params
: 쿼리 매개변수의 선택적 JSON 문자열(목록 또는 사전)
예:
sql_execute
INSERT/UPDATE/DELETE 문을 실행합니다.
매개변수:
query
: SQL 문params
: 쿼리 매개변수의 선택적 JSON 문자열(목록 또는 사전)
예:
create_database
새로운 PostgreSQL 데이터베이스를 만듭니다.
매개변수:
database_name
: 생성할 데이터베이스의 이름
create_or_update_table
테이블 스키마를 생성하거나 업데이트합니다.
매개변수:
sql
: CREATE TABLE 또는 ALTER TABLE SQL 문
debug_postgres_connection
PostgreSQL 연결을 디버깅합니다.
환경 변수
변하기 쉬운 | 기본 | 설명 |
---|---|---|
PG_호스트 | 로컬호스트 | PostgreSQL 호스트 |
PG_PORT | 5432 | PostgreSQL 포트 |
PG_USER | 포스트그레스 | PostgreSQL 사용자 이름 |
PG_비밀번호 | PostgreSQL 비밀번호 | |
PG_데이터베이스 | 포스트그레스 | 기본 데이터베이스 이름 |
주인 | 0.0.0.0 | MCP 서버를 바인딩할 호스트 |
포트 | 8056 | MCP 서버를 실행할 포트 |
개발
테스트 실행
Docker 이미지 빌드
API 문서
자세한 API 문서는 OpenAPI 사양을 참조하세요.
기여하다
기여를 환영합니다! 풀 리퀘스트를 제출해 주세요.
특허
이 프로젝트는 MIT 라이선스에 따라 라이선스가 부여되었습니다. 자세한 내용은 라이선스 파일을 참조하세요.
감사의 말
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
MCP를 통해 SQL 쿼리, 데이터베이스 작업 및 스키마 관리를 가능하게 하여 PostgreSQL 데이터베이스와 상호 작용할 수 있는 간단한 인터페이스를 제공하는 모델 컨텍스트 프로토콜 서버 구현입니다.
Related MCP Servers
- -securityFlicense-qualityA Model Context Protocol server providing both read and write access to PostgreSQL databases, enabling LLMs to query data, modify records, and manage database schemas.Last updated -1417JavaScript
- AsecurityAlicenseAqualityA Model Context Protocol server that enables powerful PostgreSQL database management capabilities including analysis, schema management, data migration, and monitoring through natural language interactions.Last updated -1843889TypeScriptAGPL 3.0
- -securityFlicense-qualityA Model Context Protocol server that enables performing PostgreSQL database operations (create, read, update, delete) on User and Post entities through MCP tools.Last updated -TypeScript
- -securityAlicense-qualityA Model Context Protocol server that enables interaction with PostgreSQL databases to list tables, retrieve schemas, and execute read-only SQL queries.Last updated -35JavaScriptMIT License