The intermittent nature of wind power is a major challenge for wind as an energy source. Wind power generation is therefore difficult to plan, manage, sustain, and track during the year due to different weather conditions. The uncertainty of energy loads and power generation from wind energy sources heavily affects the system stability. The battery energy storage system (BESS) plays a fundamental role in controlling and improving the efficiency of renewable energy sources. Stochasticity of wind speed and reliability of the main system components are considered. This paper presents a dynamical control system based on model predictive control (MPC) in real time, to make full use of the flexibility and controllability of energy storage to mitigate problems of wind farm variability and intermittency. The control scheme first plans the expected output, then stochastic optimization is used to optimize grid integrated wind farm BESS output power, develop an optimal operation strategy for BESS, and prevent some unpredictable conditions that may have impacts on the stability of the system. The results show that the proposed method can reduce grid-connected wind power fluctuations, limit system faults, control command for the BESS in the dispatching period, and ensure system stability for grid connection.