MCPSafe.io
RegistryThreatsMethodologyDocsPricingScanSign in
MCPSafe.io

Security checks for MCP servers — public packages and private repos, fast or deep.

Legal

Privacy PolicyCookie PolicyTerms of ServiceSecurity disclosure

Resources

State of MCP SecuritySupportSystem statusMade in Germany 🇩🇪

© 2026 MCPSafe. All rights reserved.

GDPR — Privacy Policy
← Threat Catalog

Configuration & Environment

PII written to logs

HIGHCWE: CWE-532Rule: MCP-251

MCP server logs include PII (email, SSN, phone, credit-card, government ID) — log aggregators, third-party log services, and incident-response screenshots become a privacy breach surface. Sibling rules in the sensitive-data-exposure (CWE-532) family: MCP-202 (secrets to MCP responses) and MCP-306 (auth headers logged before auth check).

What it is

Logs travel further than developers expect: aggregators like Datadog, Sentry, and CloudWatch are reachable by every engineer, contractor, and on-call. PII landing in logs creates a compliance liability (GDPR, CCPA, HIPAA) and a real-world breach risk if any of those tools is itself compromised.

Why it matters for MCP

MCP tool inputs frequently contain user identifiers — emails to send to, phone numbers to look up, account IDs to query. Defensive logging (`logger.info("sending mail", to=email)`) trades one debugging convenience for a long tail of compliance work. The right pattern is to log a redacted/hashed identifier and a separate correlation ID.

Vulnerable example

example.py
1
@server.tool()
2
def send_welcome(email: str) -> str:
3
    logger.info("sending welcome to %s", email)  # PII in logs.
4
    send_email(email, ...)
5
    return "ok"

Secure example

example.py
1
import hashlib
2
3
def hash_id(s: str) -> str:
4
    return hashlib.sha256(s.encode()).hexdigest()[:8]
5
6
@server.tool()
7
def send_welcome(email: str) -> str:
8
    logger.info("sending welcome", extra={"email_hash": hash_id(email)})
9
    send_email(email, ...)
10
    return "ok"

How MCPSafe detects this

MCPSafe flags logger calls (`logger.*`, `print`, `console.log`) whose argument list contains identifiers with PII-suggesting names: `email`, `phone`, `ssn`, `address`, `dob`, `card`, `credit_card`, `iban`. Calls passing the value through a hash or redaction helper are exempted.

See the full threat catalog for every documented detection.

Further reading

  • CWE-532: Insertion of Sensitive Information into Log File
  • GDPR Art. 32 — Data minimization in logs

Scan an MCP server for this issue

MCPSafe runs this check — and every other rule in the catalog — on any MCP server you paste in.

Scan now