A community-driven registry for Claude, Cursor, Windsurf, Cline & more. Not affiliated with Anthropic.
Are you the author? Sign in to claim
A Model Context Protocol (MCP) server that provides secure PostgreSQL database integration tools for Claude Code. Featur
A Model Context Protocol (MCP) server that provides PostgreSQL integration tools for Claude Code.
# Add the tap and install
brew tap sgaunet/homebrew-tools
brew install sgaunet/tools/postgresql-mcp
Download the latest release:
Visit the releases page and download the appropriate binary for your platform:
postgresql-mcp_VERSION_darwin_amd64 (Intel) or postgresql-mcp_VERSION_darwin_arm64 (Apple Silicon)postgresql-mcp_VERSION_linux_amd64 (x86_64) or postgresql-mcp_VERSION_linux_arm64 (ARM64)postgresql-mcp_VERSION_windows_amd64.exeMake it executable (macOS/Linux):
chmod +x postgresql-mcp_*
Move to a location in your PATH:
# Example for macOS/Linux
sudo mv postgresql-mcp_* /usr/local/bin/postgresql-mcp
Clone the repository:
git clone https://github.com/sgaunet/postgresql-mcp.git
cd postgresql-mcp
Build the project:
task build
Or manually:
go build -o postgresql-mcp
Install to your PATH:
sudo mv postgresql-mcp /usr/local/bin/
Add the MCP server in the configuration of the project. At the root of your project, create a file named `.mcap.json' with the following content:
{
"mcpServers": {
"postgres": {
"type": "stdio",
"command": "postgresql-mcp",
"args": [],
"env": {
"POSTGRES_URL": "postgres://postgres:password@localhost:5432/postgres?sslmode=disable"
}
}
}
}
Don't forget to add the .mcp.json file in your .gitignore file if you don't want to commit it. It usually make sense to declare the MCP server for postgresl at the project level, as the database connection is project specific.
The PostgreSQL MCP server can be configured via environment variables.
POSTGRES_URL: PostgreSQL connection URL (format: postgres://user:password@host:port/dbname?sslmode=prefer)DATABASE_URL: Alternative to POSTGRES_URL if POSTGRES_URL is not setExample:
export POSTGRES_URL="postgres://user:password@localhost:5432/mydb?sslmode=prefer"
# or
export DATABASE_URL="postgres://user:password@localhost:5432/mydb?sslmode=prefer"
Note: Connection environment variables are optional. Use the connect_database tool for explicit connection management. The server will attempt to reconnect automatically when a tool is requested.
| Variable | Description | Default |
|---|---|---|
POSTGRES_MCP_MAX_OPEN_CONNS | Maximum open database connections (pgxpool MaxConns) | 10 |
POSTGRES_MCP_MAX_IDLE_CONNS | Minimum connections kept warm (pgxpool MinConns); clamped to the open limit | 5 |
POSTGRES_MCP_CONN_MAX_LIFETIME | Connection max lifetime in seconds | 3600 |
POSTGRES_MCP_CONN_MAX_IDLE_TIME | Connection max idle time in seconds | 600 |
POSTGRES_MCP_MAX_RESULT_ROWS | Maximum rows returned per query | 10000 |
The server automatically manages database connections with health checks and transparent reconnection:
connect_database.Only one reconnection attempt is made per operation — there is no retry loop or backoff. For environments with frequent connection drops, consider tuning POSTGRES_MCP_CONN_MAX_LIFETIME and POSTGRES_MCP_CONN_MAX_IDLE_TIME to recycle connections proactively.
The PostgreSQL MCP server provides 9 database tools for interacting with PostgreSQL databases. For detailed information about each tool, including parameters, return values, and examples, see the Tools Documentation.
This MCP server is designed with security as a priority:
Configure the MCP server in your Claude Code settings.
Set up your database connection via environment variables:
export POSTGRES_URL="postgres://user:pass@localhost:5432/mydb"
Use the tools in your conversations:
List all tables in the public schema
Describe the users table
Execute query: SELECT * FROM users LIMIT 10
go build -o postgresql-mcp
# Run unit tests only (no Docker required)
SKIP_INTEGRATION_TESTS=true go test ./...
# Run all tests including integration tests (requires Docker)
go test ./...
# Run only integration tests
go test -run "TestIntegration" ./...
Note: Integration tests use testcontainers to automatically spin up PostgreSQL instances in Docker containers. This ensures tests are isolated, reproducible, and don't require manual PostgreSQL setup.
POSTGRES_URL or DATABASE_URL environment variable is correctly setpostgres://user:password@host:port/dbname?sslmode=preferThis project is licensed under MIT license.
MCP server integration for DaVinci Resolve Studio
mcp-language-server gives MCP enabled clients access semantic tools like get definition, references, rename, and diagnos
Run Claude Code as an MCP server so any agent can delegate coding tasks to it
Browser automation using accessibility snapshots instead of screenshots