There is a bit of history with Mercedes assisting their rival manufacturers since the hybrid V6 introduction. Mercedes assisted Renault to built a better engine after their disastrous 2014 campaign. This deal was helped because of the
Renault-Nissan-Daimler partnership, which was formed in 2010, for their joint road car division.
Mercedes also (apparently) assisted Ferrari in 2015, to which an agreement in principle was
rumoured to have been made between Niki Lauda, Sergio Marchionne and Bernie Ecclestone. Apparently for the good of the sport. This deal is something that was not spoken of much, but paddock insiders believe it did indeed happen. Proof of which is now apparent with Ferraris 2017 engine being on par with the Mercedes.
And now the paddock talk is that Honda and Mercedes have just recently begun working together to improve the Honda engine. With an improvement in engine performance expected after the summer break in August. This is probably where the rumours of McLaren seeking out Mercedes engines started a few weeks back.