Skip to main content
MCP server plugin · listing tai42/mcp-dynamic-postgres

Install

Permissions

Provides

mcp-dynamic-postgres

MCP server — Schema-driven generator for safe, scoped PostgreSQL DML tools in FastMCP agent systems Point the server at a PostgreSQL database and it introspects the schema and generates one typed MCP tool per DML operation per table. What the agent can reach is set two ways that must agree: the CLI flags below decide which tools exist, and the PostgreSQL role you connect as decides what those tools can physically do. Connect as a dedicated least-privilege role, never a superuser.

Connection settings

Connection and pooling come from environment variables. PG_DB, PG_USER, and PG_PASSWORD have no default — a missing one fails at startup rather than connecting with a phantom value.

Scoping flags

The flags decide which tools are generated and how permissive they are.

Transport

The default transport is stdio: an MCP client launches the server as a subprocess and speaks over stdin/stdout. Wire it into a client’s server list, passing the connection settings through env:
For a network-mounted server, choose an HTTP transport and bind a host and port (--host / --port apply only here):

Generated tools

For a table public.events you get (unless --readonly):
  • select_public_events(where, order_by, limit, offset)
  • insert_public_events(params, raise_on_conflict)
  • update_public_events(data, where)
  • delete_public_events(where)
Column types map to native Python: temporal columns to datetime/date/time, uuid to uuid.UUID, numeric/decimal to Decimal, json/jsonb to Any, and array columns to list[...]. insert returns the table’s real primary key (a scalar list for a single-column key, a list of lists for a composite key, or the affected row count when the table has none); columns with a database default are omittable. order_by items take an optional nulls (FIRST/LAST).

Filtering — WhereFilter

select, update, and delete accept a where argument. Field names must be real columns of the table; unknown fields are rejected, and values are always bound parameters, so there is no path for SQL injection through field names.
Operators: eq, ne, gt, gte, lt, lte, like, not_like, ilike, not_ilike, in, not_in, between, is_null, and knn (pgvector). Logical keys: AND, OR, NOT.

Vector search (pgvector)

When a column is a vector, filter or order by similarity. Requires the pgvector extension enabled in the database.

Docker