McCarthy will receive a $2.5 million signing bonus and annual salaries of $4 million and $9 million, the source said.
The deal is pending completion of a physical exam.
The right-handed McCarthy, 29, is 37-39 with a 4.02 ERA in seven seasons with the Chicago White Sox, Texas Rangers and Oakland Athletics. He went 8-6 with a 3.24 ERA in 18 starts with the A's last season before being hit in the head with a line drive off the bat of the Los Angeles Angels' Erick Aybar in early September.
McCarthy suffered an epidural hemorrhage, a brain contusion and a skull fracture from the hit, and underwent two hours of emergency surgery to relieve pressure on his brain. He did not pitch again during the regular season or the postseason.
In mid-November, McCarthy was cleared to resume baseball activities by Dr. Mickey Collins of the University of Pittsburgh Medical Center.
McCarthy joins Ian Kennedy, Trevor Cahill and Wade Miley atop the Arizona rotation. His arrival gives Diamondbacks general manager Kevin Towers more latitude to consider trade offers for Tyler Skaggs, Trevor Bauer and Patrick Corbin -- three of Arizona's highly sought-after young pitchers.
The Twins, White Sox, Royals, Cubs, Red Sox and Angels were among other clubs that reportedly had expressed interest in McCarthy.