Forcing Aggregate-Only Results from Data MCP Servers Holding Customer Records
No single control makes an MCP server aggregate-only. Constrain tool schemas so row-level fields cannot be requested, restrict the database account to aggregate views with minimum group sizes, and enforce policy on every tool call and response (allow, redact, block). Retain the query and the returned result for each call so you can show that record-level data was not returned.
Evidence to retain for each call
- The caller identity and the tool invoked, with timestamp.
- The parameters submitted and the schema validation result.
- The query issued to the data layer.
- The response returned, or its redacted form, and the response schema check.
- The policy decision (allow, redact, block) and the rule that triggered it.
- The group sizes and suppression applied to the result.
What aggregate-only means for a data MCP server
Aggregate-only output means a tool returns counts, sums, averages or similar statistics over groups of customers. It never returns a row, an identifier, a free-text value, or a group so small that the result points to one person. The requirement applies to what leaves the server, not to what the server can read.
That distinction matters. NIST separates safe data (is there disclosure risk in the data itself?) from safe outputs (are the statistical results non-disclosive?). Aggregate-only enforcement is mainly an output-side control. The underlying store still holds personal data, so access to it must stay tightly scoped.
Two cautions shape the design. First, NIST guidance quotes the observation that aggregated data provides a false sense of security, so an aggregate is not safe merely because it is an aggregate. Second, NIST API protection guidance says controls should cover all of an organization's APIs, including those meant only for internal use. An internal data MCP server should not be exempt because its callers are agents rather than customers.
Where each layer fails on its own
Each layer addresses a different failure. Relying on one leaves a gap that the others are positioned to close.
- Tool and server design: Fixes the shape of requests and responses. Fails when a free-form parameter such as a filter string or raw query field remains, or when a prompt steers the model toward an unintended use of a permissive tool.
- Data layer: Restricted views, predefined aggregates and group-size thresholds limit what can be computed. Fails on small cohorts, dominant values, differencing across repeated queries, and inconsistent design from one server to the next.
- Runtime enforcement: Inspects each call and response in the execution path and produces a record of the decision. It needs a precise policy to enforce and does not make the underlying data safe.
Layer 1: constrain the tool surface
Start by removing the ability to ask for records. Define narrow tools such as a count of customers by region or an average balance by product tier, rather than a general query tool. Validate inputs against a strict schema and reject anything malformed. NIST notes that validating well-formed input minimizes a class of errors and data leaks that arise from inline validation in business logic.
Avoid parameters that accept SQL fragments, field names chosen by the caller, or free-form filter expressions. Where a caller must choose a dimension or measure, use enumerated values from an allow-list, and cap how many dimensions can be combined, since each added dimension shrinks the groups.
Then declare the response shape. A response should contain only numeric aggregate fields and the group labels you permit. NIST says validating that each response conforms to the expected response schema helps prevent a variety of data leaks, abuses or mistakes. A response that does not match the declared aggregate-only shape should be rejected or flagged, not passed to the model.
- Use purpose-specific tools instead of a general query tool.
- Accept enumerated dimensions and measures only.
- Limit the number of grouping dimensions per call.
- Declare a response schema with numeric aggregates and permitted group labels.
- Reject free-form and malformed inputs.
Layer 2: make the database enforce aggregates
Server code can be inconsistent across teams, so push as much as possible into the data layer. Give the MCP server a dedicated database role that can read only restricted views or run predefined aggregate queries. The role should have no access to base tables. Allow-list the queries the server may issue so that a bug or injected parameter cannot widen the result.
Apply a minimum group size. NIST describes suppressing counts below a threshold to prevent identification of attribute combinations with small numbers. It also lists threshold, dominance and ambiguity rules, and describes them as ad hoc proposals. Treat them as useful but imperfect, and test them against small-cohort re-identification for your own data.
Know the failure modes. An aggregate over a group of one is that record. A sum can be dominated by one customer. Two queries that differ by a single filter can be subtracted to isolate an individual, so suppressing small groups in each result does not by itself stop differencing. Where accuracy loss is acceptable, NIST notes that noise can be added to query results, potentially satisfying a formal privacy model such as differential privacy. It also says every disclosure limitation process reduces accuracy and that each interactive query adds privacy loss. Document the method you choose and the accuracy you accepted.
Finally, keep free text out of the aggregate path. Do not expose views that include notes, comments or message fields, and do not allow functions that concatenate or select the maximum of a text column.
Layer 3: enforce policy on each call and response
Tool design and database controls are set in advance. Enforcement in the execution path checks what actually happens on each call, including prompt-driven requests that try to exceed intended limits. Policy can evaluate the tool call before it reaches the server, and the response before it reaches the model.
On the call, a policy can allow a request that matches an approved aggregate tool and permitted parameters, and block one that names row-level fields or unapproved dimensions. On the response, it can check that the payload matches the aggregate-only shape, redact identifiers or free-text values that should not appear, and block a response that still contains record-level content. Rate limiting repeated calls can slow differencing attempts, though it does not remove the underlying risk.
There is also a gap that no single server sees. NIST's NCCoE raises as an open question how to determine the sensitivity of data an agent aggregates, and whether the user is authorized to see the combined response. Policy applied at the agent and tool-call level is a place to evaluate that, since it sees calls across servers.
Trussed provides this layer. It enforces policy in the execution path across models, agents, tools and MCP servers, with actions that include allow, redact, block, rate limit and escalate for human approval, scoped to individual interactions and tool calls. Enforcement is at runtime, not reviewed after the fact. It can be self-managed in the customer cloud, with configurable retention and data residency. The design above works with any enforcement point, and Trussed is one way to implement it.
Three layers between a customer record store and a model
Tool design
Strict input schemas and a declared aggregate-only response shape.
Data layer
Restricted views, predefined aggregates and minimum group sizes.
Runtime enforcement
Policy applied to each tool call and response, with evidence retained.
See how call-level enforcement and evidence work for MCP servers
Review how policy applies to tool calls and responses, and what audit-ready evidence each decision produces.
See How Evidence Is ProducedHow does your AI governance program compare?
See where your program has gaps in less than 2 minutes.