Postgres Database Assistant

    by moncef

    0

    Securely inspect PostgreSQL schemas, run read-only queries, and analyze execution plans via MCP.

    Free

    Security scanned

    Works with the AI Agents you already use

    Postgres Database Assistant

    Example session with this skill installed

    List the tables in the public schema and show me the columns for the 'users' table.

    • Read your context and instructions
    • Compiled the postgres database assistant

    I have retrieved the list of tables from the public schema and inspected the structure of the users table.

    Database Inspection Results

    Public Schema Tables

    Table NameEstimated RowsType
    users1250table
    orders45000table
    products320table
    audit_logs890000table

    Table Definition: users

    ColumnData TypeNullableDefault
    iduuidNOgen_random_uuid()
    emailtextNONULL
    password_hashtextNONULL
    created_attimestamp with time zoneNOnow()
    is_activebooleanYEStrue

    Constraints & Indexes

    • Primary Key: users_pkey (id)
    • Foreign Keys: None
    • Indexes: idx_users_email (unique, btree), idx_users_created_at (btree)

    Next steps

    1. Run a run_query to fetch specific user data, noting that password_hash will be automatically redacted.
    2. Use describe_table on the orders table to map the relationship between users and their purchases.
    3. Check the execution plan for email lookups using explain_query.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Manually inspecting PostgreSQL schemas and debugging slow queries via CLI or GUI tools slows down the development loop. This skill enables AI agents to interface directly with your database, providing safe, read-only access to discover structures and verify data without manual context-switching.

    What it does

    • Schema discovery lists all tables and views within a specified schema including estimated row counts.
    • Table inspection retrieves detailed column definitions, primary keys, foreign key relationships, and existing indexes.
    • Safe query execution runs bounded SELECT or WITH queries with automatic redaction of sensitive columns like passwords or tokens.
    • Performance analysis generates PostgreSQL EXPLAIN and EXPLAIN ANALYZE plans within rolled-back transactions to diagnose bottlenecks.
    • Result management enforces row limits and payload caps to prevent memory exhaustion and accidental data dumps.

    How it works

    1. Use list_tables to map out the available relations in the public or application-specific schemas.
    2. Invoke describe_table to understand the exact column types and constraints before drafting a query.
    3. Execute run_query with a SQL statement to retrieve data, monitoring the truncated flag for large result sets.
    4. Pass problematic queries to explain_query to view JSON-formatted execution plans and optimizer costs.

    Frameworks & tools

    Built with Go using the Model Context Protocol (MCP) SDK and pgx/v5. It connects to any PostgreSQL instance via stdio transport using standard postgres:// connection strings.

    Why this beats prompting it yourself

    Writing SQL prompts by memory often leads to invalid column names or unoptimized joins. This skill provides the agent with real-time schema metadata, ensuring queries are syntactically correct and security-compliant by stripping mutating keywords and redacting PII automatically.

    Use cases

    • Generating accurate JOIN queries by inspecting foreign key relationships in real-time.
    • Debugging production data issues using read-only, time-bounded queries.
    • Optimizing slow application queries by analyzing EXPLAIN plans without leaving the editor.
    • Scaffolding API models or DTOs based on actual database table definitions.

    Known limitations

    Supports PostgreSQL only. Exclusively provides read-only access, blocking all DDL, DML, and session mutations. Does not support materialized views in discovery tools.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Free to use

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed 7 days ago

    • Free with an Agensi account

    Software
    Db MCP

    Permissions

    Terminal / Shell
    Read Files
    Network Access
    Environment Variables

    Reads DATABASE_URL (and optional DB_QUERY_TIMEOUT, DB_MAX_ROWS, DB_REDACT_COLUMNS, LOG_LEVEL) from environment variables and opens a TCP connection to the target PostgreSQL database via the db-mcp stdio MCP binary. All operations execute inside strict read-only PostgreSQL transactions with automatic rollbacks, SQL lexer validation, and sensitive-column redaction—no files are written or modified.

    Listed7 days ago

    What's inside

    Frequently Asked Questions

    The skill uses the Model Context Protocol (MCP), meaning it is compatible with any AI agent or IDE that supports MCP, such as Claude Desktop or various developer-focused AI tools. It connects via a standard connection string over the stdio transport layer.

    This skill is strictly read-only; it automatically blocks all DDL (Data Definition Language) and DML (Data Manipulation Language) commands, and even performance analysis is performed within rolled-back transactions to ensure no data is changed.

    Unlike manual prompting, this skill gives your agent real-time access to the live schema, including foreign keys and indexes, which prevents the 'hallucination' of column names and ensures queries are optimized for your specific version of Postgres.

    To protect your environment, the skill includes automatic redaction of sensitive columns like passwords or tokens, and it enforces strict row limits and payload caps to prevent memory exhaustion during large data fetches.

    The skill requires a standard PostgreSQL connection string (e.g., postgres://user:pass@host:port/db) and a runtime environment that supports Go-based MCP servers. Detailed setup instructions for configuring your agent's configuration file are included with the purchase.

    New in Data & Databases

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Data & Databases.

    Free