He tested positive in the wake of his third round defeat to Mikkel Kessler in a WBA super-middleweight title challenge in Denmark in December.
Jamaican sprinters Asafa Powell and Sherone Simpson both tested positive for the same stimulant following the Jamaican national trials last month.
The 38-year-old said he feared his career was over when he was informed of the positive test in February.
Having identified a supplement as a possible cause, he was handed a retrospective ban by the UK Anti-Doping Agency which is due to expire next week.
"I was in total shock when I was told I had tested positive, and I honestly thought someone was playing a joke," Magee told Press Association Sport.
"All I could think was I could get a lifetime ban or even a two-year ban which at my age would have meant my career was as good as over.
"I have had 30 or 40 tests in my career and never tested positive. I have always been extremely careful about everything I have taken, and I didn't do anything differently before the Kessler fight."
Magee said he consumed the banned substance via a contaminated over-the-counter supplement he had been using to combat a cold.
He is considering legal action against the supplier.
UK Anti-Doping accepted Magee's version of events, saying it was satisfied he had not sought to enhance his performance.
Magee's manager Pat Magee said he is currently in the process of contacting other athletes who may be at risk after using the same product, with a view to possible legal action.
"Brian is a clean boxer and I couldn't believe it when I was informed in February. It just goes to show you can never be too careful as far as these supplements are concerned," he said.
The boxer, who fought Carl Froch in 2006 and is a former British and European champion, said he is intent on returning to the ring.
Magee added: "I've already got back in the gym and I can't wait to fight again.
"I haven't had any bad beatings and I think there are still a number of big fights out there for me."