Preheat your oven to 375°F (190°C). Lightly grease a 9x13-inch baking dish.
In a large skillet, melt butter over medium heat. Sauté onions and garlic until fragrant.
Add mushrooms and cook until tender. Stir in flour and cook for 1-2 minutes.
Gradually whisk in chicken broth and heavy cream. Simmer until thickened.
Season the sauce with salt and pepper. Stir in Parmesan cheese until melted.
Combine the cooked spaghetti, shredded chicken, and sauce in a large bowl. Mix well.
Transfer the mixture to the prepared baking dish. Top with mozzarella cheese and breadcrumbs if desired.
Bake for 25-30 minutes, or until bubbly and golden brown on top.
Garnish with chopped parsley before serving.