The Rise of the Planet of the Apes actor will play the title role in Bob Servant Independent.
Based on a string of books and BBC Radio Scotland series, the show focuses on Servant, an opportunistic, would-be politician who exploits a by-election for self-promotion.
Fresh Meat star Greg McHugh will also appear in the Dundee-set satire, alongside Jonathan Watson, Ron Donachie, Rufus Jones and Pollyanna McIntosh.
"As a Dundee man I am very excited to be filming a brand new television comedy set in Broughty Ferry," said Cox.
"With the comic writing skills of fellow Dundonian Neil Forsyth and the audacious spirit of Bob Servant, it shouldn't fail to capture the very essence of the unique East Coast humour."
Series creator Neil Forsyth added: "It's hugely exciting that Bob is making it onto the telly, and that Brian is once again involved and leading a brilliant cast.
"He's been a supporter of the Bob Servant cause for a long time and I can't wait to see him stride about Broughty Ferry in character."
Bob Servant Independent will air on BBC Four later this year. Owen Bell will produce, with Cheryl Taylor, BBC Four's Mark Freeland and BBC Scotland's Ewan Angus as co-exec producers.
> Lilyhammer Norwegian drama picked up by BBC Four
> Borgen series two to air in UK, BBC Four confirms