Files
Max Isbey 94982a5b93 feat: add MCP_HIDE_INPUT_IN_ERRORS env var to redact payloads from validation errors
Pydantic's ValidationError repr includes the raw input_value by default.
When the SDK calls model_validate_json() on untrusted data (SSE messages,
OAuth responses) and validation fails, logger.exception() dumps the entire
payload into logs. This can leak sensitive tool output or OAuth tokens.

Setting MCP_HIDE_INPUT_IN_ERRORS=1 before importing the SDK applies
hide_input_in_errors=True to the jsonrpc_message_adapter TypeAdapter and
the OAuth models (OAuthToken, OAuthClientMetadata, OAuthMetadata,
ProtectedResourceMetadata). The error type and location remain in the
message; only the raw input is omitted.

Opt-in via env var to preserve the current debugging-friendly default.
2026-03-25 16:16:02 +00:00
..
2024-09-24 22:04:19 +01:00
2025-02-05 11:02:51 +00:00