Free agent starting pitcher Brandon McCarthy has reached agreement on a two-year, $15.5 million contract with the Arizona Diamondbacks, a source told ESPN.com.

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.