SnSe2 with high theoretical capacity has been identified as an emerging anode candidate for lithium-ion batteries (LIBs) and sodium-ion batteries (SIBs). However, the rate performance and cycling performance of this material in practical applications are still limited by unavoidable volume expansion and low conductivity. In this work, we designed and synthesized nitrogen-doped carbon-coated SnSe2/C-N composites using 2-aminoterephthalic acid (C8H7NO4) as a nitrogen-containing compound for modification by hydrothermal and vacuum calcination methods to achieve efficient utilization of active sites and optimization of the electronic structure. The carbon skeleton inherited from the Sn-MOF precursor can effectively improve the electronic conduction properties of SnSe2. N-doping in the Sn-MOF can increase the positive and negative electrostatic potential energy regions on the molecular surface to further improve the electrical conductivity, and effectively reduce the binding energy with Li+/Na+ which was determined by Density Functional Theory (DFT) methods. In addition, the N-doped carbon skeleton also introduces a larger space for Li+/Na+ intercalation and enhances the mechanical properties. In particular, the post-synthetically modified MOF-derived SnSe2/C-N materials exhibit excellent cyclability, with a reversible capacity of 695 mA h g-1 for LIBs and 259 mA h g-1 for SIBs after 100 cycles at 100 mA g-1.