Skip to main content
Glama
Mhdd-24

PgAdmin-MCP

by Mhdd-24

@mhdd_24/pgadmin-mcp

MCP server for PostgreSQL / pgAdmin-style exploration and SQL from Cursor (or any MCP client). Follows the same architecture as flyway-mcp.

Say "pg status", "list postgres tables", or "run this SQL on Dev" in chat — the assistant calls the matching tools.

Full documentation: docs/WIKI.md


Tools

Tool

Role

pg_set_profile

Sticky session switch: dev | qa | default

pg_status

Sticky + active profile, host, SELECT 1

pg_list_databases

List databases on active (or one-shot) profile server

pg_list_schemas

List user schemas

pg_list_tables

List tables/views in a schema

pg_describe_table

Column metadata

pg_query

Run SQL (read-only by default)

Profiles (no connection details in chat)

  1. Put both Dev and QA credentials in mcp.json (PG_DEV_*, PG_QA_*).

  2. Say pgprofile=qa or pgprofile=dev — the assistant calls pg_set_profile.

  3. Later tools reuse that sticky profile until you switch or the MCP process restarts.

  4. Optional one-shot: pass profile: "qa" on a single tool without changing sticky.

  5. database still means the logical DB name on that server (e.g. transboard), not the env profile.


Related MCP server: Cloudflare Remote PostgreSQL MCP Server

Safety

  • Read-only by default — only SELECT / WITH…SELECT / EXPLAIN / SHOW / VALUES

  • Set PG_ALLOW_WRITE=true to allow writes (still subject to DB user privileges)

  • PG_MAX_ROWS caps returned rows; PG_QUERY_TIMEOUT_MS sets statement timeout


Install / run

cd C:/workspace/pgadmin-mcp
npm install
npm run build
node dist/index.js

Cursor mcp.json

"pgadmin": {
  "command": "node",
  "args": ["C:/workspace/pgadmin-mcp/dist/index.js"],
  "env": {
    "PG_PROFILE": "dev",
    "PG_DEV_HOST": "192.168.1.141",
    "PG_DEV_PORT": "5432",
    "PG_DEV_USER": "postgres",
    "PG_DEV_PASSWORD": "YOUR_PASSWORD",
    "PG_DEV_DATABASE": "postgres",
    "PG_ALLOW_WRITE": "false",
    "PG_MAX_ROWS": "500"
  }
}

Or use discrete PGHOST / PGUSER / PGPASSWORD / PGDATABASE, or a single DATABASE_URL.

Restart Cursor after saving.


Example prompts

  • pgprofile=qa

  • pgprofile=dev

  • pg status

  • list databases

  • list tables in schema transc for database transboard

  • describe table translations schema transc database transboard

  • run: SELECT version();

Available Tools

7 tools
pg_describe_tableA

Describe columns for a table or view. Optional schema, database, and/or profile override.

ParametersJSON Schema
NameRequiredDescriptionDefault
tableYesTable or view name
schemaNoSchema name (default: public)
profileNoConnection profile: "dev" | "qa" | "default". Uses credentials from mcp.json (PG_DEV_* / PG_QA_*). Omit to use the sticky session profile from pg_set_profile / PG_PROFILE.
databaseNoOptional database name override

TDQS

A3.5/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 behavioral burden. It discloses that the tool is an introspection operation and that views are supported, but it does not mention output shape, errors, or side-effect profile. Adequate but 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?

Two short sentences front-load the core action and then summarize the optional overrides. There is no filler, no repetition of the schema, and every part of the description 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?

Invocation details are well covered by the schema and description, and the result is implied as column descriptions. However, without an output schema, the return format is unspecified, and there is no guidance on profile defaulting or when to use pg_query instead.

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 baseline is 3. The description's mention of table/view and optional overrides aligns with the schema but adds no additional meaning or guidance beyond what the schema already provides.

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?

