NASHVILLE, Tenn. (AP) Free-agent shortstop Asdrubal Cabrera and the New York Mets have finalized an $18.5 million, two-year contract.

Cabrera was the second middle infielder added by the Mets at the winter meetings after they acquired second baseman Neil Walker from the Pittsburgh Pirates for left-hander Jon Niese.

Cabrera's deal, which includes a 2018 club option, was agreed to Wednesday and announced Friday after the infielder passed a physical.

More from FoxSports

''We're trying to build a team with a lot of flexibility, versatility and depth. That's what we're doing,'' assistant general manager John Ricco said Thursday.

A 30-year-old switch hitter, Cabrera batted .265 with 15 homers and 58 RBIs for the Tampa Bay Rays last season. Cabrera finished at the bottom in several defensive metrics for shortstops, according to Fangraphs.com.

The two-time All-Star has hit .267 with 102 homers and 509 RBIs in a nine-year career with Cleveland (2007-14), Washington (2014) and the Rays.

The additions of Cabrera and Walker give the NL champion Mets the options they were looking for in the infield. New York already had Ruben Tejada and Wilmer Flores. Both Tejada and Flores can spell David Wright at third base. Wright missed significant time last year with spinal stenosis and it is unknown how many days in a row he will be able to play in the future.

''We think we have some good players. But whether it be through giving them more rest or finding ways to get them at-bats in situations where they'll thrive, that's the goal,'' Ricco said. ''And trying to find pieces that allow us to do that is what we've been focused on.''

The Mets are still looking for bullpen help, another outfielder and, with the trade of Niese, a starter - at least until Zack Wheeler's expected return this summer from Tommy John surgery.

''I think we have the ability to do all three if the pieces that we like are there,'' Ricco said. ''We have the resources to do it. We have the money to do it.''

NOTE: The Mets lost right-hander Matthew Bowman to St. Louis in the winter meetings draft. Bowman played for Triple-A Las Vegas last season.

---

Baseball Writer Ronald Blum contributed to this report.