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.

First Minister Carwyn Jones will travel with former Wales football striker Ian Rush to Switzerland on 21 April to get the trophy from Uefa's headquarters.
The trophy will be "welcomed" to the host city with a parade from Cardiff Castle to the Principality Stadium.
It will then embark on a tour around Wales, stopping at schools, clubs and popular public locations.
The women's Champions League trophy, the final of which will be staged at the Cardiff City Stadium on Thursday, 1 June, will also be on the tour.
The second-legs of the men's quarter-final ties will be staged this week.
UEFA Champions League Trophy Experience, public event dates in Wales:
Friday 21 April: 16:45 Trophy arrival in Wales and procession from Cardiff Castle to Principality Stadium
Saturday 22 April: 13:30-15:00 Liberty Stadium in Swansea
Sunday 23 April:  16:00-20:00 Aberystwyth Town Football Club
Monday 24 April: 14:00-19:00 Bangor City Football Club
Tuesday 25 April: 17:00-18:30 Llandudno Football Club
Wednesday 26 April: 18:00-20:00 Bala Town Football Club
Saturday 29 April: All day Beaumaris Castle
Sunday 30 April: 11:00-17:00 Portmeirion (Public event)
Monday 1 May: 18:00-20:00 Cefn Druids Football Club, Wrexham
Thursday 4 May: 10:00-16:00 Haverfordwest town centre
Saturday 6 May: 09:00-11:00 Newtown Football Club, 13:00-15:00 Brecon Leisure Centre, 17:00-20:00 Merthyr Town Football Club
Sunday 7 May: 10:00-14:00 Tenby
Monday 8 May: 14:00-16:00 Friars Walk Shopping Centre, Newport, 18:00-20:00 Cwmbran Stadium
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.
[NEXT_CONCEPT]
The Champions League trophy will go on tour around Wales before the 2017 final in Cardiff on 3 June.