This connector is designed for a dedicated analytics database or replica, not your application’s primary operational database. Point it at a read replica or a least-privilege reporting role.
What you’ll need
- A PostgreSQL connection string for the database you want Aperium to read.
- A database role scoped for analytics — ideally login-only with
SELECTon just the tables in scope, and none ofSUPERUSER,CREATEROLE,CREATEDB,REPLICATION, orBYPASSRLS. - The list of schemas (and, optionally, specific tables) you want to expose as query scopes.
How it connects
Aperium stores the connection string encrypted against the tenant. Setup does no network I/O — the connection is not dialed at save time (which would be an SSRF vector against the operator-submitted host). Connectivity is validated on the first tool call instead. At save time Aperium runs two classes of check:Hard failure — host-DB collision
Hard failure — host-DB collision
The connection’s host, port, and database are compared against Aperium’s own registered databases, resolving hostnames to IPs so
localhost, 127.0.0.1, and container DNS all collide. A collision, or a malformed connection string or scopes definition, is rejected outright.Non-fatal warnings — least privilege
Non-fatal warnings — least privilege
Aperium warns (but still lets you save) if the role can’t log in or holds a disqualifying privilege (
SUPERUSER, CREATEROLE, CREATEDB, REPLICATION, BYPASSRLS), if it has SELECT on Aperium’s own sentinel tables, or if the host is a private/loopback address. The warnings surface in the admin UI so you can confirm a save-anyway.Setup
1
Open the Postgres setup form
In the admin onboarding flow or the Admin Console’s MCP Servers tab, open the Postgres connector’s setup form.
2
Enter the connection string
Paste the connection string into the Connection String field. It is marked secret and stored encrypted against your tenant.
3
Define query scopes
Provide the Query Scopes JSON — the allowlist of schemas (and optional per-schema table allowlists) agents may read. Every tool call resolves through this allowlist before any SQL runs.
4
Set the safety caps (optional)
Optionally override Max Result Rows, Query Timeout (seconds), and Max Response Bytes. Leave blank to use the server defaults. Click Enable.
What agents can do
Once configured, agents can call five tools:- List scopes. Return the database, host, configured scopes, and caps — no SQL runs.
- Schema overview. Enumerate the schemas and tables inside the configured scopes, with estimated row counts.
- Describe table. Inspect a table’s columns, types, and primary-key columns. Tables outside every scope are rejected before any SQL runs.
- Run SQL. Execute a SELECT-only query against the allowlisted schemas.
- Explain. Return the query plan for a SELECT statement.
Safety model
Every query is guarded before it reaches the database:- SELECT-only. The statement is parsed to an AST;
INSERT,UPDATE,DELETE,MERGE,CREATE,DROP,ALTER,TRUNCATE, andSETare rejected at the tool layer. - Function deny-list. Dangerous functions (for example
pg_read_server_files,dblink,pg_terminate_backend,lo_export,pg_ls_dir) are rejected. - Scope enforcement. Every referenced base table must be schema-qualified and inside a configured scope; unqualified names are rejected so
search_pathcan’t resolve them to an out-of-scope schema. - Bounded execution. Queries run inside a
READ ONLYtransaction with statement and lock timeouts, a row-LIMITcap, and a response-byte cap.