How do conservative forces do work on a mechanical system if they conserve mechanical energy? The question arises from my confusion over the two definitions of work (relevant to classical mechanics) I've encountered:

*

*$W= \int \vec F\cdot\mathrm{d}\vec x$

*$W=$ net change in energy of a system

We define the mechanical energy for a state to be the sum of the kinetic and potential energies, and then define a conservative force as one that doesn't change/conserves a system's mechanical energy. By the second definition, this implies that conservative forces like gravitational force do no work on a mechanical system, but this conflicts with the statements in my reference book and the ones I have read on the internet. They reason, with the (aforementioned) first definition: if a non-zero conservative force $\vec F$ acts along and throughout a body's non-zero displacement, the work ($W=\int\vec F\cdot\mathrm{d}\vec x$) should be non-zero, and therefore a conservative force does work.
Which of the aforesaid is actually true, and why?
 A: Your second definition is incorrect. The total work done on a system by all forces is equal to the change in kinetic energy, not total energy. So, gravity pulling a mass down does work that increases its kinetic energy. Non-conservative forces change total mechanical energy, conservative forces do not. They can both do work by changing the kinetic energy of a mass or system of masses.
A: A conservative force can indeed do work on a system, just with the stipulation that this work is path-independent. This is equivalent to the statement that:
$$W=\oint\mathbf{F}\cdot\mathrm{d}\mathbf{\ell}=0$$
However, this integral doesn't necessarily vanish along a non-closed line:
$$W=\int_L\mathbf{F}\cdot\mathrm{d}\mathbf{\ell}$$
Since the integral is path-independent, potential energy can be well-defined. For instance, it can be defined as the work necessary to bring a system into some point, starting from infinity. We can say $W=\Delta K=-\Delta V$ such that $\Delta U=\Delta K+\Delta V=0$.
You may have confused work with change in mechanical energy; generally, the work is equal to the change in kinetic energy.
A: Often if one does not define the system being considered apparent inconsistencies can arise.
Consider a system consisting of a point mass moving in a gravitational field produced by another mass.
There is one external force acting on the system - gravitational attraction which is a conservative force.
The work done by the gravitational field is equal to the change in the kinetic energy of the system.
Now consider the same situation but now the system consists of both masses with no external forces acting.
In such a system the sum of the kinetic energy and the gravitational potential energy of the system (mechanical energy) stays constant.
However, there are internal forces (Newton third law pairs) at play and those internal forces do work on the constituent parts of the system.
Both masses have work done on them by the gravitational field produced by the other mass.
With this statement you will perhaps note that you can treat the two-mass system as two one-mass systems with the internal forces for the two-mass system being external forces for the two one-mass systems.
In the examples that I have used, conservative (gravitational) forces are doing work.
