It is well known that real regular bounded KP (n-k,k)-line solitons are associated to soliton data in the totally non-negative part of the Grassmannian Gr(k,n) and that, in principle, they may be obtained in a certain limit from regular real quasi--periodic KP solutions. The latter class of KP solutions correspond to algebraic geometric data a la Krichever on regular M-curves according to a theorem by Dubrovin-Natanzon. In this talk I shall present some new results recently obtained in collaboration with P.G. Grinevich (LITP-RAS and Moscow State University). The purpose of our research is the connection of such two areas of mathematics using the real finite gap theory of the KP equation. I shall explain how we associate to any KP soliton data in the real totally nonnegative part of Gr(k,n) the rational degeneration of an M-curve of genus g=k(n-k) and the effective KP divisor.