General manager Chris Drury announced the deal on Thursday for the 28-year-old who started the season with Hartford (AHL).
Harpur will earn $775,000 next season and $800,000 in the final year.
Harpur has skated in 18 games for the Rangers this season with one goal and two assists. Since he made his debut on Dec. 15, the Rangers are 11-4-3 and have allowed the third fewest goals against per game (2.33) in the NHL.
The Hamilton, Ontario, native has two goals and 16 assists in 174 career NHL games with the Rangers, Nashville Predators and Ottawa Senators. He was was originally selected by the Senators in the fourth round of the 2013 draft.