Titanium oxynitride and molybdenum oxynitride assembled in the pores of mesoporous materials were achieved by nitriding titania-modified MCM-41 and molybdena-modified MCM-41 at 800°C for 3 hours under flowing NH3 atmosphere. XRD, XPS and N2 adsorption-desorption isotherms were employed to characterize the structure of the composite materials. The results showed that the nanosized TiOxNy and MoOxNy particles were assembled in mesoporous silica MCM-41 with the restrict mesopores. The hexagonal periodicity of the parent MCM-41 materials was maintained upon assembly at the provided nitridation temperature. The exact formation was TiO0.4N0.8 in MCM-TiOxNy, and MoO1.7N0.57 in MCM-MoOxNy, which were calculated from the data in XPS spectra of Ti 2p and Mo 3d.