Skip to main content
Glama
Zlash65

PostgreSQL SSH MCP Server

by Zlash65

PostgreSQL SSH MCP Server

npm version npm downloads license

A secure PostgreSQL MCP server with built-in SSH tunneling. Connect to databases through bastion hosts automatically — no manual ssh -L required.

Features

  • Dual Transport — STDIO for Claude Desktop, Streamable HTTP for ChatGPT

  • SSH Tunneling — Built-in tunnel with auto-reconnect and TOFU (trust on first use)

  • Read-Only by Default — Safe for production; enable writes explicitly

  • OAuth Support — Auth0 integration for secure ChatGPT connections

  • Connection Pooling — Efficient resource management with configurable limits


Related MCP server: @pilat/mcp-datalink

Architecture

Architecture


Quick Start

Claude Desktop (STDIO)

Add to your Claude Desktop config:

Platform

Config Location

macOS

~/Library/Application Support/Claude/claude_desktop_config.json

Windows

%APPDATA%/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "postgres": {
      "command": "npx",
      "args": ["-y", "@zlash65/postgresql-ssh-mcp"],
      "env": {
        "DATABASE_URI": "postgresql://user:password@localhost:5432/mydb"
      }
    }
  }
}

ChatGPT (Streamable HTTP)

DATABASE_URI="postgresql://user:pass@localhost:5432/mydb" npx @zlash65/postgresql-ssh-mcp-http

Then configure ChatGPT to connect to https://your-subdomain.example.com/mcp.

Note: ChatGPT requires HTTPS. Use a tunnel (ngrok, Cloudflare Tunnel) for local testing.


Available Tools

Query Tools

Tool

Description

execute_query

Execute SQL with parameterized queries. Results capped by MAX_ROWS.

explain_query

Get EXPLAIN plans in text, JSON, YAML, or XML format. Supports ANALYZE.

Schema Tools

Tool

Description

list_schemas

List database schemas. Excludes system schemas by default.

list_tables

List tables with row counts and sizes. Optionally include views.

describe_table

Get columns, constraints, and indexes for a table.

list_databases

List all databases with owner, encoding, and size.

Admin Tools

Tool

Description

get_connection_status

Get pool stats, tunnel state, and connection info.

list_active_connections

Show active connections from pg_stat_activity.

list_long_running_queries

Find queries running longer than a threshold.

get_database_version

Get PostgreSQL server version.

get_database_size

Get database size and largest tables.

get_table_stats

Get vacuum/analyze stats and scan counts for a table.


Environment Variables

Database Connection

Variable

Required

Default

Description

DATABASE_URI

Yes*

