Isn't just clamping to Vdd/Vss easier? It will give you Vdd + 1 diode drop for free, use Schottky's if you're worried about internal diodes conducting before the discrete ones. Include series resistors to limit the current. If it's just 12V, I don't think you need to worry about speed and energy, as you would with ESD protection. With some series resistance, basic small-signal silicon or Schottky diodes should be fine.
About the 240V AC with series resistance, the 10Mohm resistor limits the current to about +/-17uA. I would only use this if the datasheet explicitly mentions this as a safe amount of current for the clamping diodes, usually the documented safe maximum is no current at all. I would also be worried about transients. And you obviously have to treat your MCU circuit and everything connected to it as mains with regards to safety, creepage and isolation. Optical or magnetical isolation seems like the easier solution to me.