Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+22 more

    postgres mcp hardened

    1

    A Rust-based MCP server providing secure, read-only PostgreSQL access with statement validation and data redaction.

    $7

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    postgres mcp hardened

    postgres mcp hardened

    Example session with this skill installed

    Connect my Claude Desktop to a local Postgres database named 'analytics' using the hardened MCP server. I want to make sure it can't see the 'users' table.

    • Read your context and instructions
    • Compiled the postgres mcp hardened

    I have configured the connection string and restricted access to ensure the 'users' table remains hidden from the agent. The following configuration uses the stdio transport for Claude Desktop and implements an allowlist that excludes the sensitive table.

    Hardened Postgres MCP Configuration

    {
      "mcpServers": {
        "postgres-hardened": {
          "command": "npx",
          "args": [
            "-y",
            "postgres-mcp-hardened",
            "--stdio"
          ],
          "env": {
            "DATABASE_URL": "postgres://mcp_reader:YOUR_SAFE_PASSWORD@localhost:5432/analytics",
            "MCP_ALLOW_TABLES": "public.orders,public.products,public.inventory",
            "MCP_REDACT_COLUMNS": "email,password,ssn",
            "MCP_STATEMENT_TIMEOUT": "30s"
          }
        }
      }
    }
    

    Next steps

    1. Run the postgres-mcp-hardened --print-setup-sql --role mcp_reader command to generate the necessary read-only role permissions for your database.
    2. Add the JSON block above to your claude_desktop_config.json file.
    3. Restart Claude Desktop and run the security_posture tool to verify the allowlist is active.

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

    About this skill

    You need to give an AI agent access to your PostgreSQL database, but letting an LLM run arbitrary SQL is a massive security risk. This skill provides a hardened Model Context Protocol (MCP) server that enforces read-only access at the server level, preventing agents from executing destructive commands even if they attempt to bypass database-level restrictions.

    What it does

    • Enforced Read-Only Queries: Runs a validator that rejects non-read-only statements like DROP, DELETE, or UPDATE before they reach the database.
    • Schema Discovery: Provides tools for agents to explore schemas, tables, and column structures safely without guessing names.
    • Data Redaction: Intercepts and masks sensitive columns like passwords or SSNs at the server level.
    • Performance Auditing: Exposes query execution plans, index analysis, and health metrics to help agents diagnose slow performance.
    • Access Control: Implements allowlists for specific schemas and tables to limit the agent's blast radius.

    How it works

    1. Setup Role: Generate a dedicated read-only PostgreSQL role using the --print-setup-sql flag to ensure minimum required privileges.
    2. Configure Transport: Choose between stdio for local use in Claude Desktop/Cursor or HTTP for remote agent access.
    3. Environment Lockdown: Define DATABASE_URL, MCP_ALLOW_SCHEMAS, and MCP_REDACT_COLUMNS to set the operational boundaries.
    4. Validation: Test the server against the adversarial corpus using --validate to confirm it rejects unauthorized writes.

    Frameworks & tools

    Built in Rust for a small 7.7 MB idle footprint. Integrates with any MCP-compliant client including Claude Desktop, Cursor, and Claude Code. Supports PostgreSQL, Supabase, Neon, and AWS RDS.

    Why this beats prompting it yourself

    Standard agents can be tricked into running destructive SQL through prompt injection or accidental hallucinations. This skill moves the security logic into a compiled Rust binary that validates every statement against a fuzzed parser, making it impossible for an agent to "argue" its way into a write operation.

    Use cases

    • Granting Claude or Cursor access to production schemas for safe data analysis and reporting.
    • Allowing an agent to diagnose database performance issues by inspecting execution plans and slow queries.
    • Providing a secure interface for AI-driven technical support bots to look up customer records without risking data integrity.
    • Auditing existing database deployments for security posture and unused indexes.

    Known limitations

    Refuses all write operations by design, even for migrations or seeding. Large query planners can increase memory usage, so setting a container memory limit is recommended.

    How to use

    Skills on Agensi run inside your AI agent. Copy the prompt, paste it into your agent, and it connects to Agensi and installs this skill for you. If a payment is needed, your agent shows it to you first.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill passes our trust checks below.

    Security scanned

    Passed our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scanned

    Verified clean 2 days ago

    • Passed all security checks, Safe to install

    Requires

    Postgres Hardened MCP
    Node.js
    ENOENT

    Listed2 days ago

    What's inside

    Frequently Asked Questions