Important questions regarding the chemical composition of the neutral interstellar medium (ISM) in the Large Magellanic Cloud (LMC) and Small Magellanic Cloud (SMC) are still open. It is usually assumed that their metallicity is uniform and equal to that measured in hot stars and regions, but direct measurements of the neutral ISM metallicity had not been performed until now. Deriving the metallicity from the observed metal abundances is not straightforward because the abundances depend on the depletion of metals into dust and on nucleosynthesis effects such as alpha -element enhancement. Our aim is to measure the metallicity of the neutral ISM in the LMC and SMC, dust depletion, and any nucleosynthesis effects. We collected literature column densities of and in the neutral ISM towards 32 hot stars in the LMC and $22$ in the SMC. We determined dust depletion from the relative abundances of different metals because they deplete with different strengths. This includes a `golden sample' of sightlines where Ti and other alpha -elements are available. We fit linear relations to the observed abundance patterns so that the slopes determined the strengths of dust depletion and the normalizations determined the metallicities. We investigated alpha -element enhancements in the gas from the deviations from the linear fits and compared them with stars. In our golden sample we find alpha -element enhancement in the neutral ISM in most systems, on average 0.26 dex (0.35 dex) for the LMC (SMC), and an Mn underabundance in the SMC (on average $-0.35$ dex). Measurements of are not available for the LMC. These are higher than for stars at similar metallicities. We find total neutral ISM metallicities that are mostly consistent with hot star metallicity values, on average $M$/H tot =-0.33$ ($-0.83$), with standard deviations of 0.30 (0.30), in the LMC (the SMC). In six systems, however, we find significantly lower metallicities, 2 out of 32 in the LMC (with $ solar) and 4 out of 22 in the SMC (3<!PCT!>\ and 10<!PCT!> solar), two of which are in the outskirts of the SMC near the Magellanic Bridge, a region known for having a lower metallicity. The observed alpha -element enhancements and Mn underabundance are likely due to bursts of star formation, more recently than $ Gyr ago, that enriched the ISM from core-collapse supernovae. With the exception of lines of sight towards the Magellanic Bridge, the neutral gas in the LMC and SMC appears fairly well mixed in terms of metallicity.