In recent years, the frequency of extreme high-temperature events has gradually increased. To better understand the impact of urban green space coverage's spatial pattern on land surface temperature (LST), this study selected three sample areas along the urban-rural gradient in Shanghai. Using LST inversion and resampling methods, LST data for different grid sizes were obtained for spring, summer, and winter in the 2010s, 2015s, and 2020 s. A boosting regression tree model was employed to determine the key indicators affecting LST and effective cooling thresholds. The impact of green quality, structure, and pattern at the community scale on LST was discussed, providing feasible suggestions for green space planning and design in different urban spaces. The study found significant differences in the spatial patterns of green areas and LST among the three sample regions. The quantity and integrity of green spaces in the Huangpu, Minhang, and Songjiang sample areas have progressively improved, with overall green coverages of 19 %, 38 %, and 43 %, respectively. As grid size increases, the relative influence of fractional vegetation coverage (FVC) on LST generally decreases, whereas the relative influence of green structure and patterns gradually increases. Taking the summer of the 2020 s as an example, the influence of FVC on the three study sample areas was 80.79, 83.36, and 87.18 at a 30 m grid size, which decreased to 48.87, 40.59, and 47.64 at a 120 m grid size. The green structure's impact rose from 13.09, 15.22, and 10.6–30.01, 51.82, and 38.5; the influence of green patterns increased from 6.12, 1.42, and 2.21–21.13, 7.6, and 13.86. Key indicators affecting LST include FVC (Fractional Vegetation Coverage), AREA (Green Patch Area), PD (Patch Density), COHESION (Patch Cohesion Index), and ED (Edge Density). High temperatures in summer are one of the ecological issues that need special attention in Shanghai's green space design. Setting the green space proportion to 35 % while avoiding fragmentation and low vegetation coverage can achieve effective cooling. This study's main advancement lies in utilizing machine learning algorithms to identify the principal green spatial pattern impact factors and key thresholds influencing LST at the community scale in Shanghai. The related results and proposed strategies provide a research framework and strong basis for special regulations in urban green space system planning concerning urban thermal environments. They offer references for urban renewal and new town planning to address climate change and urban high-temperature issues, such as clear requirements for optimal green space area at the community scale, community park spatial layout and quantity regulations, and urban park planning design suggestions. This study also highlights obstacles in the practical application of planning and design strategies, which can help avoid difficulties in implementing planning policies. It attempts to set goals for community-scale vegetation planning in China from a policy perspective and provides relevant recommendations.