For a Markovian queueing network with two stations in tandem, finite intermediate buffer,and M flexible servers, we study how the servers should be assigned dynamically to stations in order to obtain optimal long-run average throughput. We assume that each server can work on only one job at a time, that several servers can work together on a single job, and that the travel times between stations are negligible. Under these assumptions, we completely characterize the optimal policy for systems with three servers. We also provide a conjecture for the structure of the optimal policy for systems with four or more servers that is supported by extensive numerical evidence. Finally, we develop heuristic server assignment policies for systems with three or more servers that are easy to implement, robust with respect to the server capabilities, and generally appear to yield near-optimal long-run average throughput.