The Browns sent the 25-year-old McCoy to the 49ers in exchange for a pair of undisclosed draft picks in the 2013 NFL Draft, the teams announced.
A former University of Texas standout, McCoy was drafted in the third round by Cleveland in 2010. He appeared in eight games that season, tossing for 1,576 yards, six touchdowns and nine interceptions.
The next year he started 13 games but was replaced by rookie Brandon Weeden in 2012.
Expected to serve as a backup to Colin Kaepernick in San Francisco, McCoy has thrown for 4,388 yards, 21 touchdowns and 20 interceptions over 24 career contests.
Jessica Simpson shares three-way kiss with friends in photo
Senate Democrats to pull all-nighter on climate change