Helicobacter pylori (H. pylori) infection is the leading cause of chronic gastritis, peptic ulcer and gastric cancer. Antibiotics, as traditional method for eliminating H. pylori, have no targeting effect, which cause serious bacterial resistance and gut dysbacteriosis. Moreover, antibiotics can hardly address hyperactive inflammatory response or damaged gastric mucosal barrier caused by H. pylori infection. Here, we report a pH-responsive metal-organic framework hydrogen generation nanoparticle (Pd(H)@ZIF-8), which is encapsulated with ascorbate palmitate (AP) hydrogel. Both in vitro and in vivo experiments demonstrate that the outer AP hydrogel can target and adhere to the inflammatory site through electrostatic interaction, and is then hydrolyzed by matrix metalloproteinase (MMP) enriching in inflammatory sites. The released Pd(H)@ZIF-8 nanoparticles are further decomposed by gastric acid to generate zinc ions (Zn2+ ) and hydrogen, thus effectively killing H. pylori, alleviating inflammation and restoring impaired gastric mucosa simultaneously. Unexpectedly, this metal-organic framework hydrogen generation platform (Pd(H)@ZIF-8@AP) also has an inappreciable impact toward intestinal flora, which thus provides a more precise, effective and healthy strategy for the treatment of H. pylori infection. This article is protected by copyright. All rights reserved.