If the MCU pin has an internal pullup resistance it is already high otherwise you need to add one from the pin to 5V (say of value 4K7).
You are right, you can connect the collector to the the pin and the emitter to the ground. At the transistor (npn) base you add a resistor in series to limit the base current. Its value could be rather high (say 100K if you like). It is better to add also a resistor between the base and ground having a value about 1/4 of the previous one (say 22K).
Added (another solution, using a zener diode):
If there is an internal pullup resistor (otherwise you need to add a 10K external resistor) and you have a 4V7 zener, you can connect its cathode to the MCU pin and its anode to ground. Then you add a resistor having a relatively low value (as 1K) between your input source (5 to 12V) and the MCU pin.