mcp-postgres

v0.4.1
@apono-io/mcp-postgres Checked 6 hours ago Published 28 days ago

Apono MCP server for PostgreSQL databases with JIT credential support

Apono MCP server for PostgreSQL databases with JIT credential support. All tools accept a database parameter to specify which database to operate on. Every statement runs with statement_timeout and idle_in_transaction_session_timeout applied. PostgreSQL enforces both itself, so a statement that outlives its client still ends, and the snapshot it holds is released rather than blocking vacuum until the query finishes on its own.

Summary extracted from the README.

@apono-io/mcp-postgres

Apono MCP server for PostgreSQL databases with JIT credential support.

Tools

Tool Description
execute Execute any SQL statement, including SELECT and EXPLAIN. Returns rows when the statement returns rows
list_schemas List all schemas in the database
list_tables List all tables in a schema
describe_table Get column names, types, constraints, and indexes for a table
list_extensions List installed PostgreSQL extensions
get_table_indexes List indexes on a specific table

All tools accept a database parameter to specify which database to operate on.

Environment Variables

Variable Description
POSTGRES_HOST PostgreSQL server hostname
POSTGRES_PORT PostgreSQL server port (default: 5432)
POSTGRES_USER Database username
POSTGRES_PASSWORD Database password
PGSSLMODE disable turns TLS off; otherwise TLS without certificate verification
POSTGRES_STATEMENT_TIMEOUT_MS How long a statement may run, in milliseconds (default: 600000, 0 keeps the server's own setting)
POSTGRES_IDLE_IN_TRANSACTION_TIMEOUT_MS How long a transaction may sit idle, in milliseconds (default: 60000, 0 keeps the server's own setting)

How long a statement may run

Every statement runs with statement_timeout and idle_in_transaction_session_timeout applied. PostgreSQL enforces both itself, so a statement that outlives its client still ends, and the snapshot it holds is released rather than blocking vacuum until the query finishes on its own.

A pooled connection keeps whatever a caller SET on it, so both are reapplied on each checkout. A caller can still raise either one for the duration of its own statement — these bound an accidental runaway query, not a deliberate one — but that change does not carry over to the next call.