PostgreSQL MCP Server
PostgreSQL MCP 서버
로컬 PostgreSQL 데이터베이스에 연결하여 AI 어시스턴트가 데이터베이스를 쿼리하고 관리할 수 있게 해주는 MCP(Model Context Protocol) 서버입니다.
제공되는 도구
도구 | 설명 |
query | 읽기 전용 SQL 실행 (SELECT, SHOW, EXPLAIN) |
execute | 쓰기 SQL 실행 (INSERT, UPDATE, DELETE, CREATE, ALTER, DROP) |
list_tables | 스키마 내의 모든 테이블 나열 |
describe_table | 테이블의 컬럼, 타입, 키 및 인덱스 표시 |
list_schemas | 데이터베이스 내의 모든 사용자 스키마 나열 |
Related MCP server: PostgreSQL MCP Server
리소스
schema-overview (
postgres://schema/overview) — Markdown 형식의 전체 데이터베이스 스키마 개요
헤더를 통한 동적 연결
이 서버는 동적 PostgreSQL 연결을 지원합니다. 초기 SSE 연결 요청 시 HTTP 헤더를 통해 데이터베이스 자격 증명을 제공할 수 있습니다. 이를 통해 배포된 단일 서버 인스턴스가 여러 개의 서로 다른 데이터베이스를 서비스할 수 있습니다.
지원되는 헤더
헤더 | 설명 | 기본값 |
| PostgreSQL 호스트 |
|
| PostgreSQL 포트 |
|
| PostgreSQL 사용자 |
|
| PostgreSQL 비밀번호 |
|
| PostgreSQL 데이터베이스 |
|
| SSL 사용 여부 ( |
|
| CA 인증서 |
|
Antigravity / Cursor (VS Code) 설정
Antigravity 또는 Cursor에서 이 서버를 사용하려면 mcp_config.json (보통 %APPDATA%\antigravity\ 또는 IDE의 MCP 설정에 위치)에 다음을 추가하세요:
{
"mcpServers": {
"postgres": {
"command": "npx",
"args": [
"mcp-remote",
"https://postgree-mcp-dfadduf9bsdvdwa9.eastasia-01.azurewebsites.net/sse",
"--header", "x-pg-host: pg-168600c0-aeiyankhan2-d42e.g.aivencloud.com",
"--header", "x-pg-port: 26768",
"--header", "x-pg-user: avnadmin",
"--header", "x-pg-password: YOUR_PASSWORD",
"--header", "x-pg-database: defaultdb",
"--header", "x-pg-ssl: true"
]
}
}
}Claude Code CLI 설정
Claude Code CLI를 사용하는 경우, 다음 명령어를 사용하여 이 서버를 추가할 수 있습니다:
1. Claude Code 설치 (아직 설치되지 않은 경우)
npm install -g @anthropic-ai/claude-code2. PostgreSQL MCP 서버 추가
터미널에서 다음 명령어를 실행하세요:
claude mcp add postgres -- npx mcp-remote https://postgree-mcp-dfadduf9bsdvdwa9.eastasia-01.azurewebsites.net/sse \
--header "x-pg-host: pg-168600c0-aeiyankhan2-d42e.g.aivencloud.com" \
--header "x-pg-port: 26768" \
--header "x-pg-user: avnadmin" \
--header "x-pg-password: YOUR_PASSWORD" \
--header "x-pg-database: defaultdb" \
--header "x-pg-ssl: true"Claude Desktop 설정
claude_desktop_config.json에 다음을 추가하세요:
{
"mcpServers": {
"postgres": {
"command": "npx",
"args": [
"mcp-remote",
"https://postgree-mcp-dfadduf9bsdvdwa9.eastasia-01.azurewebsites.net/sse",
"--header", "x-pg-host: pg-168600c0-aeiyankhan2-d42e.g.aivencloud.com",
"--header", "x-pg-port: 26768",
"--header", "x-pg-user: avnadmin",
"--header", "x-pg-password: YOUR_PASSWORD",
"--header", "x-pg-database: defaultdb",
"--header", "x-pg-ssl: true"
]
}
}
}로컬 설정 (개발용)
1. 의존성 설치
npm install2. 기본 데이터베이스 설정 (선택 사항)
로컬 개발을 위해 .env 파일을 계속 사용할 수 있습니다:
PG_HOST=localhost
PG_PORT=5432
PG_USER=postgres
PG_PASSWORD=your_password_here
PG_DATABASE=your_database_name3. 빌드 및 실행
npm run build
npm start사용 예시
설정이 완료되면 AI 어시스턴트에게 다음과 같이 요청할 수 있습니다:
"데이터베이스의 모든 테이블을 나열해 줘"
"users 테이블을 설명해 줘"
"SELECT * FROM orders WHERE created_at > '2025-01-01'"
"products라는 이름의 새 테이블을 생성해 줘"
This server cannot be deployed
Maintenance
Related MCP Connectors
Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.
Query Postgres, MySQL, SQL Server, Oracle, BigQuery, ClickHouse and Redshift from your AI client.
PostgreSQL, MySQL, and SQL Server in one session. 26 read-only MCP tools for AI agents.
Your Supabase account in natural language: run SQL, apply migrations, manage tables, storage, edge f
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables Claude to interact with a local PostgreSQL database through SQL queries, schema inspection, and CRUD operations.8183 npmMIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with PostgreSQL databases through natural language queries, schema inspection, and safe SQL execution.5 npm1ISC
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to query and explore PostgreSQL databases with tools for executing SQL queries, listing tables, and describing table structures.MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI models to execute SQL queries, list tables, and describe table structures on a local PostgreSQL database.12 npmISC