I think by the time of the Boshin war the Shogunate is already dead. To save the shogunate, you have to go back a few years to prevent the alliance between the Satsuma and the Choshu. If the Shogunate can win the Satsuma to their side (they were for a moderate reform of the Bakufu), their won't be a lot of people on the side of the Emperor.
If the shogunate reform to survive, it will still be very militarized and will probably crush the Russians in *1908 as they did in OTL, if this war happens. The problem is that the shogunate will probably be closest in foreign policy to the pre-1945 Showa era than the Taisho Era (meaning aggressive military foreign policy and not very democratic).
Or if you are an optimist, despite massive militarisation and intern opposition, maybe the shogunate manage to reform and could become some sort of democracy, but with two hereditary leaders, the emperor who can act like the King in the UK, and the shogun on the other hand (maybe at first like a prime minister, which can evolve to a sort of glorified army leader), with maybe a different system than the common bicameral system of europe (tricameral ? house of commons and two house of peers, one for the Kuge and one for the samurai)