Sundas Alam threatened Bradford West's Naz Shah with a "bullet through the head" in a series of emails in 2021.
Referencing the deaths of MPs Jo Cox and Sir David Amess, Judge Sean Morris said politicians "should not have to put up with threats".
Alam, 30, from Bradford, was sentenced at York Crown Court.
Prosecutor Tom Storey said Alam worked for the probation service in West Yorkshire at the time she sent the threatening emails on 3 April.
He said she had contacted Ms Shah for help regarding claims of sexual harassment but was directed elsewhere for support by the MP.
The barrister said Alam had used cloned email addresses to make it appear they were coming from someone else.
He said her efforts to conceal her identity had resulted in an innocent family being dragged out of their beds by armed police and questioned for 20 hours after Ms Shah dialled 999.
In their victim impact statements the family said they had been "treated like terrorists or drug dealers".
Passing sentence Judge Morris said Alam's actions were "disgraceful, shameful, terrifying and vile" and said her sentence must act as a deterrent to others.
"There has to be an element of deterrent, especially in the light of recent tragic events", he said.
"Members of parliament dedicate their lives to the service of their constituents and their country.
"They should not have to put up with threats. It should not be something that goes with the job."
Alam, of Princeville Street, Bradford, had previously denied three charges of sending malicious communications and a charge of perverting the course of justice but changed her pleas to guilty on the third day of a trial.
Ahead of the sentencing Ms Shah, who is shadow minister for community cohesion, said she had received many death threats before, but this was the first time she had ever dialled 999 as she "genuinely felt it was an immediate firearms threat".