States a specific action, 'Describe columns', with a clear target, 'a table or view'. This differentiates it from the sibling list/database tools even though no sibling is named explicitly. The scope is unambiguous and not a tautology.

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 usage by mentioning optional schema, database, and profile overrides, but it does not explicitly say when to prefer this tool over pg_query or pg_list_tables. No alternatives, exclusions, or conditions are stated.

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

pg_list_databasesA

List databases on the active profile server (or optional one-shot profile=dev|qa).

ParametersJSON Schema
NameRequiredDescriptionDefault
profileNoConnection profile: "dev" | "qa" | "default". Uses credentials from mcp.json (PG_DEV_* / PG_QA_*). Omit to use the sticky session profile from pg_set_profile / PG_PROFILE.

TDQS

A4/5.0
Behavior3/5

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

With no annotations, the description carries the behavioral burden. It discloses the active-profile vs one-shot behavior and the optional override, which is helpful. However, it does not describe side effects, error handling, or what happens when no active profile is set; for a list operation this is a moderate gap 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.

Conciseness5/5

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

The description is a single, front-loaded sentence that starts with the verb and packs the key scoping detail (active profile vs one-shot) efficiently. There is no filler or redundant 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?

For a simple list tool with one optional parameter and no output schema, the description covers the main usage context: which server and how to select a profile. It does not describe the return format or behavior with no profile set, but these are minor given the low complexity and the absence of an output schema.

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 the parameter description in the schema already explains profile values and the sticky session behavior. The tool description restates the idea of a 'one-shot' override and 'active profile server', adding slight contextual nuance but not significant new meaning beyond 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 states a precise verb ('List') and resource ('databases'), scoped to 'the active profile server', with an optional profile override. This is clearly distinct from sibling tools pg_list_schemas and pg_list_tables, so an agent can differentiate without opening schemas.

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 gives clear context: it operates on the active profile unless a one-shot profile is supplied. While it does not explicitly mention alternatives or exclusions, the sibling names and the 'databases' resource make when-to-use unambiguous. The profile override guidance is useful for choosing behavior.

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

pg_list_schemasA

List non-system schemas. Optional database and/or profile (dev|qa) override.

ParametersJSON Schema
NameRequiredDescriptionDefault
profileNoConnection profile: "dev" | "qa" | "default". Uses credentials from mcp.json (PG_DEV_* / PG_QA_*). Omit to use the sticky session profile from pg_set_profile / PG_PROFILE.
databaseNoOptional database name override

TDQS

A3.5/5.0
Behavior2/5

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

No annotations are provided, and the description only states what the tool does (list non-system schemas) without disclosing behavioral traits such as read-only nature, permissions required, connection behavior, or return format. For a tool without annotation support, this 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.

Conciseness5/5

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

A single concise sentence that front-loads the core purpose and follows with the optional overrides. Every word earns its place with no redundancy.

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 tool is simple with two optional parameters, but the lack of behavioral details and usage guidance leaves some context missing. No output schema exists, so a bit more explanation about return values or side effects would improve completeness, though the essential function is clear.

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 (profile, database) already described in the schema. The description adds no new parameter-specific meaning beyond restating the override behavior, so the baseline 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 states a specific verb ('List') and resource ('non-system schemas'), clearly distinguishing it from system schemas and sibling tools like pg_list_databases or pg_list_tables. The scope is precise and unambiguous.

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 mentions optional overrides for database and profile, implying how to customize the listing, but it does not explicitly specify when to use this tool versus alternatives or any exclusion conditions. Usage context is implied rather than stated.

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

pg_list_tablesA

List tables/views for a schema (default public). Optional database and/or profile override.

ParametersJSON Schema
NameRequiredDescriptionDefault
schemaNoSchema name (default: public)
profileNoConnection profile: "dev" | "qa" | "default". Uses credentials from mcp.json (PG_DEV_* / PG_QA_*). Omit to use the sticky session profile from pg_set_profile / PG_PROFILE.
databaseNoOptional database name override

