Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

A client for handling Remote Commands (RCON) to a Minecraft server.

Project description

This library provides a straightforward implementation of Minecraft’s Rcon protocol in Python to provide a client for handling Remote Commands (RCON) to a Minecraft server.


The library is availble on PYPI and can be installed with pip:

pip install mcrcon


The recommend way to run this client is using the python ‘with’ statement. This ensures that the socket is correctly closed when you are done with it rather than being left open.


In [1]: from mcrcon import MCRcon
In [2]: with MCRcon("", "sekret") as mcr:
   ...:     resp = mcr.command("/whitelist add bob")
   ...:     print(resp)

While you can use it without the ‘with’ statement, you have to connect manually, and ideally disconnect:

In [3]: mcr = MCRcon("", "sekret")
In [4]: mcr.connect()
In [5]: resp = mcr.command("/whitelist add bob")
In [6]: print(resp)
In [7]: mcr.disconnect()

Command Line Usage

After installing the package a cli will be included that can be used.

Help can be gotten by doing:

mcrcon --help

You can connect from the console with commands like the following:


You will either be prompted for your password, or you can set it as follows as an environment variable:

export RCON_PASSWORD=sekret

And then you can run commands on the server interactively:

> /whitelist add bob

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for mcrcon, version 0.6.0
Filename, size File type Python version Upload date Hashes
Filename, size mcrcon-0.6.0.tar.gz (3.6 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page