Heat 1 tablespoon olive oil in a wide pot over medium-high heat. Add the onion and cook for 3 minutes until it softens.
Add the remaining 1 tablespoon olive oil to the pot. Add the mushrooms and cook, stirring frequently, for 8-10 minutes until they begin to turn deep golden brown all over. Season liberally with salt and pepper.
Simmer the sauce:
Melt the butter into the mushrooms and add the capers. Cook for 1–3 minutes more.
Pour in the water or vegetable stock and bring to a boil. Reduce heat and simmer for 15 minutes until it thickens. Taste and season with salt and pepper.
Cook the pasta:
Bring a large pot of salted water to a boil. Cook the spaghetti according to package instructions. Reserve 1/3 cup pasta cooking water. Drain the spaghetti.
Finish the sauce:
Return the piccata sauce to a boil. Add the lemon juice and pasta cooking water and boil for 1–2 minutes. Add the spaghetti and toss to coat. Turn off the heat.
To serve:
Divide the cooked pasta between shallow bowls. Garnish with freshly minced parsley if you like. Enjoy!