In order to effectively improve the utilization rate of solar energy resources and to develop sustainable urban efficiency, an integrated system of electric vehicle charging station (EVCS), small-scale photovoltaic (PV) system, and battery energy storage system (BESS) has been proposed and implemented in many cities around the world. This paper proposes an optimization model for grid-connected photovoltaic/battery energy storage/electric vehicle charging station (PBES) to size PV, BESS, and determine the charging/discharging pattern of BESS. The multi-agent particle swarm optimization (MAPSO) algorithm solves this model is solved, which combines multi-agent system (MAS) and the mechanism of particle swarm optimization (PSO). In this model, a load simulation model is presented to simulate EV charging patterns and to calculate the EV charging demand at each time interval. Finally, a case in Shanghai, China is conducted and three scenarios are analyzed to prove the effectiveness of the proposed model. A comparative analysis is also performed to show the superiority of MAPSO algorithm.