You can also control it wirelessly using adb tcp mode.
Run adb tcpip 5555 and connect it using adb connect command
Run adb tcpip 5555 and connect it using adb connect command
The solution would be to change the direction of the connection, and use "adb forward", but then scrcpy would try to connect before the server is started, so it would need to retry until connected (and the error would not be noticed on connect, but on first read, due to the tunnel).
Working over "adb connect" would be good, though.