Preheat the oven 350 degrees. Line 12 muffin cups with cupcake liners and set pan aside.
Place the chocolate and butter in a large microwave-safe bowl and heat in 30-second intervals, stirring after each interval, until chocolate is melted and mixture is smooth. Cool for 5 minutes, then whisk in the sugar, salt, and espresso powder (if using). Add the eggs and whisk to combine. Whisk in the flour and cocoa powder until just smooth—don’t over-mix.
Fill the bottoms of the prepared muffin cups with about 1 tablespoon of batter. Top with a peppermint patty, then top with remaining batter. Bake 32 to 36 minutes, until a toothpick inserted into the cupcakes comes out with just a few moist crumbs. (Don’t stick the toothpick too deep into the cupcake or you’ll hit the peppermint patty and your test won’t be accurate.)
Set pan on a wire rack to cool completely before frosting.
Place the butter in the bowl of a stand mixer fitted with the paddle attachment. Beat on low until creamy. Add 2 cups of powdered sugar, 1 tablespoon milk, and the peppermint extract and salt. Beat on low to combine, then turn mixer to high and beat for 3 minutes, until light and fluffy. Add additional powdered sugar if frosting is too thin and additional milk if it’s too thick. Frost cupcakes as desired and serve.