loading…
Search for a command to run...
loading…
A Model Context Protocol server that enables natural language data exploration and visualization for PostgreSQL databases. It allows users to convert questions
A Model Context Protocol server that enables natural language data exploration and visualization for PostgreSQL databases. It allows users to convert questions into SQL queries and interact with data through a Streamlit web interface featuring automated chart generation.
v1.2.0 | MCP SDK 1.26 · psycopg 3 · Streamlit
PostgreSQL 데이터베이스를 MCP(Model Context Protocol) 로 연결하여,
AI와 대화하며 자연어로 데이터를 탐색하고 시각화하는 프로젝트입니다.
| 기능 | 설명 |
|---|---|
| 자연어 → SQL 변환 | 복잡한 SQL 문법 없이 질문으로 데이터 조회 |
| MCP 프로토콜 지원 | Claude Desktop(stdio) 및 기타 MCP 클라이언트(SSE)와 연동 |
| Streamlit Web UI | 채팅 인터페이스 + Plotly 차트 자동 생성 |
| 실전형 데모 데이터 | 한국형 인사관리 데이터셋 자동 생성 스크립트 포함 |
# 의존성 설치
poetry install
프로젝트 루트에 .env 파일을 생성하고 데이터베이스 정보를 입력하세요.
# PostgreSQL 접속 정보
DB_HOST=localhost
DB_PORT=5432
DB_NAME=postgres
DB_USER=postgres
DB_PASSWORD=your_password
# (선택) AI API 키 — Streamlit 웹 UI에서 자연어→SQL 변환 시 필요
ANTHROPIC_API_KEY=sk-ant-...
OPENAI_API_KEY=sk-...
실습용 인사관리 테이블을 생성하고 약 50명의 가상 사원 정보를 채웁니다.
poetry run python scripts/setup_demo_data.py
Claude Desktop의 설정 파일 %APPDATA%\Claude\claude_desktop_config.json 에 아래 내용을 추가합니다.
{
"mcpServers": {
"postgresql": {
"command": "<프로젝트경로>\\.venv\\Scripts\\python.exe",
"args": ["-m", "src.server"],
"env": {
"PYTHONPATH": "<프로젝트경로>"
}
}
}
}
설정 후 Claude Desktop을 재시작하면 자동으로 MCP 서버가 연결됩니다.
SSE 백엔드 서버와 Streamlit 프론트엔드를 각각 실행합니다.
# 터미널 1: MCP 서버 (SSE 모드)
poetry run python -m src.server --sse
# 터미널 2: Streamlit 앱
poetry run streamlit run src/streamlit_app.py
더 많은 예시는 query.md 를 참고하세요.
PostgreSQL_MCP/
├── src/ # 핵심 패키지 (서버 + 설정 + 웹 UI)
│ ├── __init__.py # 패키지 메타 (버전 정보)
│ ├── server.py # MCP 서버 핵심 로직 (stdio + SSE 전송)
│ ├── config.py # 통합 설정 (DB, MCP, AI 프롬프트 등)
│ └── streamlit_app.py # Streamlit 웹 UI (채팅 + 차트)
├── scripts/
│ └── setup_demo_data.py # 데모 데이터(인사관리) 생성 스크립트
├── docs/
│ └── ARCHITECTURE.md # 시스템 아키텍처 문서
├── query.md # 추천 자연어 쿼리 예시 모음
├── pyproject.toml # Poetry 의존성 관리
├── claude_desktop_config.json # Claude Desktop 설정 예시
└── archive/ # 이전 버전 / 디버깅용 파일 보관
Run in your terminal:
claude mcp add postgresql-mcp-ai-explorer -- npx Yes, PostgreSQL AI Explorer MCP is free — one-click install via Unyly at no cost.
No, PostgreSQL AI Explorer runs without API keys or environment variables.
Self-hosted: the server runs locally on your machine via the install command above.
Open PostgreSQL AI Explorer on unyly.org, pick your client tab (Claude Desktop, Claude Code, Cursor) and press Install — the config is generated automatically, no JSON editing.
Query your database in natural language
by AnthropicA universal database MCP server supporting simultaneous connections to multiple databases. It provides tools for database operations, health analysis, SQL optim
by wenb1n-devThis server enables interaction with PostgreSQL databases through the Model Context Protocol, optimized for the AWS Bedrock AgentCore Runtime. It provides tools
by madhurprashRead-only database access with schema inspection.
by modelcontextprotocolNot sure what to pick?
Find your stack in 60 seconds
Author?
Embed badge for your README
Browse similar
All data MCPs