pg-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| PGHOST | No | Database host, or the Unix socket directory (starts with /). | localhost |
| PGPORT | No | Database port. | 5432 |
| PGUSER | No | Database role. Defaults to the OS user name. | |
| PGSSLMODE | No | TLS mode: disable, allow, prefer, require, verify-ca, verify-full; only the last two check the certificate. | prefer |
| PGDATABASE | No | Database name. Defaults to the same as PGUSER. | |
| PGPASSFILE | No | Password file. Defaults to ~/.pgpass, on Windows %APPDATA%\postgresql\pgpass.conf. | ~/.pgpass |
| PGPASSWORD | No | Password. Works, but install.py never copies it: the password belongs in the password file. | |
| PG_MCP_LANG | No | Language: en or ru. Defaults from the system locale. | |
| PG_MCP_NAME | No | Entry name that status shows; install.py --name writes it. | pg |
| PGSERVICEFILE | No | Your psql services file; stands are read from it too. Defaults to ~/.pg_service.conf, on Windows %APPDATA%\postgresql\.pg_service.conf. | ~/.pg_service.conf |
| PGSSLROOTCERT | No | CA certificate for verify-ca and verify-full. | |
| PG_MCP_STANDS | No | * or stand name patterns such as dev*,ift2: one entry for many stands. Off when unset. | |
| PG_MCP_PROFILE | No | Tool profile: schema, explore or analyst. | explore |
| PG_MCP_LOG_LEVEL | No | Detail of the stderr log: DEBUG, INFO, WARNING, ERROR. | INFO |
| PG_MCP_QUERY_LOG | No | Absolute path of the query log file. Off when unset. | |
| PG_MCP_STANDS_FILE | No | Stands registry file. Defaults to ~/.pg-mcp/stands.conf, on Windows %APPDATA%\pg-mcp\stands.conf. | ~/.pg-mcp/stands.conf |
| PG_MCP_MAX_CONNECTIONS | No | Connections an entry for stands keeps open. | 8 |
| PG_MCP_SOCKET_TIMEOUT_S | No | Seconds to wait for a new connection; for stands the default is 10. Once connected, the socket waits at least the query timeout plus 5 seconds. | 30 |
| PG_MCP_MAX_RESPONSE_CHARS | No | Budget of one answer in characters, at least 500. | 8000 |
| PG_MCP_STATEMENT_TIMEOUT_MS | No | Timeout of one query in milliseconds. | 5000 |
Instructions
Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.
This server publishes no instructions, or was last inspected before Glama recorded them.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": false
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| statusA | Read-only server: database, role, profile and limits. Call it first, and when a tool reports a connection problem: it says what to fix. |
| list_tablesA | Tables, views and foreign tables the role can read, with row estimates and comments. At most 200; pass schema to narrow. |
| search_schemaA | Find tables, views and columns by a piece of name or comment; use it instead of paging list_tables. At most 100 matches. |
| describe_tableA | Columns with types, NOT NULL, defaults and comments; keys, referencing tables, indexes. |
| sample_rowsA | A few rows of a table or view, optionally some columns. Default 10, at most 50, in no order. |
| explain_queryA | PostgreSQL's plan for one read-only query passed without EXPLAIN; the query is not run. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
TDQS
Scored across 6 tools
The majority of tools are distinct, separating schema listing, searching, detailing, data sampling, and query planning. However, `list_tables` and `search_schema` share a similar purpose of object discovery, which could occasionally cause agent confusion.
The tool names exhibit a very consistent naming convention, generally adhering to the action_object format using snake_case. The naming pattern is immediately recognizable and predictable across the entire tool set.
With 6 tools, the surface is well-scoped for a read-only PostgreSQL introspection server. Each tool performs a distinct function, contributing meaningfully to database inspection without being overly verbose or incomplete.
The tool set provides comprehensive coverage for read-only operations, including health checks, schema discovery, structural inspection, data sampling, and query planning. Minor gaps remain but do not prevent an agent from performing core database tasks.