Hi @g h ,
You can create a app password in the link below:
Then you can connect to site using AppPassword like this:
Or you can use SharePointPnPCoreOnline assembly, this will pop up a login dialogue and make it available to use MFA Authentication:
Reference:
Using CSOM To Connect To A SharePoint Site With Multi Factor Authentication Enabled