Basic Minecraft Protocol (MCP) Server logo

Basic Minecraft Protocol (MCP) Server

by cs-flytbase

A simple implementation of a Minecraft Protocol server in Python. It implements the basic handshake and status response protocol, allowing Minecraft clients to detect the server in the server list.

View on GitHub

Last updated: N/A

Basic Minecraft Protocol (MCP) Server

A simple implementation of a Minecraft Protocol server in Python. This server implements the basic handshake and status response protocol, allowing Minecraft clients to detect the server in the server list.

Features

  • Basic MCP protocol implementation
  • Handshake packet processing
  • Server status response
  • Simple client disconnect handling
  • Multi-threaded client handling

Requirements

No external dependencies are required for the basic implementation. The server uses standard Python libraries:

  • socket
  • json
  • struct
  • threading
  • time
  • logging

Usage

  1. Clone the repository:

    git clone [email protected]:cs-flytbase/test.git
    cd test
    
  2. Make the script executable (Linux/Mac):

    chmod +x main.py
    
  3. Run the server:

    python main.py
    
  4. The server will start listening on the default Minecraft port (25565).

  5. You can connect to the server using a Minecraft client by adding a server with the address of the machine running the script.

Configuration

You can modify the following variables in the script to customize your server:

  • HOST: The address to bind to (default: '0.0.0.0', all interfaces)
  • PORT: The port to listen on (default: 25565)
  • MAX_PLAYERS: Maximum number of players (default: 20)
  • SERVER_NAME: The name of your server (default: "Basic MCP Server")
  • SERVER_VERSION: Minecraft version (default: "1.19.4")
  • PROTOCOL_VERSION: Protocol version (default: 762 for 1.19.4)

Limitations

This is a very basic implementation and has the following limitations:

  • Only implements the handshake and status response packets
  • Does not handle full login sequence
  • Does not implement gameplay
  • Limited error handling
  • No encryption

Future Enhancements

Future versions could include:

  • Full login sequence
  • Player data handling
  • World data loading/saving
  • Entity management
  • Block interactions
  • Chat system

License

This project is released as open source. Feel free to use and modify it as needed.