pg-insight-mcp
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| DATABASE_URL | Yes | PostgreSQL connection string | |
| PG_INSIGHT_MAX_ROWS | No | Maximum rows returned per query | 200 |
| PG_INSIGHT_ALLOWED_SCHEMAS | No | Comma-separated schema allow-list; system schemas are never exposed | all |
| PG_INSIGHT_STATEMENT_TIMEOUT_MS | No | Per-statement timeout 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.
Read-only access to a PostgreSQL database. Start with list_schemas and list_tables, use describe_table before writing a query, and prefer explain_query for anything that may scan a large table. Only SELECT, WITH, EXPLAIN, SHOW, VALUES and TABLE statements are accepted.
Capabilities
Features and capabilities supported by this server
Protocol revision2025-11-25
| Capability | Details |
|---|---|
| tools | {
"listChanged": false
} |
| prompts | {
"listChanged": false
} |
| resources | {
"subscribe": false,
"listChanged": false
} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| list_schemasB | List user schemas with table and view counts. |
| list_tablesA | List tables and views in a schema with estimated row counts and sizes. |
| describe_tableB | Columns, constraints, indexes and incoming foreign keys of a table. |
| sample_rowsB | Return the first rows of a table to see what the data looks like. |
| run_queryA | Run a single read-only SQL statement inside a read-only transaction. Results are capped and marked as truncated when more rows exist. |
| explain_queryA | Show the PostgreSQL execution plan for a read-only query without running it. |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
| analyse | Guide an analysis of a business question against the database. |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
| schema-overview | Every visible table with its columns, as plain text. |
TDQS
Scored across 6 tools
Each tool maps to a distinct exploration step (schemas, tables, table detail, plan, sample, ad-hoc query), so selection is generally obvious. Mild overlap exists: sample_rows and simple exploration could be done via run_query, but the descriptions make the intended specialization clear.
All six names follow a consistent snake_case verb_noun pattern (list_schemas, list_tables, describe_table, explain_query, sample_rows, run_query). No mixed conventions or vague one-word names.
Six tools is well-scoped for a read-only PostgreSQL inspection server, and each tool earns its place in the exploration workflow. No bloat or awkwardly thin surface.
The surface covers the core read-only workflow: enumerate schemas and tables, describe structure, inspect plans, sample data, and run arbitrary SELECTs. Minor gaps like searching for tables/columns by name or listing indexes/extensions across the database are workarounds via run_query rather than dead ends.