Developing real-time, dynamic, and in situ analytical methods with high spatial and temporal resolutions is crucial for exploring biochemical processes in the brain. Although in vivo electrochemical methods based on carbon fiber (CF) microelectrodes are effective in monitoring neurochemical dynamics during physiological and pathological processes, complex post modification hinders large-scale productions and widespread neuroscience applications. Herein, we develop a general strategy for the in situ engineering of carbon-based materials to mass-produce functional CFs by introducing polydopamine to anchor zeolitic imidazolate frameworks as precursors, followed by one-step pyrolysis. This strategy demonstrates exceptional universality and design flexibility, overcoming complex post-modification procedures and avoiding the delamination of the modification layer. This simplifies the fabrication and integration of functional CF-based microelectrodes. Moreover, we design highly stable and selective H+, O2, and ascorbate microsensors and monitor the influence of CO2 exposure on the O2 content of the cerebral tissue during physiological and ischemia-reperfusion pathological processes.