Similar to a network KVM, ShareMouse for macOS transmits mouse movements and clicks through the local LAN. Any mouse and keyboard input is transmitted to the corresponding computer. Move the mouse to the monitor of the computer you wish to control and the pointer magically jumps to that computer.
ShareMouse app for Mac lets you control multiple computers from a single mouse and keyboard.