Did you take a look at the various MMU implementation out there:
- GitHub - EtteGit/EnragedRabbitProject
- GitHub - technik-gegg/SMuFF-Klipper: Klipper support for the SMuFF
- GitHub - moggieuk/Happy-Hare: MMU software driver for Klipper (ERCF, Tradrack, Prusa)
The last one seems the most comprehensive implementation.
Edit
Another interesting implementation: GitHub - HelgeKeck/rome: Multi extruder to direct extruder setup