Skip to main content
Glama
sparta2025

Postgres MCP Pro

by sparta2025

manage_encryption_key

Manage Fernet encryption keys for stored PostgreSQL secrets: check status, generate or rotate certificates, rekey connection files, and revoke compromised keys.

Instructions

Manage the Data Encryption Certificate (Fernet key) for stored secrets.

Args:
    action: One of:
        - "status"   (default) — list all certs with metadata, no changes.
        - "generate" — create a new cert, set as active. ttl_days applies.
        - "rotate"   — create a new cert (version+1), set as active,
                       previous one becomes ROTATING (decrypt still works
                       in grace period).
        - "rekey"    — re-encrypt connections.json and llm_connections.json
                       with the new active cert (run after rotation).
        - "revoke"   — mark cert by `kid` as REVOKED (compromised).
                       Decrypt NO longer works for it.
        - "validate" — same as status, but also tries to decrypt a known
                       secret (currently no-op placeholder, returns status).
    ttl_days: Certificate lifetime for generate/rotate (default 90).
    subject: Subject CN for new certs (default "postgres-mcp secrets").
    use_passphrase: If true, new cert will be passphrase-protected
        (raw key encrypted with PBKDF2(passphrase)). Passphrase is read
        from env CERT_PASSPHRASE.
    kid: For action="revoke" — which certificate to revoke.
    reason: Free-text reason recorded in audit log and cert notes.

Returns:
    JSON with details of the operation. For "status" — list of certs.
    For generate/rotate — new cert metadata. For revoke — boolean.
    For rekey — statistics {scanned, rekeyed, skipped, errors}.

Examples:
    # See current state
    action="status"
    # Create a new cert (auto-active)
    action="generate" ttl_days=90
    # Rotate (new active, old → ROTATING for grace period)
    action="rotate"
    # Re-encrypt connections files with new cert
    action="rekey"
    # Revoke a compromised cert
    action="revoke" kid="dec-abc123..." reason="leaked on GitHub"

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
kidNo
actionNostatus
reasonNomanual
subjectNopostgres-mcp secrets
ttl_daysNo
use_passphraseNo

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. First observedv0.4.2

TDQS

A4.8/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description fully carries the behavioral disclosure burden and does so exceptionally well. It explicitly states which actions make no changes (status), which transition certs to ROTATING with a grace period, which permanently break decryption (revoke), and even flags validate as a currently no-op placeholder. It also discloses the passphrase environment variable dependency and audit-log behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is long but every sentence earns its place: an overview, an action-by-action breakdown, parameter definitions, return-value summary, and concrete examples. The organizational structure with Args, Returns, and Examples makes complex multi-action behavior easy to scan and understand.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a complex tool with six actions, six parameters, no output schema, and no annotations, the description covers all necessary context: action semantics, ordering requirements, return shapes, environment variable usage, and examples. An agent can select the correct action and invoke it with appropriate parameters without needing additional documentation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate for the six parameters, and it does. Every parameter (action, ttl_days, subject, use_passphrase, kid, reason) is explained with meaning, defaults, and context, including which actions each parameter applies to.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool manages Data Encryption Certificates (Fernet keys) for stored secrets and enumerates six distinct actions (status, generate, rotate, rekey, revoke, validate), each with a specific verb and effect. This makes it unambiguous and easily distinguishable from the sibling database inspection tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides strong usage guidance for each action, including the intended workflow order (e.g., 'run after rotation' for rekey, and revoke for compromised certificates). It does not explicitly name alternative tools to use instead, but this tool is a unique encryption-management utility among the siblings, so the action-level guidance serves as sufficient usage direction.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/sparta2025/postgres-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server