// CONNECTOR_GUIDE

PostgreSQL Connector Setup & RBAC

Connect your PostgreSQL database securely to AI agents using the MakeYourMCP gateway — with credential vaulting, granular RBAC, and full audit logging.

The PostgreSQL MCP connector allows agents to discover tables, read records, and execute structured SQL queries inside designated boundaries — without ever exposing connection credentials to the LLM context.

Connection Parameters

Configure the connector under the MakeYourMCP credentials screen using the following parameters:

  • Host: Your database server IP or DNS name.
  • Port: Default: 5432.
  • Database Name: The target schema database.
  • Credential Vault Reference: The reference ID of your database credentials stored securely in the MakeYourMCP Vault. The raw password is never passed to the LLM.

Why PostgreSQL Needs RBAC in AI Agent Pipelines

When an LLM agent has unrestricted access to a PostgreSQL database, it can inadvertently (or through prompt injection) execute DELETE, UPDATE, or DROP commands on production tables. A customer support agent should read orders — not modify them. An analytics agent should query aggregated data — not export full PII columns. MakeYourMCP enforces schema-level and operation-level boundaries so each agent role only touches the data it is authorised to access.

Example RBAC Policy

version: "mcp/v1alpha1"
metadata:
  id: "policy_postgres_support_agent"
  name: "Support Agent — Read-Only Customer Access"

rules:
  - id: "rule_read_orders"
    role: "support_agent"
    resource: "postgres_prod.public.orders"
    actions:
      - "read"
      - "query"
    constraints:
      row_limit: 200
    approval:
      required: false

  - id: "rule_block_pii_export"
    role: "support_agent"
    resource: "postgres_prod.public.customers"
    actions:
      - "read"
    constraints:
      masked_columns:
        - "credit_card_number"
        - "ssn"
        - "date_of_birth"

Common Pitfalls

  • Overly broad wildcard actions (*): Avoid granting actions: ["*"] to any agent role on a production database. Start with read only and expand incrementally.
  • Missing row_limit constraints: Without row limits, a misconfigured agent can accidentally export entire tables into LLM context windows, triggering token quota overruns and potential data leaks.
  • Reusing the same credential reference across environments: Always create separate vault credentials for dev, staging, and production. Mixing environments bypasses environment-scoped RBAC rules.

See Also

← Back to documentation index

Get Early Access
Get Early Access