# PostgreSQL Database Management Server

Analyze, manage, and optimize your PostgreSQL databases effortlessly. Streamline your database operations with powerful tools for debugging, schema management, and data migration. Enhance performance…

## Quick Start

```bash
# Connect this server (installs CLI if needed)
npx -y @smithery/cli@latest mcp add HenkDz/postgresql-mcp-server

# Browse available tools
npx -y @smithery/cli@latest tool list HenkDz/postgresql-mcp-server

# Get full schema for a tool
npx -y @smithery/cli@latest tool get HenkDz/postgresql-mcp-server pg_analyze_database

# Call a tool
npx -y @smithery/cli@latest tool call HenkDz/postgresql-mcp-server pg_analyze_database '{}'
```

## Tools (18)

- `pg_analyze_database` — Analyze PostgreSQL database configuration and performance
- `pg_debug_database` — Debug common PostgreSQL issues
- `pg_manage_schema` — Manage PostgreSQL schema - get schema info, create/alter tables, manage enums. Examples: operation="get_info" for table…
- `pg_manage_functions` — Manage PostgreSQL functions - get, create, or drop functions with a single tool. Examples: operation="get" to list func…
- `pg_manage_triggers` — Manage PostgreSQL triggers - get, create, drop, and enable/disable triggers. Examples: operation="get" to list triggers…
- `pg_manage_indexes` — Manage PostgreSQL indexes - get, create, drop, reindex, and analyze usage with a single tool. Examples: operation="get"…
- `pg_manage_constraints` — Manage PostgreSQL constraints - get, create foreign keys, drop foreign keys, create constraints, drop constraints. Exam…
- `pg_manage_rls` — Manage PostgreSQL Row-Level Security - enable/disable RLS and manage policies. Examples: operation="enable" with tableN…
- `pg_manage_users` — Manage PostgreSQL users and permissions - create, drop, alter users, grant/revoke permissions. Examples: operation="cre…
- `pg_manage_query` — Manage PostgreSQL query analysis and performance - operation="explain" for EXPLAIN plans, operation="get_slow_queries" …
- `pg_execute_query` — Execute SELECT queries and data retrieval operations - operation="select/count/exists" with query and optional paramete…
- `pg_execute_mutation` — Execute data modification operations (INSERT/UPDATE/DELETE/UPSERT) - operation="insert/update/delete/upsert" with table…
- `pg_execute_sql` — Execute arbitrary SQL statements - sql="ANY_VALID_SQL" with optional parameters and transaction support. Examples: sql=…
- `pg_manage_comments` — Manage PostgreSQL object comments - get, set, remove comments on tables, columns, functions, and other database objects…
- `pg_export_table_data` — Export table data to JSON or CSV format
- `pg_import_table_data` — Import data from JSON or CSV file into a table
- `pg_copy_between_databases` — Copy data between two databases
- `pg_monitor_database` — Get real-time monitoring information for a PostgreSQL database

```bash
# Get full input/output schema for a tool
npx -y @smithery/cli@latest tool get HenkDz/postgresql-mcp-server <tool-name>
```

---

Source: https://github.com/HenkDz/postgresql-mcp-server | License: AGPL-3.0
