94982a5b93
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.