The UK will play a leading role in developing a spacecraft to warn of solar storms.