He appealed to the party’s MPs to “calm down” and settle Labour’s differences through a democratic process.
Answering questions following a speech in London he said Mr Corbyn is “staying as the leader of the Labour Party” and if there was a contest he could win.
He said it was “really disappointing” that frontbenchers had quit at a time when the country needed stability.
Mr McDonnell said: “The internal difficulties within both parties will be resolved, hopefully by democratic means, and on that basis, amicably, the Labour Party will come back together.
“If there is to be a leadership challenge to Jeremy Corbyn, let’s bring that forward, use the democratic process and then our party members will decide who is the leader and the future direction of our party.”
He continued: “At the moment, Jeremy is leader of the Labour Party, elected with the largest mandate any political leader had from his political party only nine months ago.
“If there is to be a challenge to Jeremy Corbyn, in terms of a leadership contest, that will emerge I suspect over the next few days.
“If that is the case, my message to all Labour MPs now is just ‘calm down’, let’s do our job. It isn’t just our party members who need us to do our job, it is the country that need us to do our job.”
Former shadow business secretary Angela Eagle is expected to mount a challenge to Mr Corbyn, with ex-shadow work and pensions secretary Owen Smith also reported to be considering a bid.
In the last week around 60,000 people have joined Labour with the prospect of taking part in a leadership election.
But as both factions in the party have used social media campaigns to encourage supporters to sign up, it is not clear whether the boost in membership would benefit Mr Corbyn, who was swept into the leader’s office on the back of a grassroots movement last year.
Mr McDonnell said people were “flooding in” to the party since Mr Corbyn’s victory. He said Mr Corbyn was “staying” and said that if there was a challenge he would automatically be on the ballot paper - an assertion disputed by some of those opposed to the leader.
“I think he will win, but you can never predict these things, it’s a democratic election” he said.
Mr McDonnell denied having any future leadership ambitions himself.
“The stories that went round a few weeks ago (were) that I was building a plot to oust Jeremy and replace him. This week the story is I’m forcing him to stay.
“They’ve got to get this right somewhere along the line. So let me make it absolutely clear: I will never stand for leader of the Labour Party. If Jeremy stands and there is a leadership campaign, I will chair his campaign committee.”
Scores of frontbenchers have quit in recent days, leaving Mr Corbyn with a seemingly impossible task in filling the vacancies after 172 of his MPs backed a no confidence motion in his leadership.
The shadow chancellor called for the rebels to come back to the fold.
Mr McDonnell said: “I find it really disappointing. Just at a time when our country needs us and people need to step up to the plate, now is not the time to stand down. Just behave responsibly.”
He added: “We have maintained a shadow cabinet and we have maintained a number of people in junior positions as well.”
The people who had continued to serve or moved into new roles were “heroes and heroines of our movement at the moment”.
But he added: “Wouldn’t it all be better if people just came back and worked with us?”