Heat the oil in a frying pan. Fry the onion and pepper over a low heat for 5 minutes, or until softened and beginning to brown, stirring regularly with a wooden spoon.
Add the cumin and chilli flakes and cook for 20–30 seconds, stirring constantly. Tip the beans into the pan and cook for 2 minutes, stirring occasionally.
Make two dips in the beans and break an egg into each one.
Reduce the heat to low, cover with a lid and cook for 5 minutes, without stirring, until the egg whites are set but the yolks are still runny.
Sprinkle with the cheese, if using, and serve with toast on the side for dipping.