San Francisco also finalized a trade with Jacksonville for quarterback Blaine Gabbert when he passed a physical Friday.
Cook spent the past four seasons with Minnesota. He started 29 games and had 120 tackles, 13 passes defensed and one sack. He started 11 games last season.
The Niners agreed to send a sixth-round pick to Jacksonville on Tuesday for Gabbert, pending a physical.
The 24-year-old Gabbert was the 10th overall draft pick in 2011 out of Missouri. He has thrown for 22 touchdowns in three NFL seasons, completing 414 of 777 passes for 4,357 yards in 28 games and 27 starts.
AP NFL website: www.pro32.ap.org