Shimano GRX (or similar) and a flat bar - possible?
The GRX is theoretically possible. Or at least better than road ones, bucause it s specifically designed for larger tyres so it gives more clearance for wider chainstays. It moves the chainline by 5 mm outward in comparison to road cranks.

Also, the 46-30T chainrings on FC-RX600-10 give a bit more clearance than compact road chainrings.

Still, your MTB frame's chainstay could be too wide. You will have to measure it or try it somewhere.

As for the flat bars, the Tiagra flat bar shifters SL-4700 should be compatible according to the compatibility chart.