The Sharks also signed minor league defenseman Mark Cundari to a one-year deal as they stocked up the depth in their organization.
In other news, executive Wayne Thomas retired after 22 years with the organization.
McNally was originally a fourth-round pick by Vancouver in 2010 but went to college instead of signing with the Canucks. The Sharks acquired his rights for a seventh-round pick at this year's draft.
McNally had six goals and 15 assists in 21 games at Harvard this season.
"Patrick is a player we have had our eye on for some time now," general manager Doug Wilson said. "He has been a very productive collegiate defenseman and head coach Ted Donato and the Harvard staff have done a tremendous job preparing him to take the next step. We're excited for him to continue his development with our organization."
McCarthy, 28, has played 87 career games with San Jose with three goals and three assists.
Lerg, 29, had 13 goals and 28 assists for Worcester of the AHL last year and scored in his NHL debut on April 9 at Edmonton.
Haley, 29, had 18 goals and 13 assists at Worcester last season.
Cundari, 25, had seven goals and 22 assists in 50 games last season for Adirondack of the AHL.
Boughner spent the past four seasons as head coach of Windsor in the OHL. He spent one year as an assistant in the NHL with Columbus in 2010-11. Boughner played in 630 NHL games as a defenseman with Colorado, Carolina, Calgary, Pittsburgh, Nashville and Buffalo.
Hedberg served most recently as the goaltending coach for New Jersey's AHL affiliate and had also been a special assignment scout in the organization when DeBoer was the Devils' head coach. Hedberg played in 373 career NHL games with Pittsburgh, Vancouver, Dallas, Atlanta and New Jersey.
Thomas, 67, spent 45 years in hockey as a player, coach, scout and executive. He played goalie for nine years in the NHL for Montreal, Toronto and the New York Rangers. The Canadiens won the Stanley Cup his rookie year in 1972-73.
Thomas worked closely with the goalies in San Jose and had various other duties.