@mhdd_24/pgadmin-mcp
v1.0.1
Published
MCP server for PostgreSQL / pgAdmin-style queries: list schemas/tables, describe columns, and run SQL (read-only by default)
Maintainers
Readme
@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)
- Put both Dev and QA credentials in
mcp.json(PG_DEV_*,PG_QA_*). - Say
pgprofile=qaorpgprofile=dev— the assistant callspg_set_profile. - Later tools reuse that sticky profile until you switch or the MCP process restarts.
- Optional one-shot: pass
profile: "qa"on a single tool without changing sticky. databasestill means the logical DB name on that server (e.g.transboard), not the env profile.
Safety
- Read-only by default — only
SELECT/WITH…SELECT/EXPLAIN/SHOW/VALUES - Set
PG_ALLOW_WRITE=trueto allow writes (still subject to DB user privileges) PG_MAX_ROWScaps returned rows;PG_QUERY_TIMEOUT_MSsets statement timeout
Install / run
cd C:/workspace/pgadmin-mcp
npm install
npm run build
node dist/index.jsCursor 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();
