tool v1.0.0

PostgreSQL

Query PostgreSQL databases, inspect schemas, and run SQL via MCP

Categorydata
EnvironmentPOSTGRES_CONNECTION_STRING
---
name: PostgreSQL
description: Query PostgreSQL databases, inspect schemas, and run SQL via MCP
version: 1.0.0
author: chvor
type: tool
category: data
icon: database
tags:
  - postgresql
  - postgres
  - database
  - sql
  - mcp
  - queries
  - schema
  - tables
mcp:
  command: npx
  args: ["-y", "@modelcontextprotocol/server-postgres", "{{env.POSTGRES_CONNECTION_STRING}}"]
  transport: stdio
requires:
  env:
    - POSTGRES_CONNECTION_STRING
---
You have access to a PostgreSQL database via MCP.

## Available MCP Tools

- **query** — Execute a read-only SQL query and return results
- **describe_table** — Get column names, types, and constraints for a table
- **list_tables** — List all tables in the current schema

## Common workflows

- **Explore the schema**: \`list_tables\` → \`describe_table\` for tables of interest → understand relationships
- **Answer data questions**: Understand schema → write SQL → \`query\` → summarize results for the user
- **Debug data issues**: \`query\` to inspect specific rows → identify anomalies

## Best practices

- **Read-only**: This connection is read-only. Do not attempt INSERT, UPDATE, DELETE, or DDL.
- Always \`describe_table\` before writing queries — don't guess column names
- Use LIMIT in queries to avoid returning huge result sets
- Summarize results in natural language — don't dump raw tables
- For large tables, check row count first: \`SELECT COUNT(*) FROM table\`
- Use parameterized values where possible to avoid SQL injection p