The Spaniard left Formula One at the end of last season but attended pre-season testing at Barcelona's Circuit de Catalunya on Tuesday.
McLaren said in a statement that Alonso would help advise compatriot Carlos Sainz and British rookie Lando Norris as well as engineers.
"He will also drive at selected tests to support the development of MCL34 and MCL35 for 2020," the team added.
Ferrari secure Leclerc for the next five years
Alonso is also racing at the Indianapolis 500 in May for a McLaren team and is seeking to become only the second driver after Britain's Graham Hill to win motorsport's Triple Crown.
A winner of the Le Mans 24 Hours sportscar race and Monaco Grand Prix, Indianapolis is the final part of the triple for the 37-year-old who won his two F1 titles with Renault in 2005 and 2006.
"Fernando is part of the McLaren family," said team boss Zak Brown in a statement.
"He has set his place in the team's history and continues to write his chapter of the McLaren story, so it is entirely appropriate that we formalise his status as a McLaren ambassador, joining another double champion, Mika Hakkinen.
For any race team, having someone of Fernando's class on hand to provide support through his experience is of huge value.
Alonso, who is also competing in the world endurance championship with Toyota, said he saw McLaren as a 'spiritual home' and intended to be a part of the team for a long time and Indianapolis was just a start of their further collaboration.
"I am particularly passionate about nurturing young talent, whether that's with my own team or helping the new generation of Formula One drivers at McLaren unlock their true potential," he said.
Ferrari unveil new Formula One car for new era
McLaren could turn to Alonso if they need a reserve