Implementation Guide for Healthcare Security Engineers

    How to Block Free-Text Clinical Note Columns from Postgres MCP Server Results Before They Reach the LLM

    Treat the MCP tool result as the enforcement point. Keep least-privilege roles and safe views as the base layer, add a server-side column allowlist, then enforce a column-level block policy on every result before it is returned to the model. Identify note columns by schema, table, column and classification tag rather than by name alone, deny unclassified columns by default, test the policy against varied query shapes, and record each allow, redact and block decision as evidence.

    Testing that the policy holds across query shapes

    • Wildcard selects on tables and views that include note columns.
    • Aliased columns, where the output name no longer matches the source name.
    • Joins and subqueries that bring a note column in from a secondary table.
    • Views that wrap note columns, including views added after the policy was written.
    • JSON construction, text casts and concatenation that embed note content in another field.
    • Model-generated SQL written to extract notes indirectly, including repeated attempts after a block.

    Where free-text note columns reach LLM context

    A Postgres MCP server typically exposes a tool that accepts a query, runs it over a database connection, serializes the rows, and returns them to the client. The client then places that payload in the model's context. Whatever the connection can read and the query selects can end up in that payload.

    Free-text note columns are the highest-risk content in that path. Clinical result and report content can be unstructured free text with no required standard vocabulary, so a note field can hold names, diagnoses and identifiers in any form. The Security Rule objective, as of November 2026, is to ensure the confidentiality, integrity and availability of all ePHI an entity creates, receives, maintains or transmits. A tool result passed to a model is a transmission of whatever it contains.

    Database permissions and schema design answer a different question from the one that matters here. They control what a connection can read, not what a given tool result exposes to the model. SELECT * queries, joins, views and model-generated SQL can all pull a note column into a result the author of the task never intended. Verify the exact request and response path of the server you run, because implementations differ in where results can be intercepted.

    Comparing the three layers

    The layers are complementary. Each fails in a different way, and only the last operates on what is actually about to enter model context.

    • Database roles and views: Strengths: enforced by Postgres, hard to bypass from the application. Limits: the role must be right for every task, views must be maintained as schemas change, and a role that can read notes will return them to any query that selects them.
    • MCP server-side column allowlists: Strengths: restricts which columns the tool will query or return. Limits: depends on the server's own implementation, must handle aliases, joins and casts, and is configured per server rather than across tools.
    • Runtime policy enforcement on tool results: Strengths: one decision point on the returned payload, whatever query shape produced it, with a recorded outcome. Limits: needs reliable column identity and a defined default, and it should not replace the first two layers.

    Identifying note columns reliably

    Define the policy over column identity: schema, table, column, and a classification tag such as clinical_free_text. Name patterns like note, comment or narrative are useful for discovery, but they should only propose candidates for a person to classify. Column type is not a signal either, since a text column may hold a short code or a full narrative, and the same content may be stored in varchar or jsonb.

    Maintain the classification as a reviewed inventory, tied to schema change. When a column is added or renamed, it should arrive unclassified. Decide up front what that means. For columns carrying PHI risk, the default for unclassified columns should be deny, with an approval path to move them to allow. A default of allow makes the policy only as current as the last review.

    Content inspection can add a second signal, for example flagging a permitted column whose values look like narrative text. Treat it as a detector that raises findings for the inventory, not as the primary control.

    Defining and implementing the block policy

    Write the policy as rules over column identity and outcome, then enforce it at the point where the result is returned. Postgres result metadata can help: the wire protocol reports, for each result field, the source table and column number when the field is a plain column reference. Expressions, casts and concatenations typically lose that origin, which is where the policy needs an explicit rule.

    • Inventory and classify: list every table and view reachable by the MCP connection and tag note columns.
    • Set least privilege: give the MCP role access only to the schemas and safe views the task needs.
    • Define outcomes and precedence: allow, redact and block, with block overriding redact and redact overriding allow.
    • Resolve column origin: map each result field to its source column, and treat unresolved origin on a table containing note columns as block.
    • Choose the failure mode: if the policy decision cannot be made, return nothing to the model rather than the raw result.
    • Version the policy: record who approved each change, and attach the policy version to every decision.

    Producing audit-ready evidence

    Audit controls sit under 164.312(b) within the technical safeguards in 164.312. The purpose of the evidence here is to let a security or compliance team later show what was prevented from reaching the model. Validate the fields below against your organization's own reading of the audit control requirement.

    Each decision record should hold the time, the calling agent or user identity, the MCP server and tool, the outcome, the rule that matched, the policy version, and the identity of the affected columns. Store a normalized query or its hash if full text is itself sensitive. Do not store the blocked content in the evidence, or the audit trail becomes a second copy of the PHI. Set retention and storage location deliberately, and test that records can be retrieved by agent, table or time window.

    Trussed enforces policy in the execution path, including MCP server tool calls, and can allow, redact or block a result at runtime, not review it after the fact. That enforcement generates audit-ready evidence mapped to HIPAA, and Trussed supports self-managed deployment in the customer cloud with configurable retention and data residency. It runs in production with healthcare organizations. The classification inventory and policy rules remain yours to define, whichever tool enforces them.

    Organizations that are actors under the information blocking rules in 45 CFR Part 171 should also have counsel assess whether limiting note access in an LLM workflow implicates those rules, as of November 2026.

    Where the control sits in a Postgres MCP tool call

    1. Model issues a tool call

    The agent sends SQL or query parameters to the MCP server.

    2. Database executes

    Roles and views limit what the connection can read.

    3. MCP server serializes rows

    Result sets are converted into the payload returned to the client.

    4. Policy decision on the result

    Note columns are blocked or redacted; permitted fields pass.

    5. Evidence recorded

    The decision, rule and policy version are retained for review.

    Enforce note-column policy where results reach the model

    See how policy enforcement on MCP tool results and the evidence it produces apply to your Postgres environment.

    See How Evidence Is Produced
    Next step

    How does your AI governance program compare?

    See where your program has gaps in less than 2 minutes.