Recent studies suggest that transcranial electrical stimulation (tES) can be performed during functional magnetic resonance imaging (fMRI). The novel approach of using concurrent tES‐fMRI to modulate and measure targeted brain activity/connectivity may provide unique insights into the causal interactions between the brain neural responses and psychiatric/neurologic signs and symptoms, and importantly, guide the development of new treatments. However, tES stimulation parameters to optimally influence the underlying brain activity may vary with respect to phase difference, frequency, intensity, and electrode's montage among individuals. Here, we propose a protocol for closed‐loop tES‐fMRI to optimize the frequency and phase difference of alternating current stimulation (tACS) for two nodes (frontal and parietal regions) in individual participants. We carefully considered the challenges in an online optimization of tES parameters with concurrent fMRI, specifically in its safety, artifact in fMRI image quality, online evaluation of the tES effect, and parameter optimization method, and we designed the protocol to run an effective study to enhance frontoparietal connectivity and working memory performance with the optimized tACS using closed‐loop tES‐fMRI. We provide technical details of the protocol, including electrode types, electrolytes, electrode montages, concurrent tES‐fMRI hardware, online fMRI processing pipelines, and the optimization algorithm. We confirmed the implementation of this protocol worked successfully with a pilot experiment.