Mycroft Holmes: What do you think of MI5 security?
Mary Morstan: I think it would be a good idea.
What Mycroft means is
What do you think of the current level of security at MI5?
Mary understands the question, but she believes that materials at MI5 are not really protected very well. She may even think that the protection from espionage at MI5 is so poor that there's "no security" at all.
The meaning of her reply is:
I think that it would be a good idea for MI5 to set up a security system to protect their documents.
She is being sarcastic with this answer. She subverts the meaning of Mycroft's question in order to express her disdain regarding the abysmal level of security at MI5.
She reframes Mycroft's question as if it meant:
What do you think of the idea of setting up a security system at MI5?
It in her answer means "setting up a security system".