Join our Newsletter — 33% off our NHI Course

How should security teams prevent PII from leaking through MCP tool calls?

Start by inspecting what each tool actually returns, then filter or redact fields before the response reaches the model. Access control alone is not enough, because the agent may receive far more data than the task requires. Security teams should classify tool outputs, define minimum necessary fields, and log every filter decision for auditability.

Why This Matters for Security Teams

PII leakage through MCP tool calls is rarely a single permission problem. The bigger issue is that a model or agent can request broad tool output, then surface more data than the original task required. That makes access control necessary but insufficient. Current guidance suggests teams should treat tool responses as a data-loss boundary, not just an execution boundary, and align controls to the data leaving the tool rather than the user asking for it.

This is especially important in agentic workflows because the agent may chain prompts, tools, and memory in ways that are difficult to predict in advance. The risk is not just a direct disclosure, but secondary exposure through summaries, logs, retries, and downstream orchestration. NHI Management Group has documented how secret sprawl and weak visibility amplify these failures in practice, including in the Guide to the Secret Sprawl Challenge and the 52 NHI Breaches Analysis.

That matters because AI systems are already showing scope creep into sensitive data. In AI Agents: The New Attack Surface report, SailPoint found that 33% of organisations report AI agents accessed sensitive data beyond their intended scope, and only 52% can track and audit what agents accessed. In practice, many security teams discover the leak only after a response has already been generated and propagated.

How It Works in Practice

The practical control is to put a policy and filtering layer between the MCP tool and the model. That layer should inspect the raw tool output, classify fields, and remove anything that is not necessary for the specific task. For example, a support agent asking for a customer account status does not need full address history, token fragments, or internal notes unless the workflow explicitly requires them. The design goal is minimum necessary data at the response boundary, not just least privilege at the tool permission boundary.

Teams usually implement this in three steps. First, define tool-specific output schemas and label fields by sensitivity, so the application knows what can be returned to the model. Second, redact or transform fields before the LLM receives them, using deterministic rules wherever possible. Third, log the filter decision with enough context for audit and incident response, including tool name, field classes, policy version, and reason for suppression. That logging discipline fits the wider control expectations described in NIST AI Risk Management Framework and the agent-focused threat models in the OWASP Agentic AI Top 10.

For higher-risk environments, the better pattern is runtime policy evaluation rather than static allowlists. Current guidance suggests combining MCP tool governance with context-aware checks, so a response can be narrowed based on the request purpose, user role, workflow state, and data classification. That approach also aligns with the operational lessons in Ultimate Guide to NHIs — Why NHI Security Matters Now, where overexposed identities and poor visibility routinely turn routine automation into a data exposure path. These controls tend to break down when tool responses are unstructured free text, because sensitive values cannot be reliably separated after the fact.

Common Variations and Edge Cases

Tighter output filtering often increases engineering overhead, requiring organisations to balance data minimisation against workflow reliability. That tradeoff becomes visible when a tool response feeds multiple downstream tasks, because one consumer may need the full object while another should see only a redacted subset.

There is no universal standard for this yet, but best practice is evolving toward field-level policy, purpose-bound responses, and separate response profiles for human and agent consumers. This is especially relevant when tools return mixed records such as account metadata, audit trails, and free-text case notes in a single payload. In those cases, redaction alone may be too blunt, and teams may need to split the tool into smaller methods so each call returns only one data class.

Another edge case is retrieval from shared MCP servers or third-party connectors. Even if the agent is trusted, the upstream tool may already aggregate more PII than the task should see. That is where the visibility gap matters: the question is not only whether the agent is authorised, but whether the tool source itself is returning safe-by-default output. The OWASP guidance for agentic applications and NHIMG’s Analysis of Claude Code Security both point to the same operational reality: if the model can see it, the model can potentially repeat it.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP Agentic AI Top 10, CSA MAESTRO and OWASP Non-Human Identity Top 10 address the attack and risk surface, while NIST AI RMF and NIST CSF 2.0 set the governance and control requirements practitioners need to meet.

Framework Control / Reference Relevance
OWASP Agentic AI Top 10 A2 Addresses agent data exposure and tool-call leakage risks.
CSA MAESTRO GOV-03 Covers governance for agent actions and data handling.
NIST AI RMF GOVERN Supports accountability and risk controls for AI data flows.
OWASP Non-Human Identity Top 10 NHI-05 Relevant to secret and sensitive data exposure from machine identities.
NIST CSF 2.0 PR.DS-01 Data security outcome fits protecting PII in transit and at rest.

Limit what machine-to-machine responses can disclose and audit every sensitive field suppression.