Fully nonlinear and viscous wave-body interaction problem involved in the station-keeping of a near-surface underwater body in a current using a flapping foil is analyzed using a finite-difference method based on boundary-fitted coordinates. The governing Navier-Stokes equations together with exact boundary conditions are solved in primitive variables using the projection fractional step method. The method is implemented using boundary-fitted coordinates generated using a variational method based on reference space. By choosing the Jacobian of the mapping of the reference space to the computational space as a function of flow vorticity, adaptive grids are generated. The software (numerical code) used in the present work has been developed solely by the author over the years based on the above algorithm. Results are obtained for a range of parameters in distinct flow regimes of sub-critical, super-critical and critical wave motions and low, optimal and high Strouhal numbers; i.e., for τ = U σ/g less than, greater than and equal to 0.25 and St less than 0.25, in the range of 0.25 to 0.35 and greater than 0.35. Results demonstrate the significance of the free-surface effects on propulsive characteristics of the flapping foil. It is found that at upstream propagating waves generated at sub-critical flow (τ < 0.25) contribute to drag thereby adversely affecting the propulsive efficiency of the flapping fin. At critical wave motion with τ = 0.25, continuously growing, and eventually breaking, standing wave is generated above the flapping foil. Both thrust and efficiency are found to be low at τ = 0.25. At supercritical wave motion (τ > 0.25) proximity of the foil to the free surface is found to increase the propulsive efficiency which is attributed to the momentum flux in the downstream propagating waves. For all values of τ, the thrust coefficient is found to be decreasing with decreasing submergence depth. In the presence of free surface, the necessary conditions for optimal performance of the flapping foil are found to be Strouhal number St to range from 0.25 to 0.35 (as found earlier by others for flapping foils in infinite fluid) and the unsteady frequency parameter supercritical τ > 0.25 so that the waves are propagating only downstream.