McKelvin, who was released by the Buffalo Bills last week, was permitted to agree to a contract before the new league year begins Wednesday at 4 p.m. ET because his contract was terminated.
McKelvin will be reunited with defensive coordinator Jim Schwartz, who was Bills' defensive coordinator in 2014.
McKelvin, 30, had one year remaining on his contract when he was released by the Bills on March 4 to free up salary-cap space. His role with the team was less certain following the emergence of 2015 second-round draft pick Ronald Darby.
McKelvin, who doubled as a return specialist, started five games last season -- one at safety and the final four contests at cornerback in place of an injured Stephon Gilmore -- after being activated from the non-football injury list in November, the result of a broken ankle that ended his 2014 season almost a year earlier.
He also missed 13 games in 2009 because of a broken leg.
The 2008 first-round pick played in 98 games over the past eight seasons for Buffalo, making 60 starts. He has 317 career tackles, 4 forced fumbles and 13 interceptions to his credit.
ESPN Bills reporter Mike Rodak contributed to this report.