Theoretically detouring SendInput, mouse_event, keyb_event in User32.dll would block all macros and autoclickers while retaining hardware mouse and keyboard events since those are the functions used by software to generate mouse and keyboard events. You could do some detouring at NtSendUserInput since all 3 pass it, though still bypassable at kernal, hooking to the SSDT. But I believe at this level it would involve distinguishing hardware from Windows API events if you wanted to prevent any bypassing.. Not sure how you would do that..
Hook, find the function, detour to a new function with the same arguments as the original that simply returns.. or call exit process, then return.. or make a message box that says to turn yer shenanigans off, then return.
Edit:
Some antiviruses may see this as a threat though, since you may need to hook Windows itself for detours to find the instance of the function that is used.
Oh, serversided?

Pie.. or cake.. or both. And since it's serversided it means you control the pie and cake.