This paper proposes a framework for semi-autonomous longitudinal guidance for electric vehicles. To lower the risk for pedestrian collisions in urban areas, a velocity trajectory which is given by the driver is optimized with respect to safety aspects with the help of Nonlinear Model Predictive Control (NMPC). Safety aspects, such as speed limits and pedestrians on the roadway, are considered as velocity and spatial constraints within prediction horizon in NMPC formulation. A slack variable is introduced to enable overshooting of velocity constraints in situations with low risk potential to rise driver acceptance. By changing the weight of slack variable, the control authority can be shifted continuously from driver to automation. Within this work, a prototypical real-time implementation of the longitudinal guidance system is presented and the potential of the approach is demonstrated in human-in-the-loop test drives in the Stuttgart Driving Simulator.