  The electronic structure, stability, electron phonon coupling and
superconductivity of the non-oxide perovskite MgCNi$_3$ are studied using
density functional calculations. The band structure is dominated by a Ni $d$
derived density of states peak just below the Fermi energy, which leads to a
moderate Stoner enhancement, placing MgCNi$_3$ in the range where spin
fluctuations may noticeably affect transport, specific heat and
superconductivity, providing a mechanism for reconciling various measures of
the coupling $\lambda$. Strong electron phonon interactions are found for the
octahedral rotation mode and may exist for other bond angle bending modes. The
Fermi surface contains nearly cancelling hole and electron sheets that give
unusual behavior of transport quantities particularly the thermopower. The
results are discussed in relation to the superconductivity of MgCNi$_3$.
