Going from a STEM degree to a history masters?Watch
Contact the uni's whose courses you are most interested in and ask.
I was able to study a history postgrad without a history undergrad.
Certainly UCL and Cambridge HPS will consider STEM grads, since the Cambridge undergraduate course in fact is part of the natural sciences tripos there and the Part III course explicitly considers applicants from other courses and not only from Part II HPS or equivalent, and UCL states clearly on the admissions page that the programme is suitable for applicants with a range of first degrees in the humanities, social sciences, natural sciences, medicine, etc. I would be surprised if any other university offering such a programme would restrict their pool of potential applicants given those two don't (since they are the biggest departments specialising in those areas in the UK afaik).