TDQS

A4/5.0
Behavior3/5

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

With no annotations available, the description carries the behavioral disclosure burden. It accurately conveys a read-only listing operation and the default-public-schema behavior, but it does not state the output shape, whether system schemas are included, or any ordering/filtering behavior. 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.

Conciseness5/5

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

The description is a single highly informative sentence. It front-loads the core action and resource, then tucks default and override behavior into the second clause without any filler or repetition.

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, low-risk listing tool with fully documented optional parameters, the description covers everything necessary for correct invocation. No output schema exists, but the return value (table/view names) is self-evident from the tool name and description. It is complete enough, though it could theoretically mention whether views are included (it does) and if filters are supported (they aren't).

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 all three parameters already described in the input schema. The description adds marginal value by emphasizing the public default and the optional nature of database/profile overrides, but the schema alone mostly suffices. This meets the baseline without going beyond 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 opens with the specific verb 'List' and a concrete resource, 'tables/views for a schema', immediately distinguishing this from siblings like pg_list_databases and pg_list_schemas. The default schema and overrides are stated clearly, leaving no ambiguity about the tool's role.

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 makes the use case clear: call this when you need to enumerate tables/views in a schema, with optional database/profile overrides. It does not explicitly discuss when not to use it or route to alternatives, so it stops short of a 5, but the context is unambiguous.

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

pg_queryA

Run SQL against the sticky session profile (or optional profile=dev|qa for one call). Read-only by default. Optional database name and maxRows. Do not ask the user for connection host/password — use profiles.

ParametersJSON Schema
NameRequiredDescriptionDefault
sqlYesSQL statement to execute
maxRowsNoMax rows to return (default from PG_MAX_ROWS)
profileNoConnection profile: "dev" | "qa" | "default". Uses credentials from mcp.json (PG_DEV_* / PG_QA_*). Omit to use the sticky session profile from pg_set_profile / PG_PROFILE.
databaseNoOptional database name override

TDQS

A4.2/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 read-only default, which is useful, but the phrase 'by default' is ambiguous – it implies a possible write mode that no parameter or note explains. Also lacks details on transaction behavior, error handling, or result format, leaving gaps for a data-access tool.

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?

Three short sentences, front-loaded with the core purpose, and every sentence earns its place. No fluff or repetition of schema details.

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?

Complete for a query tool: parameters are documented, the key behavioral trait (read-only) is noted, and the agent knows not to ask for credentials. Missing return format and error semantics are minor for an ad-hoc query tool, and no output schema exists to fill that gap.

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 covers all parameters at 100%, so baseline is 3. The description adds the sticky-session concept, clarifying how the profile parameter behaves beyond the schema's enumeration. This extra context about profile selection and the default behavior is genuine added value.

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?

States a specific action (Run SQL) against a defined resource (sticky session profile) with optional overrides. Clearly distinguishes from sibling tools that manage profiles, list metadata, or describe tables – this is the only tool for arbitrary SQL execution.

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?

Provides clear context on using the sticky session profile versus a one-off dev/qa profile, and explicitly instructs the agent not to ask for connection credentials. Does not name sibling tools or state when not to use it, but the profile guidance is actionable and sufficient.

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

pg_set_profileA

Set the sticky session connection profile to "dev" or "qa" (or "default"). Call when the user says pgprofile=dev, pgprofile=qa, use Dev DB, switch to QA, etc. Later tools reuse this profile automatically — no host/password in chat. Credentials are loaded from PG_DEV_* / PG_QA_* in mcp.json.

ParametersJSON Schema
NameRequiredDescriptionDefault
verifyNoIf true (default), run SELECT 1 against the new profile
profileYesTarget profile: "dev" | "qa" | "default" (aliases: development, uat)

TDQS

A5/5.0
Behavior5/5

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

The description discloses key behavioral aspects: it sets a sticky session profile, loads credentials from environment variables (PG_DEV_*, PG_QA_*), and indicates that later tools reuse the profile automatically. This transparency is sufficient given no annotations are provided.

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 and well-structured. It flows logically from the core action to trigger phrases, then explains the persistence and credential source, all in a few sentences without unnecessary verbosity.

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?

The description covers the tool's purpose, when to use it, how it affects subsequent tools, and the source of credentials. It provides enough context for an agent to understand the tool's role and side effects, even without an output schema.

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

Parameters5/5

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

The input schema descriptions for both parameters are thorough: the 'profile' parameter lists allowed values and aliases (development, uat), and the 'verify' parameter explains its effect (runs SELECT 1). With 100% schema coverage, each parameter's meaning is clear.

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's action: setting the sticky session connection profile to dev, qa, or default. It also provides concrete trigger phrases (pgprofile=dev, use Dev DB, etc.) that make the purpose unmistakable, even without referencing 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 Guidelines5/5

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

The description explicitly says when to call the tool ('Call when the user says pgprofile=dev, pgprofile=qa, use Dev DB, switch to QA, etc.') and explains that later tools reuse this profile automatically, establishing it as a prerequisite for subsequent operations. This gives clear context for 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.

pg_statusA

Show current sticky PostgreSQL profile, host, database, write mode, and a live SELECT 1 health check. Optional profile arg for a one-shot check without changing the sticky session.

ParametersJSON Schema
NameRequiredDescriptionDefault
profileNoConnection profile: "dev" | "qa" | "default". Uses credentials from mcp.json (PG_DEV_* / PG_QA_*). Omit to use the sticky session profile from pg_set_profile / PG_PROFILE.
databaseNoOptional database override for the health check

TDQS

A4.5/5.0
Behavior4/5

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

No annotations are provided, so the description carries the behavioral burden. It discloses that the tool performs a live SELECT 1 health check and that using the profile arg does not change the sticky session. This gives important non-obvious behavior even without an annotation layer.

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 deliver the tool's core action, the state elements, and the key exception about optional profile behavior. No filler, well-front-loaded.

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 status tool with two optional parameters fully documented in the schema, the description fully captures what the tool does and the nuance of the optional profile. No output schema exists, but the listed return fields (profile, host, database, write mode, health) give the agent a complete picture of the response.

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 description coverage is 100%, so the schema fully documents both parameters. The description additionally clarifies the sticky-session behavior of the profile parameter, adding context beyond the schema's technical format.

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 uses the specific verb 'Show' and lists the exact state being displayed (profile, host, database, write mode, SELECT 1 health check). It clearly distinguishes this from sibling tools like pg_set_profile, which changes the profile, and pg_query, which runs queries.

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 explains the optional profile argument for a one-shot check without altering the sticky session, which implies when to use it. It doesn't explicitly state when not to use it or name alternatives, but the context is clear enough for typical status-check usage.

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

TDQS

A4.2/5.0
Disambiguation5/5

Each tool maps to a distinct operation: profile management, status, list databases/schemas/tables, describe table, and execute queries. No overlapping purposes.

Naming Consistency5/5

All tools follow the pg_ prefix with clear verb-ish suffixes (list_*, describe_*, set_*, query). Consistent and predictable pattern.

Tool Count5/5

7 tools is well-scoped for a PostgreSQL browsing and querying server. No redundancy and each tool serves a clear need.

Completeness4/5

Covers profile switching, metadata exploration, and querying. Missing write operations or schema modification, but core read and navigate workflows are complete.

Maintenance

ActivityMaintained
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

  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables natural language querying of PostgreSQL databases through the Model Context Protocol. It translates user questions into validated SQL, executes read-only queries safely, and returns results to MCP-compatible clients like Claude Desktop.
  • 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
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables querying and interacting with PostgreSQL databases using natural language through MCP. Supports configuration via environment variables and Cursor IDE integration.

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/Mhdd-24/PgAdmin-MCP'

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