Your client (the ESP8266) is physically connected to the MPU6050. The simplest approach is where it performs the fusion and sends the results to the server using the IOT interface. I recommend the asynchronous version as the IOT code is asynchronous. I suggest you adapt and run the test program
fusiontest_as6.py which is for the MPU6050. It will need to be adapted for the ESP8266: in
this line instead of the string 'X' you will need to pass an initialised I2C instance.
There is a question mark over how well this will work on ESP8266 as the fusion code is maths intensive. One option may be to use frozen bytecode to reduce RAM use. Another option is to perform the fusion on the server, this is discussed
in this doc. In essence you send the IMU data plus a precision timestamp to the server (over the IOT interface) and the server runs the fusion code. A final option is to use an ESP32 or (even better) a Pyboard D.
I'm afraid this isn't an easy beginner project. Asynchronous programming, sensor fusion, client/server operation and frozen bytecode all present rather steep learning curves. You will need patience, determination and a willingness to experiment and to read documentation. Good luck