In a large saucepan, heat the oil over medium-low heat.
Add the mushrooms, garlic, ginger and pepper flakes (optional) and sauté for 2 minutes until the mushrooms start to get tender and the garlic is fragrant.
Add the broth and carrots, bring it to a boil, reduce the heat and simmer until the carrots are tender, about 3 minutes.
Meanwhile, put the cornstarch in a small bowl and whisk in the soy sauce and vinegar.
Slowly whisk the cornstarch mixture into the soup, and simmer for 2 more minutes until the soup has thickened slightly.
Pour in the egg and stir the soup rapidly until the egg cooks and thickens the soup, about 2 minutes.
Add the tofu and scallions, cover and let it stand for 1 minute. Serve it immediately or refrigerate it for up to 3 days.