I doubt they have ever had the means to set themselves out militarily so surely it's some kind of economic quid pro quo with France or something? No idea, please enlighten me.
Not to discourage other answers, but here is the FAQ on why European microstates are still around.
However, there hasn't really been an indepth answer on Monaco specifically, so hopefully someone will add to this.