For mitmproxy that would be achieved like this: https://docs.mitmproxy.org/stable/concepts-certificates/
It's also very nice to intercept app traffic. Some use cert pinning, so the custom certificate won't work.
This will fail in some cases when the application is obfuscated or uses a non-standard pinning mechanism. In this case you can decompile the application to determine the methods used to accomplish the pinning and use frida (https://frida.re) directly in order to manually override them.