Postgres MCP
Postgres MCP
Postgres MCP
crystaldba/postgres-mcp — a Model Context Protocol server that exposes the cluster’s PostgreSQL instance to MCP-compatible AI clients (e.g. Claude, other LLM tooling) over SSE. Runs in the default namespace of the k3s cluster.
Deployment
| Item | Value |
|---|---|
| Image | crystaldba/postgres-mcp:latest |
| Namespace | default |
| Replicas | 1 |
| Service | LoadBalancer, port 8000 (MetalLB-assigned external IP 192.168.1.38) |
| Transport | SSE (--transport sse --sse-host 0.0.0.0) |
| Access mode | restricted (--access-mode restricted) |
| Auto-reload | reloader.stakater.com/auto: "true" |
Configuration
Connects to the cluster’s PostgreSQL instance over the in-cluster service DNS name, not the external LoadBalancer IP:
1
DATABASE_URI = postgresql://$(POSTGRES_USER):$(POSTGRES_PASSWORD)@postgres.default.svc.cluster.local:5432/$(POSTGRES_DB)
POSTGRES_USER, POSTGRES_PASSWORD, and POSTGRES_DB are all injected from the same postgres-secret Secret that backs the PostgreSQL deployment itself, so credentials stay in one place.
The --access-mode restricted flag limits the MCP server to safer, read-oriented operations rather than full unrestricted SQL access.
This post is licensed under CC BY 4.0 by the author.