Jaseem Saeed, 39, from Dewsbury, West Yorkshire was cleared of two counts of making threats to kill.
His threats at the office of Paula Sherriff came three months before the death of MP Jo Cox in June.
Saeed has been given a year-long community order for affray and must carry out 120 hours of unpaid work.
Leeds Crown Court heard how he had become aggressive at the office of Ms Sherriff, Labour MP for Dewsbury, while asking for help with a passport application to travel to Iraq in March.
He admitted the charge before he went on trial.
Saeed appeared for the sentencing via video link from HMP Armley, where he had been on remand since the offence.
The court heard Saeed threatened to shoot a case worker although the woman did not see a gun.
Mr Justice Goss, who also appeared by video link from the Royal Courts of Justice, told him: "If you behave in this way again, I have already told you, you can expect a significant custodial sentence."
He said it appeared that Saeed, who was originally from Iraq but has lived in the UK for 14 years, does not suffer from any psychiatric conditions but does have "anger management issues".
Ms Sherriff's office is four miles (6km) from the constituency office in Birstall, where Batley and Spen MP Jo Cox died after being shot and stabbed outside her office.
A man who scared staff at an MP's constituency office has been warned he will go to jail if he ever repeats his actions.