Preheat oven to 400F.
Fill large stock pot with water and bring to a boil with a pinch of sea salt. Add green beans and cook for 5 minutes, then strain.
Meanwhile, cook onions with olive oil over medium heat until soft, then add mushrooms and cook for 5 minutes. Add garlic, salt, pepper and cayenne and cook another 3 minutes.
Deglaze pan with half of the vegetable stock, saving other half for the tofu. Sprinkle flour over the pan and stir to create a sauce.
Puree tofu in a food processor with remaining ½ cup of vegetable broth until smooth.
Add pureed tofu to mushroom pan and stir over medium heat to coat mushrooms evenly. Then add green beans and toss to coat well.
Transfer green bean mixture to casserole baking dish, top with fried onions and bake for 15 minutes.