We consider a single server queue in which the arrivals occur according to a Markovian arrival process. The system is subject to external shocks causing the server to deteriorate and possibly fail. The maintenance of the server is provided either as a preventive one or for a complete failure so as to bring back to normal. Under the assumptions of Poisson shocks, exponential services and exponential maintenance with rates depending on the state of the server, and a general (discrete) probability distribution for the intensity of the shocks, the model is analyzed in steady-state. Some interesting theoretical results along with a few illustrative numerical examples are reported. An optimization problem involving various costs is studied numerically.