The officer, known as Vincent, told the court how he infiltrated the group, known as the Three Musketeers.
Naweed Ali, 29, from Sparkhill in Birmingham, is on trial at the Old Bailey accused of preparing terrorism acts along with three other men from the West Midlands.
They were arrested on August 26 after a pipe bomb was found in Ali's car.
Both Ali, of Evelyn Road, and his co-accused Khobaib Hussain, 25, also of Evelyn Road, have previous convictions for attending a terror training camp.
The officer said he had posed as the boss of a courier firm which had employed Ali to travel around the country delivering parcels.
On Ali's first day, he left his Seat Leon at the depot in Birmingham city centre and took a van on a delivery run to Luton, the court heard.
Meanwhile, British security services searched Ali's car.
Giving evidence from behind a screen, Vincent said they found what appeared to be a pipe bomb and a handgun inside a JD Sports bag in the car.
He said he and another officer had eased the contents of the bag on to a ground sheet and carried it into a different room.
Vincent told jurors the bag contained a black self-loading pistol with an empty magazine strapped to it, chrome-coloured pipe, a hatchet knife, gunshot cartridges and a single 9mm bullet.
There were also latex gloves, a roll of gaffer tape and some napkins, he said.
Jurors have previously heard the pipe bomb turned out to be only partially constructed and the pistol was an imitation firearm.
Ali and Hussain, Mohibur Rahman, 32, of High Lane, Stoke-on-Trent, and Tahir Aziz, 38, of of Wulstan Road, Stoke-on-Trent, deny the charges.
The case will resume on Monday.
An undercover officer has described how secret agents found a bomb in the car of a convicted terrorist.