All posts

Production access control for MCP servers on Postgres

How can you enforce production access control for MCP servers that run on Postgres without exposing credentials or losing visibility? In many organizations the first version of a production pipeline simply gives engineers a shared database user and a static password. The same credential is baked into CI jobs, scripts, and sometimes even into the application code. Anyone who knows the password can connect directly to the database, run arbitrary SELECT, UPDATE, or DELETE statements, and see every

Free White Paper

Customer Support Access to Production + Single Sign-On (SSO): The Complete Guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free. No spam. Unsubscribe anytime.

How can you enforce production access control for MCP servers that run on Postgres without exposing credentials or losing visibility?

In many organizations the first version of a production pipeline simply gives engineers a shared database user and a static password. The same credential is baked into CI jobs, scripts, and sometimes even into the application code. Anyone who knows the password can connect directly to the database, run arbitrary SELECT, UPDATE, or DELETE statements, and see every column – including personally identifying information. The connection bypasses any approval workflow, leaves no immutable record of what was run, and provides no way to hide sensitive fields from downstream consumers. When a breach occurs, the audit trail is either missing or incomplete, making root‑cause analysis a guesswork exercise.

Teams recognize that this model violates the principle of least privilege, so they start moving toward non‑human identities, token‑based authentication, and role‑based access controls. They may configure per‑service IAM roles or generate short‑lived database tokens for each CI job. These steps stop the use of a single static password, but the request still travels straight to the Postgres server. The gateway that sits between the client and the database is missing, so there is still no inline data masking, no command‑level approval, and no guaranteed session recording. In other words, the foundation for production access control is still incomplete.

Production access control with hoop.dev on Postgres

hoop.dev provides the missing data‑path component. It runs as a Layer 7 gateway that terminates the PostgreSQL wire protocol before the request reaches the database. The gateway authenticates the caller against an OIDC or SAML provider, extracts group membership, and then maps that identity to a just‑in‑time scope that describes which schemas, tables, or rows the caller may touch. The actual database credentials live inside the gateway; callers never see them.

Because hoop.dev sits in the data path, it can enforce every enforcement outcome required for production access control. It records each SQL statement at the command level, creating an immutable audit log that ties every query to a specific user and time stamp. It applies inline data masking on columns that contain PII, ensuring that even a privileged user only receives redacted values unless an explicit exemption is granted. When a statement matches a risky pattern – for example, a DROP DATABASE or a mass UPDATE without a WHERE clause – hoop.dev can block the command outright or route it to a human approver before execution. All of these actions happen because hoop.dev is the active gatekeeper on the connection.

Continue reading? Get the full guide.

Customer Support Access to Production + Single Sign-On (SSO): Architecture Patterns & Best Practices

Free. No spam. Unsubscribe anytime.

Key enforcement outcomes

  • Command‑level audit: hoop.dev logs every statement, the identity that issued it, and the result, giving auditors a complete view of production activity.
  • Inline masking: Sensitive columns are redacted in real time, protecting downstream services and analysts from accidental exposure.
  • Just‑in‑time approval: High‑risk queries trigger an approval workflow that can be satisfied by a security engineer or a data steward.
  • Session recording: hoop.dev captures the full interaction, allowing replay for forensic analysis or compliance verification.

Implementation steps

The architectural flow is straightforward. First, deploy the hoop.dev gateway in the same network segment as the Postgres instance – the quick‑start uses Docker Compose, but Kubernetes or AWS deployments are also supported. Next, register the Postgres target in the gateway configuration, supplying the host, port, and the service account that hoop.dev will use to authenticate to the database. Then, configure OIDC authentication so that engineers and CI agents can obtain tokens from your identity provider. Finally, define policy rules that map groups to database scopes, specify which columns require masking, and list the commands that need approval.

All of these pieces are described in the official getting‑started guide and the learning portal. The guide walks you through deploying the gateway, creating a Postgres connection, and shaping policies that enforce production access control without changing existing client tools. Because hoop.dev is a transparent proxy, existing psql commands, application connection strings, and CI pipelines continue to work – they simply point at the gateway instead of the raw database endpoint.

FAQ

Do I need to change my application code to use hoop.dev?

No. hoop.dev acts as a wire‑protocol proxy, so you only change the host and port that your client connects to. The rest of the connection string, driver, and authentication flow remain unchanged.

How does hoop.dev protect database credentials?

The gateway stores the credentials internally and injects them only after a successful OIDC token validation. Callers never receive the password or IAM token, eliminating credential sprawl.

Can I audit historical activity before hoop.dev was deployed?

hoop.dev records activity from the moment it is placed in the data path. For prior activity you would need to rely on whatever logging your database already provides.

For a hands‑on walkthrough, start with the getting‑started guide and explore the policy examples on the learning portal. When you’re ready to dive into the source or contribute, visit the open‑source repository on GitHub: https://github.com/hoophq/hoop.

Open source

Save the open-source gateway for agent data access

Hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.

Star and save the repo →More posts