I use dovecot to serve mbsync-downloaded email (offlineimap alternative) and used to read it with gnus.
You can find my configs here:
- dovecot part: GitHub - rasendubi/dotfiles: My dotfiles
- gnus part: https://github.com/rasendubi/dotfiles/blob/37602299e9df06664f8b8ac806f79345648eaf5f/emacs.org#gnus
(Gnus uses “shell” stream, so it does not open TCP connection, though.)