Thomas Mair, 53, is accused of repeatedly shooting and stabbing the 41-year-old Remain campaigner a week before the EU referendum vote.
The mother of two was set upon outside her constituency surgery in Birstall, near Leeds, in front of her staff and shocked residents on June 16.
Her assistant stepped in and hit Mair with her handbag, while 78-year-old Bernard Carter-Kenny desperately tried to intervene but was stabbed too, the Old Bailey heard.
Taxi driver Rashid Hussain pulled up at around the same time as Mrs Cox’s arrival at Birstall library in a silver Vauxhall Astra.
As he was giving his fare her change, he heard what sounded like a “firecracker”, jurors were told.
Mr Hussain said: “I just gave the change back and then because everybody was going towards the library I parked my car there.
“I walked towards the entrance and see the guy stabbing somebody ... behind the car. He was just standing up and he was in the road.”
The witness said he saw the man stab the Batley and Spen MP five or six times.
Mr Hussain said: “When I reached near, he stepped back.
“I said: ‘what are you doing, what’s wrong with you.’
“He said: ‘Move back, otherwise I’m going to stab you’.
“He was standing there with two ladies and another man. He said ‘better move back’.
“He shot twice. He moved back and shot again.”
Mr Hussain told jurors that by this point Mrs Cox, who he had recognised as his MP, was bleeding from her mouth and was being helped by an Asian woman.
He said: “Jo’s head was in her lap and she was pleading for Jo to stand up, talking about her kids.
“Her hands and clothes were covered in blood. She was the only person there helping her.”
David Honeybell, who had gone to see Mrs Cox before her surgery, told jurors that after the attack the man calmly walked away.
He said: “He just walked away with not a care in the world, he just walked away.”
Another eyewitness, Stephen Connolly, said: “It was very cold, he just walked away.”
Mair denies Mrs Cox’s murder, possession of a firearm with intent to commit an indictable offence and possession of an offensive weapon - a dagger.
He also pleads not guilty to causing grievous bodily harm with intent to Mr Carter-Kenny on the same date.
Clarke Rothwell was in a nearby sandwich shop when Mair allegedly launched his attack.
He told jurors he heard a “popping” noise and a woman scream.
Mrs Cox then slumped to the floor before her attacker shot her in the stomach, he said.
The man shouted words like “this is for Britain” and “put Britain first” before reloading his gun and shooting for a third time, the witness told jurors.
The trial continues.