This paper considers a non-self-financing mean-variance portfolio selection problem in which the stock price and the stochastic cash flow follow a Markov-modulated Levy process and a Markov-modulated Brownian motion with drift, respectively. The stochastic cash flow can be explained as the stochastic income or liability of the investors during the investment process. The existence of optimal solutions is analyzed, and the optimal strategy and the efficient frontier are derived in closed-form by the Lagrange multiplier technique and the LQ (Linear Quadratic) technique.