How to disable removal of mods when disconnected from the server?

My friend and I want to play together, my PC is the server. Downloading mods takes a long time because there are too many of them, and every time you disconnect from the server, all mods are deleted. How can I remove this feature?