MCCP - Mud Client Compression Protocol

This implements the MCCP v2 telnet protocol as per http://tintin.sourceforge.net/mccp/. MCCP allows for the server to compress data when sending to supporting clients, reducing bandwidth by 70-90%.. The compression is done using Python’s builtin zlib library. If the client doesn’t support MCCP, server sends uncompressed as normal. Note: On modern hardware you are not likely to notice the effect of MCCP unless you have extremely heavy traffic or sits on a terribly slow connection.

This protocol is implemented by the telnet protocol importing mccp_compress and calling it from its write methods.

evennia.server.portal.mccp.mccp_compress(protocol, data)[source]

Handles zlib compression, if applicable.


data (str) – Incoming data to compress.


stream (binary) – Zlib-compressed data.

class evennia.server.portal.mccp.Mccp(protocol)[source]

Bases: object

Implements the MCCP protocol. Add this to a variable on the telnet protocol to set it up.


initialize MCCP by storing protocol on ourselves and calling the client to see if it supports MCCP. Sets callbacks to start zlib compression in that case.


protocol (Protocol) – The active protocol instance.


Called if client doesn’t support mccp or chooses to turn it off.


option (Option) – Option dict (not used).


The client supports MCCP. Set things up by creating a zlib compression stream.


option (Option) – Option dict (not used).