We present a general construction of all correlation functions of a two-dim
ensional rational conformal field theory, for an arbitrary number of bulk a
nd boundary fields and arbitrary topologies; The correlators are expressed
in terms of Wilson graphs in a certain three-manifold, the connecting manif
old. The amplitudes constructed this way can be shown to be modular invaria
nt and to obey the correct factorization rules.