PostgreSQL MCP 서버
PostgreSQL 데이터베이스에 대한 액세스를 제공하는 모델 컨텍스트 프로토콜 서버입니다. 이 서버를 통해 LLM은 데이터베이스와 상호 작용하여 스키마를 검사하고, 쿼리를 실행하고, 데이터베이스 항목에 대한 CRUD(생성, 읽기, 업데이트, 삭제) 작업을 수행할 수 있습니다. 이 저장소는 PostgreSQL MCP 서버 의 확장 기능으로, 테이블 생성, 항목 삽입, 항목 업데이트, 항목 삭제, 테이블 삭제 기능을 제공합니다.
설치
PostgreSQL MCP 서버를 설치하려면 다음 단계를 따르세요.
Docker와 Claude Desktop 설치
저장소를 복제합니다:
git clone https://github.com/vignesh-codes/ai-agents-mcp-pg.git
PG Docker 컨테이너 실행
docker run --name postgres-container -e POSTGRES_USER=admin -e POSTGRES_PASSWORD=admin_password -e POSTGRES_DB=mydatabase -p 5432:5432 -d postgres:latest
mcp 서버를 빌드합니다:
docker build -t mcp/postgres -f src/Dockerfile .
Claude Desktop을 열고
claude_desktop_config.json
의mcpServers
필드를 업데이트하여 MCP 서버에 연결합니다.
Claude Desktop과 함께 사용
Claude Desktop 앱과 함께 이 서버를 사용하려면 claude_desktop_config.json
의 "mcpServers" 섹션에 다음 구성을 추가하세요.
도커
macOS에서 Docker를 실행하는 경우 서버가 호스트 네트워크(예: localhost)에서 실행되는 경우
host.docker.internal
사용합니다.postgresql://user:password@host:port/db-name
사용하여 PostgreSQL URL에 사용자 이름/비밀번호를 추가할 수 있습니다.
지엑스피1
구성 파일을 업데이트한 후에는 Claude 데스크톱 앱을 다시 시작하세요.
추가된 기능
기존 기능
질문
연결된 데이터베이스에 대해 읽기 전용 SQL 쿼리를 실행합니다.
입력:
sql
(문자열): 실행할 SQL 쿼리.모든 쿼리는 읽기 전용 트랜잭션 내에서 실행됩니다.
새로운 기능
테이블 만들기
테이블 이름과 열 정의를 제공하여 새로운 테이블을 동적으로 생성할 수 있는 기능입니다.
Claude Desktop의 입력:
{ "tableName": "example_table", "columns": [ { "name": "id", "type": "SERIAL PRIMARY KEY" }, { "name": "name", "type": "VARCHAR(255)" }, { "name": "age", "type": "INTEGER" } ] }
항목 삽입
지정된 테이블에 새로운 항목을 삽입합니다.
Claude Desktop의 입력:
{ "tableName": "example_table", "values": { "name": "John Doe", "age": 30 } }
항목 업데이트
조건에 따라 표의 기존 항목을 업데이트합니다.
Claude Desktop의 입력:
{ "tableName": "example_table", "values": { "age": 35 }, "conditions": "name = 'John Doe'" }
항목 삭제
조건에 따라 표에서 특정 항목을 삭제합니다.
Claude Desktop의 입력:
{ "tableName": "example_table", "conditions": "name = 'John Doe'" }
드롭 테이블
데이터베이스에서 기존 테이블을 삭제합니다.
Claude Desktop의 입력:
{ "tableName": "example_table" }
자원
서버는 데이터베이스의 각 테이블에 대한 스키마 정보를 제공합니다.
테이블 스키마 (
postgres://<host>/<table>/schema
)각 테이블에 대한 JSON 스키마 정보.
열 이름과 데이터 유형이 포함됩니다.
데이터베이스 메타데이터에서 자동으로 검색됩니다.
견본
Claude Desktop에 대한 입력
Claude Desktop의 출력
Claude Desktop에 대한 입력
Claude Desktop의 출력
Claude Desktop에 대한 입력
Claude Desktop의 출력
Claude Desktop에 대한 입력
Claude Desktop의 출력
DB 항목
특허
이 MCP 서버는 MIT 라이선스에 따라 라이선스가 부여됩니다. 즉, MIT 라이선스의 조건에 따라 소프트웨어를 자유롭게 사용, 수정 및 배포할 수 있습니다. 자세한 내용은 프로젝트 저장소의 LICENSE 파일을 참조하세요.
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
스키마를 검사하고 쿼리를 실행하기 위해 PostgreSQL 데이터베이스에 대한 읽기 전용 액세스 권한을 LLM에 제공하는 모델 컨텍스트 프로토콜 서버입니다.
Related Resources
Related MCP Servers
- -securityAlicense-qualityA Model Context Protocol server that provides read-only access to PostgreSQL databases. This server enables LLMs to inspect database schemas and execute read-only queries.Last updated -22,30470,826MIT License
- -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 -6088
- -securityFlicense-qualityA Model Context Protocol server that provides LLMs with full read-write access to PostgreSQL databases, allowing both querying and modifying database content with transaction management and safety controls.Last updated -5417
- -securityFlicense-qualityA Model Context Protocol server that provides read-only access to PostgreSQL databases, enabling LLMs to inspect database schemas and execute read-only queries.Last updated -22,304