Let $\sigma$ the density of the cone, $\alpha$ its half-angle, $H$ its height, $x$ the coordinate of a point $P$ located in the symmetry axis of the cone (which origin is at the apex of the cone), $G$ the gravitational constant, and $R$ the radius of a infinitesimal disc of width $dh$ which center is at a distance of $h$ units from the origin. See the figure below:

Let's calculate the gravitational potential $U_{\text{disc}} (x)$ at point P due to the presence of the infinitesimal disc.
Let $\mathrm {d}M$ the mass of a infinitesimal piece of the disc and $d$ its distance from point $P$, then $U_{\text{disc}} (x)$ can be calculated by the following equation:
$$U_{\text{disc}} (x) = \iint \limits_{\text{disc}}{\frac{-G}{d} \mathrm {d}M} \tag{1}$$
But $\mathrm {d}M = \sigma \, \mathrm {d}h \, r \, \mathrm {d}r \, \mathrm {d}\theta$, so we get the following equation:
$$U_{\text{disc}} (x) = \int_0^{2\pi} \int_0^R{\frac{-G \sigma}{\sqrt{(x+h)^2+r^2}} \, \mathrm {d}h \, r \, \mathrm {d}r \, \mathrm {d}\theta} \tag{2}$$
We know that
$$R=h \tan{\alpha} \tag{3}$$
Therefore evaluating the double integral and substituting $(3)$ in $(2)$, we get:
$$U_{\text{disc}} (x) = -2\pi G \sigma\, \mathrm {d}h \left(\sqrt{(x+h)^2+\left(h\tan{\alpha}\right)^2}-|x+h|\right) \tag{4}$$
The gravitational field $\vec{g}_{\text{disc}}(x)$ at point $P$ can be calculated by:
$$\vec{g}_{\text{disc}}(x)= - \mathrm {grad}\, U_{\text{disc}} (x) \tag{5}$$
But we know that $\mathrm {grad} \, U_{\text{disc}} (x)=\dfrac{\mathrm {d}U_{\text{disc}}}{\mathrm {d}x}\vec{i}$, therefore for $x>-h$ we get:
$$\vec{g}_{\text{disc}}(x)= 2\pi G \sigma\, \mathrm {d}h \left(\frac{x+h}{\sqrt{(x+h)^2+(h\tan{\alpha})^2}}-1\right)\vec{i} \tag{6}$$
After that calculate the integral:
$$\vec{g}_{\text{cone}}(x)=2\pi G \sigma\, \int_0^{H} {\left(\frac{x+h}{\sqrt{(x+h)^2+(h\tan{\alpha})^2}}-1\right)\vec{i}} \, \mathrm {d}h \tag{7}$$
where $\vec{g}_{\text{cone}}(x)$ is the gravitational field at point P due to the presence of the cone.
Finally substitute $x=0$ and we are done.