Dustin May’s stint with the Red Sox was a short one.

After just six appearances (five starts) in a Boston uniform, May is moving on, as he has agreed to sign with the Cardinals, a source confirmed. It’s a one-year deal with a mutual option for 2027. May’s salary is unknown.

May, who turned 28 in September, was one of two pitching additions made by chief baseball officer Craig Breslow, who shipped prospects James Tibbs III and Zach Ehrhard to the Dodgers in a last-minute deal in order to reinforce his rotation. May pitched pretty well for the Red Sox in early August but struggled before landing on the injured list with right elbow neuritis in September. In total, May logged a 5.40 ERA in 28 ⅓ innings as a Red Sox, allowing 35 hits and recording 26 strikeouts.

May’s season ended with a relief appearance on September 3. He was left off the postseason roster because of the elbow injury but is now said to be fully recovered. At the MLB Awards show in November, May — after representing the Red Sox in the first-ever Capital One MLB Open golf tournament — said he was “fully back to normal” with his arm and looking forward to signing as a free agent.

“I just want to find a spot that’s going to treat me well and put the best foot forward and make me have the best season possible,” he said. “So that’s kind of what we’re looking at right now is just who’s going to help the most.”

In St. Louis, May will help fill the void ex-Red Sox boss Chaim Bloom opened when the Cardinals traded Sonny Gray to Boston last month. One of his projected rotation mates is former Red Sox teammate Richard Fitts, who went to the Cardinals as part of the package for May.

May’s agreement with St. Louis was first reported by ESPN’s Jeff Passan.