Prepare the pasta dough by mixing the flour, eggs, and salt in a mixing bowl. Knead until smooth. Wrap in plastic wrap and let it rest for 20 minutes.
While the dough is resting, heat olive oil in a sauté pan over medium heat. Add the chopped mushrooms and cook until softened.
Add the chopped spinach to the sauté pan and cook until wilted. Season with salt and pepper. Remove from heat and let cool.
In a mixing bowl, combine the cooled mushroom and spinach mixture with ricotta cheese and Parmesan cheese. Stir until well mixed.
Roll out the pasta dough on a floured surface into thin sheets using a rolling pin.
Cut the dough into squares (about 3 inches by 3 inches). Place a small spoonful of filling in the center of each square.
Fold the squares over to form triangles and press the edges to seal. Use a fork to crimp the edges if desired.
Boil water in a large pot and carefully drop in the ravioli. Cook for 3-4 minutes or until they float to the surface.
In a separate sauté pan, melt butter and sauté garlic until fragrant. Add red pepper flakes, if using, and the vegetable broth. Let simmer for 2-3 minutes.
Drain the ravioli and add them to the sauce, tossing gently to combine.
Serve topped with grated Parmesan and garnish with fresh basil or parsley.