Skip to main content
Glama
aeiyannn

PostgreSQL MCP Server

by aeiyannn

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 헤더를 통해 데이터베이스 자격 증명을 제공할 수 있습니다. 이를 통해 배포된 단일 서버 인스턴스가 여러 개의 서로 다른 데이터베이스를 서비스할 수 있습니다.

지원되는 헤더

헤더

설명

기본값

x-pg-host

PostgreSQL 호스트

PG_HOST 또는 localhost

x-pg-port

PostgreSQL 포트

PG_PORT 또는 5432

x-pg-user

PostgreSQL 사용자

PG_USER 또는 postgres

x-pg-password

PostgreSQL 비밀번호

PG_PASSWORD 또는 postgres

x-pg-database

PostgreSQL 데이터베이스

PG_DATABASE 또는 postgres

x-pg-ssl

SSL 사용 여부 (true/false)

PG_SSL 또는 false

x-pg-ca-cert

CA 인증서

PG_CA_CERT


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-code

2. 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 install

2. 기본 데이터베이스 설정 (선택 사항)

로컬 개발을 위해 .env 파일을 계속 사용할 수 있습니다:

PG_HOST=localhost
PG_PORT=5432
PG_USER=postgres
PG_PASSWORD=your_password_here
PG_DATABASE=your_database_name

3. 빌드 및 실행

npm run build
npm start

사용 예시

설정이 완료되면 AI 어시스턴트에게 다음과 같이 요청할 수 있습니다:

  • "데이터베이스의 모든 테이블을 나열해 줘"

  • "users 테이블을 설명해 줘"

  • "SELECT * FROM orders WHERE created_at > '2025-01-01'"

  • "products라는 이름의 새 테이블을 생성해 줘"

A
license - permissive license
Not graded
quality - not tested
D
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    A
    quality
    D
    maintenance
    Enables Claude to interact with a local PostgreSQL database through SQL queries, schema inspection, and CRUD operations.
    8
    225
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI agents to query and explore PostgreSQL databases with tools for executing SQL queries, listing tables, and describing table structures.
    MIT

View all related MCP servers

Related MCP Connectors

  • Query PostgreSQL databases in plain English — LLM-generated, safety-validated SQL.

  • Comprehensive PostgreSQL documentation and best practices, including ecosystem tools

  • Explore, query, and inspect SQLite databases with ease. List tables, preview results, and view det…

View all MCP Connectors

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/aeiyannn/postgree-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server