Context. Massive protostars have associated bipolar outflows with velocities of hundreds of km s-1. Such outflows can produce strong shocks when they interact with the ambient medium leading to regions of nonthermal radio emission. Aims. We aim at exploring under which conditions relativistic particles are accelerated at the terminal shocks of the protostellar jets and whether they can produce significant gamma-ray emission. Methods. We estimate the conditions necessary for particle acceleration up to very high energies and gamma-ray production in the nonthermal hot spots of jets associated with massive protostars embedded in dense molecular clouds. Results. We show that relativistic bremsstrahlung and proton-pro...