Full connection string (e.g., postgresql://user:pass@host:5432/db)

DATABASE_HOST

Yes*

Database hostname

DATABASE_PORT

No

5432

Database port

DATABASE_NAME

Yes*

Database name

DATABASE_USER

Yes*

Database username

DATABASE_PASSWORD

Yes*

Database password

*Either DATABASE_URI or all individual connection variables are required.

SSL Configuration

Variable

Default

Description

DATABASE_SSL

Auto

true or false. Auto-enabled for non-localhost.

DATABASE_SSL_CA

Path to CA certificate bundle

DATABASE_SSL_REJECT_UNAUTHORIZED

true

Set false to allow self-signed certificates

SSH Tunnel

Variable

Required

Default

Description

SSH_ENABLED

No

false

Set true to enable SSH tunneling

SSH_HOST

Yes*

SSH server hostname

SSH_PORT

No

22

SSH server port

SSH_USER

Yes*

SSH username

SSH_PRIVATE_KEY_PATH

Yes**

Path to private key file

SSH_PRIVATE_KEY_PASSPHRASE

No

Passphrase for encrypted keys

SSH_PASSWORD

Yes**

SSH password (alternative to key)

SSH_STRICT_HOST_KEY

No

true

Verify host key against known_hosts

SSH_TRUST_ON_FIRST_USE

No

true

Auto-add unknown hosts (when strict is enabled)

SSH_KNOWN_HOSTS_PATH

No

~/.ssh/known_hosts

Custom known_hosts file

SSH_KEEPALIVE_INTERVAL

No

10000

Keepalive interval in milliseconds

SSH_MAX_RECONNECT_ATTEMPTS

No

5

Max reconnect attempts (-1 for unlimited)

*Required when SSH_ENABLED=true **Either SSH_PRIVATE_KEY_PATH or SSH_PASSWORD is required

Query Behavior

Variable

Default

Description

READ_ONLY

true

Block data modifications. Set false to allow writes.

MAX_ROWS

1000

Maximum rows returned per query

QUERY_TIMEOUT

30000

Query timeout in milliseconds

MAX_CONCURRENT_QUERIES

10

Maximum concurrent queries

POOL_DRAIN_TIMEOUT_MS

5000

Timeout for draining pool during reconnect

HTTP Server (Streamable HTTP only)

Variable

Default

Description

PORT

3000

HTTP server port

MCP_HOST

0.0.0.0

HTTP server bind address

MCP_AUTH_MODE

none

Authentication mode: none or oauth

MCP_STATELESS

true

Stateless mode (each request re-initializes)

MCP_SERVER_POOL_SIZE

4

Server instances for stateless mode

MCP_SESSION_TTL_MINUTES

30

Session TTL for stateful mode

MCP_SESSION_CLEANUP_INTERVAL_MS

300000

Session cleanup interval

MCP_ALLOWED_ORIGINS

Comma-separated allowed CORS origins (* for any)

MCP_ALLOWED_HOSTS

Comma-separated allowed Host headers

OAuth (Auth0)

Variable

Required

Description

AUTH0_DOMAIN

Yes*

Auth0 tenant domain (e.g., tenant.us.auth0.com)

AUTH0_AUDIENCE

Yes*

Auth0 API identifier / audience

MCP_RESOURCE_DOCUMENTATION

No

URL to API documentation (RFC 9728)

*Required when MCP_AUTH_MODE=oauth


Documentation

Guide

Description

STDIO Setup

Claude Desktop and local development

Streamable HTTP

HTTP server setup and configuration

Server Setup

Deploy to production with nginx and SSL

ChatGPT Setup

Complete Auth0 OAuth setup for ChatGPT


Docker

STDIO Server

docker build --target runtime -t postgresql-mcp .
docker run -e DATABASE_URI="postgresql://..." postgresql-mcp

HTTP Server

docker build --target runtime-http -t postgresql-mcp-http .
docker run -p 3000:3000 -e DATABASE_URI="postgresql://..." postgresql-mcp-http

Development

# Install dependencies
npm install

# Build
npm run build

# Run tests
npm test

# Type check
npm run typecheck

# Lint
npm run lint

Available Tools

12 tools
describe_tableA

Describe a table (columns, constraints, indexes).

ParametersJSON Schema
NameRequiredDescriptionDefault
schemaNoSchema name (default: public)public
tableYesTable name to describe

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.5/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 disclose behavior. It states that it describes columns, constraints, and indexes, but does not mention that the operation is read-only, any required permissions, or potential side effects. The lack of behavioral context is a significant gap.

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, efficient sentence that provides necessary information without excess. However, it is minimal and could benefit from slight expansion for clarity.

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 (so return values are covered elsewhere) and the parameters are well-documented in the input schema, the description adequately covers the main aspects of the tool. It mentions columns, constraints, and indexes, which is sufficient for a describe operation.

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 100%, with both parameters already described in the input schema. The description adds no additional meaning beyond what is in the schema, so baseline score of 3 applies.

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 'Describe a table (columns, constraints, indexes)' clearly states the verb 'describe' and the resource 'table', and distinguishes the tool from siblings like list_tables (which only lists names) or execute_query (which runs arbitrary SQL).

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 does not provide explicit guidance on when to use this tool versus alternatives like list_tables or execute_query. Usage is implied by the purpose, but no when-to-use or when-not-to-use context is given.

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

execute_queryB

Execute SQL with optional parameters. Results are capped by MAX_ROWS and include a truncated flag.

ParametersJSON Schema
NameRequiredDescriptionDefault
sqlYesSQL to execute
paramsNoParameters for $1, $2, ...

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.2/5.0
Behavior3/5

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

Adds value by mentioning results are capped by MAX_ROWS and include a truncated flag, but lacks disclosure on write capabilities or authorization needs. Since annotations are absent, description carries full burden but only partially meets it.

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 concise sentences, front-loaded with the primary action, no fluff.

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?

Missing critical context like whether queries are read-only or can modify data, or any prerequisites. Output schema exists but description does not leverage it enough to inform the agent of full behavior.

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 100%, so parameters are well-documented. The description adds only the word 'optional' which does not enhance meaning beyond the schema.

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?

Clearly states 'Execute SQL' which specifies verb and resource. Does not explicitly distinguish from siblings like explain_query or describe_table, but the action is distinct enough.

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 or avoid this tool. Lacks mention of alternatives or context like read-only vs. modification queries.

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

explain_queryB

Return an EXPLAIN plan for a query. ANALYZE executes the query.

ParametersJSON Schema
NameRequiredDescriptionDefault
sqlYesSQL query to explain
analyzeNoRun EXPLAIN ANALYZE (executes the query). Limited in read-only mode.
formatNoOutput format for the execution plantext

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?

Discloses that ANALYZE executes the query, a key behavioral trait. However, lacks details on side effects, authorization needs, or limitations (e.g., read-only mode noted in schema but not description). Without annotations, more context is expected.

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?

Extremely concise at two sentences with front-loaded main purpose. No redundant wording, every word earns its place.

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?

Covers core purpose and a critical side effect. However, missing context on when to use vs siblings, and no mention of format or analyze implications beyond execution. Given an output schema exists, return values are covered, but usage context is incomplete.

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?

Schema coverage is 100% with descriptions for all parameters. The description adds value by explaining the 'analyze' parameter's execution side effect, which is not fully captured in schema. For 'format' and 'sql', it relies on schema, which is adequate.

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 returns an EXPLAIN plan for a query, using specific verb+resource. It distinguishes from sibling tools like execute_query by hinting at planning versus execution, though it does not explicitly differentiate.

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 over alternatives like execute_query or describe_table. No context about prerequisites or typical scenarios is provided.

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

get_connection_statusA

Get connection status, pool stats, and tunnel state.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.6/5.0
Behavior2/5

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

No annotations provided, so description bears full burden. It does not disclose behavioral traits like read-only nature, auth requirements, or side effects. Simply lists outputs without safety context.

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, concise without waste. Front-loaded action verb. Could be slightly more structured but effectively brief.

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 details are covered. Tool is simple with 0 params, but description misses context like cost or prerequisites, especially given no annotations. Adequate but not thorough.

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 exist; schema coverage is 100%. Description adds value by specifying the categories of returned data (status, stats, state), which is informative beyond the empty 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 clearly states the tool retrieves 'connection status, pool stats, and tunnel state' with a specific verb and resource. It distinguishes from siblings like list_active_connections by including pool and tunnel state.

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 siblings. Implied for general status checking, but lacks when-not-to-use or alternative references.

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

get_database_sizeB

Get database size and largest tables.

ParametersJSON Schema
NameRequiredDescriptionDefault
limitNoNumber of largest tables to return (default: 10)

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.4/5.0
Behavior2/5

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

No annotations provided, and description does not disclose any behavioral traits such as side effects, permissions, or performance impact. Only states the action without safety context.

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?

Extremely concise and front-loaded single sentence with no wasted words; every part is informative.

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 the tool has only one optional parameter and an output schema exists, description covers the core behavior well. Could mention result format, but output schema likely handles that.

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 has 100% coverage for the limit parameter; description adds no additional meaning beyond what schema provides, so baseline score of 3 applies.

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 verb 'Get' and resources 'database size and largest tables', distinguishing it from sibling tools like get_database_version or get_table_stats.

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; lacks context about prerequisites or typical use cases.

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

get_database_versionA

Get PostgreSQL server version.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.8/5.0
Behavior3/5

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

No annotations exist, so the description must carry behavioral transparency. The description is minimal and does not disclose traits like permissions needed, response format, or side effects. However, as a simple read-only query with no parameters, the behavior is straightforward, earning a middle score.

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 conveys the tool's purpose. There is no wasted text, and the structure is optimally front-loaded for quick parsing by an AI agent.

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 the tool's simplicity (no parameters) and the presence of an output schema, the description is nearly complete. It could explicitly mention the return type (e.g., 'returns a version string'), but the output schema likely covers that, making the description adequate.

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 tool has zero parameters, so schema coverage is 100%. The description adds no parameter details, which is acceptable. Baseline for no parameters is 4, and no additional information is needed beyond what the schema already conveys.

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 'Get PostgreSQL server version,' which is a specific verb-resource pair. It distinguishes itself from sibling tools that deal with tables, queries, databases, etc., making it easy to select for version retrieval.

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. Context signals indicate sibling tools like get_connection_status or list_databases, but the description does not explain when version retrieval is appropriate (e.g., for compatibility checks).

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

get_table_statsA

Get table statistics (rows, vacuum/analyze, scan counts).

ParametersJSON Schema
NameRequiredDescriptionDefault
schemaNoSchema name (default: public)public
tableYesTable name

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.6/5.0
Behavior2/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 fails to disclose whether the tool is read-only, requires authentication, or has any side effects. The description only lists stat types, missing behavioral context.

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, focused sentence that front-loads the main purpose. Every word earns its place; no unnecessary information.

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 the simple two-parameter tool and presence of an output schema, the description adequately conveys the tool's function. However, it could benefit from mentioning that stats are returned in a structured format or linking to related tools.

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 100% with descriptions for both parameters (schema default and table name required). The description adds general context about returned stats but does not enhance parameter-specific meaning 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 the tool retrieves statistics like rows, vacuum/analyze, and scan counts. It distinguishes from siblings like 'describe_table' and 'list_tables' by focusing on specific statistics rather than schema or table listing.

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 name and description, but there is no explicit guidance on when to use this tool over alternatives like 'describe_table' or 'list_tables'. The context is clear but lacks when-not-to-use criteria.

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

list_active_connectionsB

List active connections from pg_stat_activity.

ParametersJSON Schema
NameRequiredDescriptionDefault
includeIdleNoInclude idle connections in the listing

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.4/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 full responsibility for behavioral disclosure. It only mentions the source view but does not state default behavior (excluding idle connections), performance impact, permissions required, or return format. The schema parameter description hints at idle filtering, but the main description lacks this detail.

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. It is efficient but could benefit from slightly more detail without becoming verbose.

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 (1 parameter, output schema exists), the description provides the essential purpose but lacks usage guidance and behavioral transparency. It is minimally complete but has clear 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?

Schema description coverage is 100% with a clear parameter description for 'includeIdle'. The main description does not add additional meaning beyond the schema, so baseline of 3 is appropriate.

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', the resource 'active connections', and the source 'pg_stat_activity'. It distinguishes itself from sibling tools like 'list_long_running_queries' which focuses on long-running queries, and 'get_connection_status' which is about a specific connection's status.

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 does not explicitly provide guidance on when to use this tool versus alternatives. It implicitly suggests filtering out idle connections by default via the includeIdle parameter, but does not compare with siblings or mention prerequisites or context of use.

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

list_databasesA

List databases with owner, encoding, and size.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

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 carries the full burden. It states a read-only operation ('list'), but lacks details on performance, authorization needs, or pagination behavior. For a simple listing tool with no parameters, this is adequate but not rich.

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 sentence that conveys the key purpose and included fields. It is front-loaded and concise, though could be slightly more structured.

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 the tool has no parameters and an output schema exists, the description sufficiently states what the tool returns. However, it does not clarify scope (e.g., all databases or filtered) or any edge cases.

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 tool has no parameters, and schema description coverage is 100% (trivially). Per guidelines, baseline is 4 for zero parameters. The description adds no further parameter semantics, which is acceptable.

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 uses a specific verb ('list') and resource ('databases'), and specifies the fields returned ('owner, encoding, and size'). This clearly distinguishes it from sibling tools like list_tables or 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 on when to use this tool versus alternatives (e.g., list_tables or list_schemas). The description implies context but does not provide explicit usage boundaries.

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

list_long_running_queriesC

List queries running longer than a threshold.

ParametersJSON Schema
NameRequiredDescriptionDefault
minDurationSecondsNoMinimum duration in seconds (default: 5)

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

C2.6/5.0
Behavior1/5

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

With no annotations, the description must fully disclose behavioral traits, but it only states the basic action. It does not explain what happens when no queries meet the threshold, whether system queries are included, or what the output list contains. This is a critical gap for a query listing tool.

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

Conciseness3/5

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

The description is a single sentence, which is concise but lacks necessary detail. It is front-loaded but too brief to be effective; every sentence should earn its place, and this one barely provides enough information.

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?

Given the presence of an output schema, the description could rely on it for return values, but it still fails to explain the purpose of the tool in the broader context (e.g., performance monitoring). The threshold concept is only implied, and the tool's integration with other database tools is not mentioned.

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 100% with the parameter minDurationSeconds having a clear description and default. The tool description adds no extra meaning beyond the schema, so the baseline of 3 is appropriate.

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 the action ('List queries') and the condition ('running longer than a threshold'), distinguishing it from other list tools like list_tables or list_active_connections. However, it could be more specific about the scope (e.g., 'on the current database') to fully differentiate from potential sibling tools.

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 like list_active_connections or execute_query. There is no mention of context (e.g., monitoring performance, troubleshooting) 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_schemasA

List schemas (excludes system schemas by default).

ParametersJSON Schema
NameRequiredDescriptionDefault
includeSystemNoInclude system schemas (pg_*, information_schema)

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.8/5.0
Behavior3/5

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

Without annotations, the description carries full disclosure burden. It reveals the key behavioral trait of excluding system schemas by default, but omits other potential behaviors such as permission requirements, error handling, or response format. The presence of an output schema partially compensates.

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 with no superfluous information. It efficiently conveys the tool's purpose and key default behavior.

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 one optional parameter and an existing output schema, the description is largely complete. It covers the default filtering behavior, but could optionally mention that the output schema provides schema details.

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 already describes the 'includeSystem' parameter. The description adds value by explaining that system schemas are excluded by default, giving semantic context to the parameter's default and effect.

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 schemas, with the notable default exclusion of system schemas. This distinguishes it from sibling tools like list_tables (lists tables) and describe_table (describes a specific table).

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 explicit guidance on when to use this tool versus alternatives. It merely states its function, leaving the agent to infer appropriate usage from context.

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

list_tablesA

List tables in a schema with estimated row counts and sizes.

ParametersJSON Schema
NameRequiredDescriptionDefault
schemaNoSchema name (default: public)public
includeViewsNoInclude views in the listing

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.6/5.0
Behavior3/5

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

With no annotations, the description carries the burden. It discloses that the tool returns estimated row counts and sizes, indicating a read operation. However, it does not mention any potential side effects or limitations, but for a listing tool this is acceptable.

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 effectively communicates the core functionality. It is front-loaded with the action and resource, though it could benefit from additional context like parameter roles.

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 tool's simplicity (two optional parameters) and the presence of an output schema, the description is complete enough. It informs the agent of the tool's purpose and return content without requiring further elaboration.

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 100%, so the input schema already documents both parameters. The description adds no additional meaning beyond what the schema provides, meeting the baseline for high coverage.

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 tables in a schema, distinguishing it from siblings like describe_table which details a single table. The addition of 'estimated row counts and sizes' further specifies the output, making the purpose unambiguous.

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 like describe_table or get_table_stats. The description lacks any context on use cases or exclusions, leaving the agent to infer from sibling names.

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

TDQS

A3.6/5.0
Disambiguation5/5

Each tool has a clear, distinct purpose covering different aspects of PostgreSQL management: schema description, query execution, planning, connections, database info, stats, and monitoring. No overlaps or ambiguities.

Naming Consistency5/5

All tool names follow a consistent verb_noun pattern with verbs like describe, execute, explain, get, and list. The naming is predictable and uniform.

Tool Count5/5

With 12 tools, the server is well-scoped for its intended domain of PostgreSQL monitoring and management. Each tool earns its place without being excessive or sparse.

Completeness4/5

The tool set covers essential operations for database exploration and performance monitoring, including schema inspection, query execution, explain plans, and active query tracking. Minor gaps exist, such as lack of tools for modifying database objects or managing connections, but these are reasonable given the server's likely read-oriented purpose.

Maintenance

ActivityInactive
ResponsivenessUnresponsive

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
    Not graded
    quality
    Not graded
    maintenance
    A universal database gateway MCP server that enables AI assistants to connect to and query multiple databases (PostgreSQL, MySQL, MariaDB, SQL Server, SQLite) with support for schema exploration, SQL execution, and secure connections via SSH tunnels.
    14
  • A
    license
    Not graded
    quality
    C
    maintenance
    MCP server for PostgreSQL, MySQL, and SQLite that gives AI assistants secure database access via the Model Context Protocol.
    69
    4
    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/Zlash65/postgresql-ssh-mcp'

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