As someone who often deals with headless machines, the best solution I have found for using my laptop as a monitor is this: https://www.amazon.com/dp/B0BJ2YDV7Q It's basically a chip to capture the HDMI signal from a headless machine, and expose an emulated webcam via USB to your laptop. It's so tiny the electronic is basically built into the cable.
For the keyboard I haven't found a good solution other than buying a standard wireless keyboard (with integrated trackpad, for the rare cases where a mouse is needed).