Bethe ansatz solution of the topological Kondo model