postgres-mcp-server
v0.1.4Model Context Protocol (MCP) server for PostgreSQL databases
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
list_tables
Discover schemas and their tables/columns without writing a query (FR-002)
| Parameter | Type | Description |
|---|---|---|
schema | string | Optional schema name to filter tables (defaults to all non-system schemas) |
describe_table
Detail the columns, types, and primary keys of a specific table (FR-002)
| Parameter | Type | Description |
|---|---|---|
schema * | string | Schema name (e.g. 'public') |
table * | string | Table name |
list_databases
Discover databases visible/connectable to the connected user (FR-002a)
list_roles
Discover roles/users and their attributes and memberships (FR-002b)
list_permissions
Discover privileges granted to roles on schemas, tables, and columns (FR-002c)
| Parameter | Type | Description |
|---|---|---|
objectType | string | Optional object type filter: 'schema', 'table', or 'column' |
schema | string | Optional schema filter (e.g. 'public') |
table | string | Optional table filter |
run_query
Execute a read-only SELECT query and return structured rows (FR-003)
| Parameter | Type | Description |
|---|---|---|
sql * | string | Read-only SQL query to execute (e.g. SELECT) |
limit | integer | Maximum number of rows to return (capped by server maxRowLimit) |
offset | integer | Number of rows to skip before returning results |
params | array | Optional parameterized query values ($1, $2, etc.) |
role | string | Optional PostgreSQL role to assume (SET ROLE) for this query only |
run_write_query
Execute INSERT/UPDATE/DELETE/DDL statements when write mode is enabled (FR-006)
| Parameter | Type | Description |
|---|---|---|
sql * | string | SQL write/DDL statement to execute (e.g. INSERT, UPDATE, DELETE, CREATE TABLE) |
params | array | Optional parameterized query values ($1, $2, etc.) |
role | string | Optional PostgreSQL role to assume (SET ROLE) for this write query only |
set_role
Set active PostgreSQL role/user for the session (SET ROLE) or reset to default (RESET ROLE)
| Parameter | Type | Description |
|---|---|---|
role * | string | Role or username to set (e.g. 'analyst', 'app_user', or 'NONE' / 'RESET' to restore default) |