tendant/postgres-mcp-go
3.2
If you are the rightful owner of postgres-mcp-go and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
A PostgreSQL MCP (Model Context Protocol) server implementation in Go that provides secure database access for AI agents.
postgres-mcp-go
A PostgreSQL MCP (Model Context Protocol) server implementation in Go that provides secure database access for AI agents.
Features
- Multiple modes: stdio and HTTP server
- Security: Read-only mode support, query validation
- Connection pooling: Efficient PostgreSQL connection management
- Configurable limits: Row limits, timeouts, request size controls
Quick Start
# Build
make build
# Run in stdio mode (for AI agents)
DATABASE_URL="postgres://user:pass@host/db" make run-stdio
# Run HTTP server
DATABASE_URL="postgres://user:pass@host/db" make run-http
Usage
# Basic usage
./bin/postgres-mcp --database-url "postgres://user:pass@host/db"
# Read-only mode (recommended)
./bin/postgres-mcp --database-url "postgres://user:pass@host/db" --readonly
# HTTP mode
./bin/postgres-mcp --mode http --listen :8080 --database-url "postgres://user:pass@host/db"
Configuration
--mode
:stdio
(default) orhttp
--database-url
: PostgreSQL connection string--readonly
: Reject mutating SQL statements--max-rows
: Limit rows returned per query--timeout
: Per-request timeout--listen
: HTTP listen address (HTTP mode)
Requirements
- Go 1.23.3+
- PostgreSQL database