Set up PostgreSQL in Metorial for Claude, ChatGPT and Cursor
Share PostgreSQL with your team in Claude, ChatGPT and Cursor through Metorial: connection parameters or connection string sign-in, 13 tools (4 read-only).
To give your team PostgreSQL in Claude, ChatGPT, Cursor and other AI clients, an admin shares the PostgreSQL integration in a Metorial portal, and each person connects with connection parameters. Agents can query, insert, update, and delete data in PostgreSQL relational databases. The integration has 13 tools, 4 read-only, 2 write and 7 destructive, plus 2 triggers.
What you'll learn
- How an admin shares PostgreSQL in a portal and how each person connects
- What PostgreSQL asks for when you connect, and where to find it
- How to keep the 4 read-only tools and reject the other 9
Before you start
- A portal with at least one access group
- Connection parameters from PostgreSQL for each person, or one set for a shared connection
- For the CLI steps: the Metorial CLI, signed in to your portal
Sign-in methods
| Method | Type | What a person provides |
|---|---|---|
| Connection Parameters (default) | Custom credentials | host, port, database, username, password and sslMode |
| Connection String | Custom credentials | connectionString |
The portal and metorial setup use Connection Parameters unless someone picks another method.
Connection Parameters
To connect, a person enters these values:
host: PostgreSQL server hostname or IP addressport(optional): PostgreSQL server port (default: 5432)database: Target database nameusername: Database usernamepassword: Database passwordsslMode(optional): SSL connection mode One of "disable", "require", "verify-ca", "verify-full".
Connection String
To connect, a person enters:
connectionString: PostgreSQL connection URI (e.g., postgresql://user:password@host:5432/dbname?sslmode=require)
Setup settings
Whichever method you pick, setup also asks for:
defaultSchema(optional): Default schema to use for queries when not explicitly specifiedqueryTimeout(optional): Query timeout in millisecondsmaxRows(optional): Maximum number of rows to return from queries by default
Admin: share PostgreSQL in a portal
In the dashboard
Open Shared Resources
Open Workforce, choose the portal, and select Shared Resources under Access.
Share a new integration
Select Share a Resource, then New Integration, and choose PostgreSQL. Under Auth Method, keep Connection Parameters or pick another. For how members connect, choose Each person connects so everyone enters their own connection parameters, or Shared connection to enter the connection parameters once for everyone.
Limit the tools
Under Tool Filters, set the write and destructive groups to Reject if agents should only read from PostgreSQL.
Choose who gets it
Add the access groups that should see PostgreSQL. When a person asks for access from the portal, the request appears under Access Requests.
With the CLI
The CLI cannot create the per-user PostgreSQL integration. Once it exists, check which groups have it:
Employee: connect PostgreSQL
In the portal
Open PostgreSQL in the catalog
Sign in to your portal and open PostgreSQL. The status reads Available.
Authenticate
Under Quick setup, select Authenticate. In the setup window, enter your connection parameters (host, database, username and password).
Confirm
The status changes to Configured. If it later reads Needs reconnect, select Reconnect and sign in again.
With the CLI
catalog search prints the catalog item ID. metorial setup uses Connection Parameters. To connect with Connection String instead, find its ID with metorial catalog get <catalog-item-id> and add --auth-method <auth-method-id>.
Add it to your AI client
metorial install adds your PostgreSQL connection to a local MCP client such as Claude Code, Cursor or Codex. metorial list prints the integration ID and metorial client list the client identifiers.
For a client that takes a server URL, such as ChatGPT, metorial install custom <integration-id> creates an installation token and shows the endpoint details.
Make it read-only
Open the integration's Tool Filters and set the write and destructive groups to Reject. Agents keep the 4 read-only tools, such as list_tables and list_schemas, and lose the 2 write tools, such as insert_rows or execute_query, and the 7 destructive tools, such as delete_rows or update_rows.
Employees see the result on the integration's page in the portal under Tool access. For the full walkthrough, see Tool permissions.
Check it worked
metorial tools lists the 13 tools, minus any you rejected. list_tables takes no input. It lists all tables in the PostgreSQL database, optionally filtered by schema.
To see every input a tool takes, run metorial schema <integration-id> <tool-key>.
Tools
Read-only tools (4)
list_tables: List all tables in the PostgreSQL database, optionally filtered by schema.list_schemas: List all schemas in the PostgreSQL database with their table counts and sizes.describe_table: Get detailed schema information for a specific table, including columns, data types, constraints, indexes, and foreign keys. NeedstableName.select_query: Run a read-only SELECT query against the PostgreSQL database. Needssql.
Write tools (2)
insert_rows: Insert one or more rows into a PostgreSQL table. NeedstableNameandrows.execute_query: Execute an arbitrary SQL query against the PostgreSQL database. Needssql.
Destructive tools (7)
delete_rows: Delete rows from a PostgreSQL table based on a WHERE condition. NeedstableName.manage_table: Create, alter, or drop a PostgreSQL table. NeedsactionandtableName.manage_roles: Manage PostgreSQL roles and their privileges. Needsaction.manage_indexes: Create or drop indexes on PostgreSQL tables. NeedsactionandindexName.update_rows: Update rows in a PostgreSQL table based on a WHERE condition. NeedstableNameandset.manage_schemas: Create, rename, or drop PostgreSQL schemas. NeedsactionandschemaName.manage_views: Create and drop PostgreSQL views or materialized views, and refresh materialized views. NeedsactionandviewName.
Triggers
PostgreSQL has 2 triggers, which fire on events in PostgreSQL:
table_row_changes: Polls a PostgreSQL table for new or updated rows based on a timestamp or auto-incrementing column.inbound_webhook
Next steps
- Claude Code, Cursor, Codex and ChatGPT: connect each client to your portal and use PostgreSQL there
- Tool permissions: tool filters and what employees see
- PostgreSQL on metorial.com: the integration overview