Before he passed Mr McCain was very clear to friends and family that Trump is banned.
He also asked former Presidents Mr Obama and George W. Bush to give eulogies.
Both men are prominent Trump critics, and the invitations are being seen by many as a barely disguised attack on the sitting President.
According to CNN Mr Obama was stunned by the invitation, and both men accepted.
In 2016 Mr Obama, who Trump defined himself against politically, claimed the then presidential contender was “unfit to serve as president” and “woefully unprepared to do this job”.
Similarly Mr Bush has said that Trump “doesn’t know what it means to be President” and admitted he didn’t vote for his fellow Republican in the 2016 presidential election.
Mr Obama famously defeated Mr McCain in the 2008 presidential election.
He was also defeated by Mr Bush, for the Republican Party presidential nomination in 2010.
Before he died Mr McCain penned a final “letter to America” which was fiercely critical of Trump.
In a clear attack on Trump’s proposed border wall it claimed American greatness is reduced: “when we hide behind walls, rather than tear them down.”
He added: “Do not despair of our present difficulties but believe always in the promise and greatness of America, because nothing is inevitable here.
“Americans never quit. We never hide from history. We make history.”
Mr McCain has been a fervent Trump critic since the New York property mogul announced his presidential bid in 2015.
After being criticised by Mr McCain Trump caused outrage by replying: “He was a war hero because he was captured. i like people who weren’t captured.”
During the Vietnam War Mr McCain spent five and a half years as a prisoner of the communist North Vietnamese, during which he was tortured repeatedly.
Last year Mc McCain infuriated Trump by blocking the repeal of Obamacare in Congress.
Since Mr McCain’s death Trump has been engaged in an ongoing row about the White House flag.
On Monday the flag was raised to full height, in what many saw as an insult to the former senator.
It was lowered again following a statement from the powerful American Legion veterans group.
Trump then released a statement saying: “Despite our differences on policy and politics, I respect Senator John McCain’s service to our country”.