The Mets’ search for bullpen improvement has led them to a former All-Star recently released by the Cubs.

Brad Brach, whom team officials had discussed with the Orioles in trade talks before the 2018 season, was signed by the Mets on Thursday. Brach, a Freehold, N.J., native who pitched at Monmouth, was 4-3 with a 6.13 ERA in 42 appearances for the Cubs this season.

The Mets cleared space on the 25-man roster by optioning lefty reliever Donnie Hart to Triple-A Syracuse. Brandon Nimmo was placed on the 60-day injured list to create room on the 40-man roster.

The 33-year-old Brach’s best season came with the Orioles in 2016, when he went 10-4 with a 2.05 ERA in 71 appearances, earning him an All-Star selection.

Mets officials discussed Brach with the Orioles at the winter meetings before the 2018 season, as part of a deal that might have included Matt Harvey. But the Mets stuck with Harvey heading into the season, before trading him to Cincinnati for Devin Mesoraco.

Edwin Diaz and Jeurys Familia have both struggled, leaving the Mets searching for bullpen options to bolster a unit that has depended largely on Seth Lugo, Robert Gsellman and Justin Wilson in recent weeks.

There is optimism Nimmo, who is working out in Port St. Lucie, will begin a rehab assignment within the next week, according to a source. Nimmo has been on the injured list for the last 2 ½ months, rehabbing from a bulging disk in his neck. The source indicated other ailments have popped up during the course of Nimmo’s workouts that have lengthened his rehab. If Nimmo were to begin playing minor league games within the next week, as hoped, he could potentially rejoin the Mets by the end of the month.

Joe Panik will become a free agent Friday afternoon if he clears waivers. The Mets have interest in the second baseman — a former St. John’s standout who was designated for assignment by the Giants this week. Panik would give the Mets another second-base option to replace Robinson Cano, who is sidelined with a torn left hamstring.