To guarantee the safety and stability of cable-driven continuum robots (CDCRs) in multi-obstacle scenarios, this paper proposes a novel trajectory planning and tracking framework that integrates an artificial potential field (APF) based model predictive control (MPC) with a two-layer B-spline trajectory optimization framework. APF is incorporated as a penalty term in the objective function to enhance trajectory safety. Additionally, an improved whale optimization algorithm (IWOA) is introduced to circumvent the local optimal trap of MPC. Particularly, to improve tracking accuracy and stability, a two-layer B-spline optimization framework is proposed to enhance the smoothness of the planned trajectory. Simulation and experimental results show that the designed trajectory planning and tracking algorithm can generate collision-free trajectories and achieve high tracking accuracy in multi-obstacle environments.