Skip to main content
Glama
gabriel-herencia

postgres-mcp

postgres-mcp

A fast, self-hostable PostgreSQL MCP server. Explore your database (schemas, tables, columns, constraints, relationships, indexes, triggers, functions/procedures, views, enums, stats) and run guarded read or write queries — with a selectable access mode so the same server can be locked to read-only or opened up for edits.

Built with Python + uv, FastMCP and psycopg3. Runs equally well via uvx or Docker. Works with any PostgreSQL: local, Neon, Supabase, Cloud SQL, RDS, DigitalOcean, …

Naming note: this is an independent project. There is a separate, unrelated PyPI package also called postgres-mcp (Crystal DBA's "Postgres MCP Pro"). If you publish, pick a unique distribution name.


Quick start with Docker

# 1. Build the image
docker build -t postgres-mcp .

# 2. Add it to your MCP client (.mcp.json) — read-only by default:
{
  "mcpServers": {
    "postgres": {
      "command": "docker",
      "args": ["run", "-i", "--rm", "-e", "DATABASE_URI", "-e", "PG_MCP_ACCESS_MODE", "postgres-mcp"],
      "env": {
        "DATABASE_URI": "postgresql://readonly_user:pass@host:5432/db",
        "PG_MCP_ACCESS_MODE": "readonly"
      }
    }
  }
}

The server speaks MCP over stdio, so the container must be run with -i. DATABASE_URI and PG_MCP_ACCESS_MODE are listed both in args (to forward the names into the container) and in env (their values), so secrets stay out of the image.

Try it instantly with a seeded demo database

docker compose --profile demo up -d demo-db   # Postgres on localhost:55432, pre-seeded
docker build -t postgres-mcp .
# Point DATABASE_URI at: postgresql://readonly_user:readonly_pw@host.docker.internal:55432/appdb

Related MCP server: PostgreSQL MCP Server

Run without Docker (uv)

uv sync
DATABASE_URI=postgresql://readonly_user:pass@host:5432/db \
PG_MCP_ACCESS_MODE=readonly \
uv run postgres-mcp

Or straight from a Git repo, no clone needed:

{
  "mcpServers": {
    "postgres": {
      "command": "uvx",
      "args": ["--from", "git+https://github.com/<you>/postgres-mcp", "postgres-mcp"],
      "env": { "DATABASE_URI": "postgresql://readonly_user:pass@host:5432/db" }
    }
  }
}

Access modes

Set with PG_MCP_ACCESS_MODE. Each mode adds tools; higher modes include the lower ones. Choose the least privilege you need.

Mode

Read tools

execute_dml (INSERT/UPDATE/DELETE/MERGE)

execute_ddl (CREATE/ALTER/DROP/…)

DB session

readonly (default)

forced read only

readwrite

normal

admin

normal

The access mode is enforced two ways: write tools are not even registered in lower modes, and in readonly the database session itself rejects writes. For real safety, also connect with a DB role scoped to what you need.


Tools

Read (all modes)

Tool

Purpose

server_info

Current access mode + safety config

list_schemas

User schemas

list_tables

Tables/views/matviews with size & row estimate

describe_table

Columns, types, defaults, identity/generated, PK

list_constraints

PK / unique / FK / check / exclusion

get_relations

Incoming & outgoing foreign keys

list_indexes

Index definitions

list_triggers

Trigger definitions (schema or one table)

list_functions

Functions & procedures (signatures)

get_function_definition

Full source of a function/procedure

list_views

View / materialized-view definitions

list_enums

Enum types and labels

table_stats

Sizes, live/dead rows, vacuum/scan stats

run_select

Guarded read-only query runner

Write (mode-gated)

Tool

Mode

Purpose

execute_dml

readwrite, admin

INSERT / UPDATE / DELETE / MERGE

execute_ddl

admin

CREATE / ALTER / DROP / TRUNCATE / COMMENT / GRANT / REVOKE / REINDEX

How writes stay safe — the dry-run + confirm workflow

Every write tool defaults to confirm=false, which performs a dry run:

  1. Understand the data flow first. The model is instructed to inspect describe_table, get_relations (cascading FKs) and list_triggers before changing anything, so cascade/side-effects are known up front.

  2. Dry run. With confirm=false, the statement runs inside a transaction that is rolled back. Because Postgres has transactional DDL, this both validates the statement and returns the exact affected_rows — without persisting anything.

  3. Review. If affected_rows is larger than expected, fix the WHERE clause and dry-run again. UPDATE/DELETE without a WHERE is refused unless allow_full_table_write=true.

  4. Commit. Re-run with confirm=true to apply the change.

On top of this, your MCP client (Claude Code, etc.) prompts the human to approve each tool call — so a real person is always in the loop before a commit.

Statements that can't run in a transaction (CREATE INDEX CONCURRENTLY, CREATE/DROP DATABASE, VACUUM) can't be dry-run; execute_ddl tells you to re-run with confirm=true, non_transactional=true (no rollback safety).


Configuration

Env var

Default

Meaning

DATABASE_URI

postgresql://user:pass@host:5432/db (also DATABASE_URL)

PG_MCP_ACCESS_MODE

readonly

readonly / readwrite / admin

PG_MCP_STATEMENT_TIMEOUT_MS

15000

Per-statement timeout

PG_MCP_MAX_ROWS

1000

Hard cap on returned rows

PG_MCP_POOL_MAX

4

Max pooled connections

TLS works out of the box (e.g. Neon: append ?sslmode=require to the URI).

Read-only:

CREATE ROLE readonly_user LOGIN PASSWORD 'change_me';
GRANT CONNECT ON DATABASE mydb TO readonly_user;
GRANT USAGE ON SCHEMA public TO readonly_user;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readonly_user;
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readonly_user;
ALTER ROLE readonly_user SET statement_timeout = '15s';

Read-write (add only what you need):

GRANT INSERT, UPDATE, DELETE ON ALL TABLES IN SCHEMA public TO app_user;
GRANT USAGE, SELECT ON ALL SEQUENCES IN SCHEMA public TO app_user;

Add your own tools

Drop a function in src/postgres_mcp/server.py:

@mcp.tool()
def biggest_tables(schema: str = "public", top: int = 10) -> list[dict]:
    """Largest tables in a schema by total size."""
    return db.query(
        """SELECT c.relname AS name,
                  pg_size_pretty(pg_total_relation_size(c.oid)) AS size
           FROM pg_class c JOIN pg_namespace n ON n.oid = c.relnamespace
           WHERE n.nspname = %s AND c.relkind IN ('r','p','m')
           ORDER BY pg_total_relation_size(c.oid) DESC LIMIT %s""",
        (schema, top),
    )

Roadmap

  • ☐ Cloud SQL connectivity guide (Cloud SQL Auth Proxy + gcloud/service account)

  • ☐ Provider notes: DigitalOcean Managed Databases, AWS RDS/Aurora

  • ☐ Optional published images (GHCR) and PyPI release

License

MIT

Available Tools

14 tools
describe_tableB

Full description of a table/view: columns (type, nullable, default, identity/generated, comment) plus its primary key.

ParametersJSON Schema
NameRequiredDescriptionDefault
tableYes
schemaNopublic

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

B3.1/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden. It discloses the return content (columns, primary key) and implies a read operation, but does not mention error behavior, permissions, or potential side effects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

One concise sentence that front-loads the key purpose. No redundant words or filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description covers the main output columns and primary key but omits potential other details (e.g., foreign keys, indexes, constraints). With an output schema present (though not shown), the description is adequate but not exhaustive.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must explain parameters. It does not explicitly state that 'table' is the table name and 'schema' is the schema name (with default 'public'). The meaning is somewhat inferable but not explicit.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it provides a 'full description' of a table/view including columns (with details) and primary key. This is specific and distinguishes from siblings like list_tables (listing names) or get_relations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives like list_tables, list_views, or get_relations. The description does not mention prerequisites, context, or exclusions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_function_definitionA

Full source (CREATE OR REPLACE ...) of a function or procedure. If the name is overloaded, pass arguments (e.g. "integer, text") to disambiguate.

ParametersJSON Schema
NameRequiredDescriptionDefault
nameYes
schemaNopublic
argumentsNo

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A3.7/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must carry the full burden. It only mentions retrieving source code, but does not explicitly state that the operation is read-only (non-destructive), what happens on missing function, or any permission requirements.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two concise sentences with critical information front-loaded. The first sentence states the purpose, the second provides disambiguation guidance. No redundant or unnecessary text.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given that an output schema exists (not shown), the description need not explain return values. It covers the core behavior (full source retrieval and disambiguation). Minor gap: no mention of error conditions or system source (e.g., PostgreSQL).

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It adds meaning for the `arguments` parameter (disambiguation example) but does not elaborate on `name` or `schema` (default 'public') beyond what the schema provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Full source (CREATE OR REPLACE ...) of a function or procedure', specifying the verb (retrieve), resource (function or procedure), and output (full source). This distinguishes it from sibling tools like list_functions which only list names.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides a clear usage guideline for overloaded names: 'If the name is overloaded, pass `arguments` (e.g. "integer, text") to disambiguate.' However, it does not explicitly state when not to use this tool or suggest alternatives.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_relationsA

Foreign-key relationships for a table: outgoing (FKs this table declares) and incoming (other tables referencing this one). Use this to understand the data-flow impact before any write.

ParametersJSON Schema
NameRequiredDescriptionDefault
tableYes
schemaNopublic

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A3.8/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden. It discloses that the tool returns two categories (outgoing and incoming) and implies read-only safety, but doesn't elaborate on side effects, auth needs, or rate limits. Adequate but not comprehensive.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences with no filler. The first sentence states the purpose and output structure, the second gives usage context. Every word is earned, and the information is front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The output schema exists, so return values are covered. However, the description does not explain the schema parameter or note the default, and parameter coverage is 0%. For a two-parameter tool with an output schema, the description is adequate but not fully complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, yet the description adds little beyond the schema: it mentions the table but not the optional schema parameter. The schema itself is simple, but the description fails to elaborate on parameter roles or constraints, leaving a gap for the agent.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool returns foreign-key relationships (outgoing and incoming) for a given table, with a specific verb and resource. It distinguishes itself from siblings like list_constraints or describe_table by focusing specifically on FK data flow.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly advises using this tool to understand data-flow impact before any write, providing clear context. It does not list exclusions or alternatives, but the guidance is sufficient for deciding when to invoke it.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_constraintsB

All constraints on a table (primary key, unique, foreign key, check, exclusion) with their full definitions.

ParametersJSON Schema
NameRequiredDescriptionDefault
tableYes
schemaNopublic

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden. It states the tool returns 'all constraints' and 'their full definitions,' which is accurate but lacks details on permissions, performance implications, or side effects. The mention of constraint types adds some value, but behavioral context is minimal.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence of 16 words. It efficiently conveys the tool's purpose and scope with no wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's simplicity, the description covers the basic purpose but omits usage context and parameter details. The output schema exists, reducing the need to describe return values, but the lack of guidance on when to use the tool and the missing schema parameter explanation make it only partially complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, yet the description does not explain the parameters. It implies the 'table' parameter by saying 'on a table,' but the 'schema' parameter (with a default) is not mentioned. The description adds little beyond parameter names from the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description explicitly states the tool lists all constraints on a table, enumerating the constraint types (primary key, unique, foreign key, check, exclusion) and specifying that full definitions are included. This clearly distinguishes it from sibling tools like list_indexes or list_triggers.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It does not mention prerequisites, context, or when not to use it. For a tool with many siblings, this is a significant gap.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_enumsC

List enum types in a schema with their ordered labels.

ParametersJSON Schema
NameRequiredDescriptionDefault
schemaNopublic

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description should disclose behavioral traits. It only mentions 'ordered labels' but omits whether the operation is read-only, what authentication is needed, or any output format details. Essential behavioral context is missing.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single concise sentence that front-loads the key action and resource. It is efficient with no redundant words, though it could be slightly more structured with a bullet list of parameters.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite having a single parameter and an output schema, the description does not explain what 'ordered labels' means, what the output contains, or how the schema parameter affects results. This leaves the agent underinformed for correct invocation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, yet the description fails to clarify the 'schema' parameter beyond implying its purpose. It does not specify valid formats, constraints, or how to leave it default. Minimal value is added over the schema itself.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'List enum types in a schema with their ordered labels', specifying the verb ('list'), resource ('enum types'), and scope ('in a schema'). It distinctly separates this tool from siblings like list_tables and list_schemas.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives such as list_tables or list_constraints. The description lacks context for selecting this tool over others.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_functionsA

List functions and procedures in a schema (signature, return type, language, kind). Use get_function_definition for the full source.

ParametersJSON Schema
NameRequiredDescriptionDefault
schemaNopublic

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.7/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description bears the full burden. It only lists what it returns without disclosing behavioral traits like authentication needs, performance impact, or whether it's read-only (implied by 'list'). This gap leaves the agent uninformed about side effects or restrictions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence that immediately states the core action and included fields, then succinctly points to a sibling tool. No wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With an output schema present, the description only needs to provide a quick summary, which it does. It adequately distinguishes from sibling tools, though it could add more detail on any limitations or ordering.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The single parameter 'schema' has no description in the input schema (0% coverage). The description mentions 'in a schema' but does not elaborate on the parameter's meaning, format, or constraints beyond the default.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it lists functions and procedures in a schema, specifying the fields (signature, return type, language, kind). It also explicitly mentions an alternative tool (get_function_definition) for full source, distinguishing it from siblings.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It directs the agent to use get_function_definition for full source, providing clear context on when to use an alternative. However, it doesn't explicitly state when not to use this tool or mention prerequisites.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_indexesB

Indexes on a table, with full CREATE INDEX definitions and flags.

ParametersJSON Schema
NameRequiredDescriptionDefault
tableYes
schemaNopublic

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.3/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full burden. It discloses that the tool returns CREATE INDEX definitions and flags, which implies a safe read operation. However, it omits any mention of authentication, rate limits, or error conditions, which is minimal but not misleading.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence, no wasted words, and front-loaded with key information. Could be slightly more structured, but remains concise and efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Output schema exists, so return format is covered. The description adds value by specifying 'full CREATE INDEX definitions and flags'. However, lack of parameter explanation is a gap, making it only moderately complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%; the description does not explain the parameters (table, schema) at all. With low coverage, the description must compensate, but it fails to add any meaning beyond the schema's names and types.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states the tool lists indexes on a table with full CREATE INDEX definitions and flags. It uses a specific verb 'list' and specifies the resource 'indexes on a table', distinguishing it from sibling tools like list_constraints and list_tables.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use this tool versus alternatives. The description implies usage for retrieving index definitions, but lacks when-not-to-use or explicit references to siblings.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_schemasA

List user schemas (excludes pg_catalog / information_schema / temp).

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.3/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description discloses the important behavioral detail that system schemas are excluded, which is critical for proper use. No annotations are present, so the description effectively carries the burden.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence, front-loaded with the core purpose, and contains no extraneous information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with no parameters and an output schema, the description fully covers what the user needs to know: what is listed and what is excluded.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has no parameters, so the baseline is 4. The description correctly implies no parameters are needed.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool lists user schemas and specifies exclusions (pg_catalog, information_schema, temp), making it distinct from sibling list tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is implied by the context of sibling tools (which list other database objects), but there is no explicit guidance on when to use or avoid this tool.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_tablesB

List tables, partitioned tables, views and materialized views in a schema, with comment, estimated row count and on-disk size.

ParametersJSON Schema
NameRequiredDescriptionDefault
schemaNopublic

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It discloses that the operation is a read (list) and mentions the output fields (comment, row count, size), but does not address potential behavior like filtering by schema (defaults to 'public'), performance implications, or permission requirements.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, well-framed sentence of about 20 words. It immediately states the action and the object types, then adds output details. No wasted words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple list tool with one parameter and an output schema, the description covers the basic purpose and return info. However, given the number of siblings, more explicit differentiation or behavioral notes (e.g., 'does not include system schemas') would improve completeness. The output schema likely covers return fields, so that part is adequate.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema parameter has no description in the input schema (0% coverage). The tool description adds context by saying 'in a schema', implying the parameter specifies the namespace, but it does not explain the default value 'public' or what happens if omitted. More detail is needed to fully compensate for the missing schema description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'List' and specifies the exact resource set: tables, partitioned tables, views, and materialized views within a schema. It also mentions the output includes comment, estimated row count, and on-disk size, which distinguishes it from siblings like 'list_views' (only views) or 'describe_table' (single table details).

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use this tool versus its siblings (e.g., 'list_views' for only views, 'describe_table' for detailed schema). The description only states what it does, not when or when not to use it.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_triggersA

List triggers in a schema (optionally filtered to one table), with their full CREATE TRIGGER definitions. Excludes internal/constraint triggers. Important to review before writes: triggers may cascade side effects.

ParametersJSON Schema
NameRequiredDescriptionDefault
schemaNopublic
tableNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A4.1/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Without annotations, the description discloses that internal/constraint triggers are excluded and that triggers may cascade side effects, providing useful behavioral context beyond the schema.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise (two sentences), front-loaded with the main action, and each sentence adds value. No fluff.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the low complexity (2 simple parameters, output schema exists), the description covers the essential: what the tool does, its scope, and an important behavioral note. No gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 0% schema description coverage, the description adds limited meaning: it clarifies the 'schema' parameter as the target schema and 'table' as an optional filter. More detail on parameter constraints or defaults would improve it.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool lists triggers in a schema, optionally filtered by table, and includes full CREATE TRIGGER definitions. It also mentions exclusions, distinguishing it from sibling tools like list_constraints.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description gives a usage hint to review before writes due to possible side effects, but does not specify when to use this tool over alternatives or provide exclusion criteria.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

list_viewsA

List views and materialized views in a schema, with their SQL definitions.

ParametersJSON Schema
NameRequiredDescriptionDefault
schemaNopublic

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.7/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must carry the burden. It indicates that the tool returns SQL definitions, which is a read-only operation. However, it does not disclose potential failure modes (e.g., invalid schema) or any performance considerations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence, concise and front-loaded. Every word is purposeful, no redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple listing tool with an output schema, the description is mostly complete. It specifies the return content (SQL definitions). Given the tool's simplicity, it covers the essential context, though it could mention the schema parameter's role more explicitly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Only one parameter 'schema' with a default. The description does not add meaning beyond the schema's title and default value. Since schema coverage is 0%, the description should compensate but fails to do so. It merely repeats the concept of schema without context.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action (list), the resource (views and materialized views), and the additional detail (with SQL definitions). It distinguishes itself from sibling tools like list_tables or list_functions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies it is used to retrieve views in a schema but does not provide explicit guidance on when to use it over alternatives or mention prerequisites like schema existence. The usage is implied but not elaborated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

run_selectA

Run a single read-only SELECT/WITH/EXPLAIN/SHOW statement and return rows.

This tool rejects non-read and multi-statement SQL and caps returned rows. (In readonly access mode the DB session is also read-only at the engine.)

ParametersJSON Schema
NameRequiredDescriptionDefault
sqlYes
limitNo

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full burden. It discloses that the tool is read-only, rejects non-read and multi-statement SQL, caps returned rows, and notes that the DB session is read-only. This covers core behavioral traits without contradictions.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, no unnecessary words. The main action is front-loaded, and the second sentence adds crucial constraints. Every sentence earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool has 2 parameters, no nested objects, and an output schema (not shown but present). The description covers core behavior, restrictions, and one parameter's semantics. Missing details about error handling or edge cases, but for a simple tool it is reasonably complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so description must compensate. It adds value for the 'sql' parameter by specifying allowed statement types but does not describe the 'limit' parameter explicitly (its role in capping rows is implied). The description partially compensates but leaves the limit parameter under-specified.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool runs a single read-only SELECT/WITH/EXPLAIN/SHOW statement and returns rows. It distinguishes itself from sibling tools, which are all metadata listing tools, by specifying the exact SQL statement types it executes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly lists allowed statement types and mentions restrictions: rejects non-read and multi-statement SQL, caps rows. It provides clear context for when to use this tool (read-only queries) but does not offer explicit exclusions or mention alternative tools beyond what is implied by sibling context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

server_infoA

Report the server's current access mode and safety configuration so you know which write operations (if any) are permitted before attempting them.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.2/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Description states it reports configuration but does not explicitly disclose that it is a read-only, non-destructive operation. Without annotations, the description carries full burden; it is minimally adequate but lacks explicit behavioral traits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence, no wasted words. Front-loaded with purpose and action.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With zero parameters and a simple read operation, the description adequately covers purpose and usage. Output schema handles return details, so description is complete enough for this complexity.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

No parameters (100% schema coverage). Description adds meaning about the output (access mode, safety configuration) and its purpose (knowing permitted write operations).

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states verb 'Report' and resource 'server's current access mode and safety configuration'. It distinguishes from sibling listing tools by focusing on server permissions and safety, which is unique among siblings.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly says to use before write operations to check permissions. Implicit when-to-use is clear. No explicit when-not or alternatives, but no sibling serves the same purpose.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

table_statsA

Size and activity statistics for a table (live/dead rows, sizes, last vacuum/analyze, sequential vs index scans).

ParametersJSON Schema
NameRequiredDescriptionDefault
tableYes
schemaNopublic

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Description discloses types of statistics returned (live/dead rows, sizes, last vacuum/analyze, scans). No mention of it being read-only or side-effect-free, but output schema exists. Good behavioral context beyond what schema provides.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence with examples in parentheses, no wasted words. Front-loaded with 'Size and activity statistics'.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Output schema exists so return values need not be described. Description complements by listing statistics categories. Parameters are simple; no missing context for normal usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0% but parameters are self-explanatory (table, schema). Description does not add parameter details; baseline of 3 is appropriate as schema names carry meaning.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states the tool returns size and activity statistics for a specific table, listing examples. It distinguishes from siblings which are about listing schema objects or running queries.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit guidance on when to use or alternatives, but the purpose is clear enough that an agent can infer usage from the context of database tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 14 tool updatesv0.2.0
    • First observeddescribe_table
    • First observedget_function_definition
    • First observedget_relations
    • First observedlist_constraints
    • First observedlist_enums
    • First observedlist_functions
    • First observedlist_indexes
    • First observedlist_schemas
    • First observedlist_tables
    • First observedlist_triggers
    • First observedlist_views
    • First observedrun_select
    • First observedserver_info
    • First observedtable_stats

TDQS

A3.9/5.0
Disambiguation5/5

Each tool has a unique purpose—describing tables, functions, relationships, constraints, enums, indexes, schemas, tables, triggers, views, executing read-only queries, getting server info, and table statistics. No two tools overlap in functionality.

Naming Consistency5/5

All tools follow a consistent verb_noun pattern in snake_case (e.g., describe_table, list_constraints, run_select). This makes the API predictable and easy for an agent to guess tool names.

Tool Count5/5

14 tools cover the essential operations for PostgreSQL schema introspection (metadata, relationships, statistics, safe queries) without being overwhelming or sparse. The count is well-scoped for the server's purpose.

Completeness5/5

The toolset provides comprehensive coverage: describing objects, listing all schema elements, constraints, indexes, triggers, functions, enums, relationships, table statistics, and a safe read-only query runner. No obvious gaps for typical database exploration tasks.

Maintenance

ActivityStale
ResponsivenessNo issues

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    B
    quality
    D
    maintenance
    A lightweight Postgres MCP server for safe database exploration and query analysis, read-only by default, with multi-database support.
    4
    4
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    An open-source MCP server for PostgreSQL schema introspection and guarded read-only queries. It enables MCP clients to discover schemas, tables, columns, indexes, relationships, and safe queryable data from a configured PostgreSQL database.
    13
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    A read-only MCP server for PostgreSQL that enables safe database introspection and querying via natural language.
    751
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    A Python MCP 2.0 server for self-hosted PostgreSQL instances, providing schema/relation discovery, SQL query and controlled transactional execution tools with security features like read-only transactions, role hardening guidance, and optional human approval for write commands.
    MIT

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/gabriel-herencia/postgres-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server