We study the hydrodynamic limit for the isothermal dynamics of an anharmonic chain under hyperbolic space-time scaling and with nonvanishing viscosity. The temperature is kept constant by a contact with a heat bath, realised via a stochastic momentum-preserving noise added to the dynamics. The noise is designed so it contributes to the macroscopic limit. Dirichlet boundary conditions are also considered: one end of the chain is kept fixed, while a time-varying tension is applied to the other end. Moreover, Neumann boundary conditions are added in such a way that the system produces the correct thermodynamic entropy in the macroscopic limit. We show that the volume stretch and momentum converge (in an appropriate sense) to a smooth solution of a system of parabolic conservation laws (isothermal Navier-Stokes equations in Lagrangian coordinates) with boundary conditions.Finally, changing the external tension allows us to define thermodynamic isothermal transformations between equilibrium states. We use this to deduce the first and the second law of Thermodynamics for our model.