If the message is filtered at the server, it adds a lot of requirements you might not actually want:
1) the server needs to have your contact list, in a form where it can query if user X is in user Y's contacts, in order to do filtering.
1a) If you really meant mutual contacts, the server needs to process contact lists from both parties together. If you are ok with getting a media message from someone who doesn't have you in their contacts but you have them in yours, this one is skipped.
1b) The server needs to know who the message is from and who it is to at the same time.
2) If you're ok with a text message, but not a media message, the server needs to know the difference between text and media messages.
3) I'm not familiar with the details of iMessage, but often messengers use a pattern where a media message is really a link to a media file on some blob server, optionally with some text. If you want the server to remove the link to the file, but allow the text, the server would need to be able to see and process that.
Again, I'm not familiar with how iMessage operates, and some of these may already be aspects of the service, but they're not strict requirements of a messenger service, and the less the server knows about messages and contacts, etc, the more privacy users have from the service.