Skip to main content

Minecraft TCP/UDP to WebSocket bridge with Cloudflare tunnel support

Project description

MineConnect

Minecraft TCP/UDP to WebSocket bridge with Cloudflare tunnel support

Python Version License

A Python module for bridging Minecraft Java and Bedrock connections through WebSocket to Cloudflare tunnels, enabling secure remote access to your local Minecraft servers.

Features

  • 🎮 Dual Support: Both Minecraft Java Edition and Bedrock Edition
  • 🔒 Secure Tunnels: Uses Cloudflare tunnels for encrypted connections
  • 🚀 Simple API: Just a few lines of code to get started
  • ⚙️ Configurable: Customize ports and tunnel modes
  • 📊 Real-time Logs: See connection status and activity
  • 🔧 Easy Setup: One-time tunnel configuration
  • 💻 Client Included: Connect from anywhere with CLI or GUI

Components

Server (Host your Minecraft server)

Run the server-side to bridge your local Minecraft servers to Cloudflare tunnels.

Client (Connect to servers)

Connect to MineConnect servers from anywhere:

  • CLI Mode: Interactive command-line interface
  • Daemon Mode: Run in background
  • Python API: Integrate into your code

Installation

From Source (Development)

cd c:\Projects\MineConnect\server
pip install -e .

From PyPI (Future)

pip install mineconnect

One-Time Setup

Before using MineConnect, run the tunnel setup (requires cloudflared installed):

python -m mineconnect.tunnel_setup

This will:

  1. Authenticate with Cloudflare
  2. Create two tunnels (java and bedrock)
  3. Configure DNS routing
  4. Update configuration files

Usage

Simple API

from mineconnect import mcs

# Use default ports (25565 for Java, 19132 for Bedrock)
session = mcs.config()
session.start()

Custom Ports

from mineconnect import mcs

# Custom Minecraft server ports
session = mcs.config(tcp_port=25566, udp_port=19133)
session.start()

Single Tunnel Mode

from mineconnect import mcs

# Use one tunnel with two ingress rules instead of two separate tunnels
session = mcs.config(tcp_port=25565, udp_port=19132, single_tunnel=True)
session.start()

Full Example

from mineconnect import mcs

def main():
    # Configure server with custom ports
    session = mcs.config(
        tcp_port=25565,      # Minecraft Java Edition port
        udp_port=19132,      # Geyser/Bedrock port
        single_tunnel=False  # Use two separate tunnels
    )
    
    # Start server - blocks and shows logs until Ctrl+C
    try:
        session.start()
    except KeyboardInterrupt:
        print("Server stopped by user")

if __name__ == "__main__":
    main()

Client Usage

Interactive CLI

mineconnect-client

Interactive commands: connect, disconnect, status, quit

Daemon Mode

# Connect both tunnels
mineconnect-client --both

# Connect Java only
mineconnect-client --java

# Custom domain
mineconnect-client --both --domain yourdomain.com

Python API (Client)

from mineconnect.client import MineConnectClient

# Create client
client = MineConnectClient(domain="ideadev.me")

# Connect to server
client.connect_both()  # or connect_java() / connect_bedrock()

# ... play Minecraft on localhost:25565 or localhost:19132 ...

# Disconnect
client.disconnect()

See CLIENT_GUIDE.md for complete client documentation.

Parameters

Server API

mcs.config(tcp_port, udp_port, single_tunnel)

  • tcp_port (int, default: 25565): Port where your Minecraft Java Edition server is running
  • udp_port (int, default: 19132): Port where your Geyser/Bedrock server is running
  • single_tunnel (bool, default: False): Use single tunnel with two ingress rules instead of two separate tunnels

session.start()

Starts all services:

  • TCP WebSocket bridge (port 8764)
  • UDP WebSocket bridge (port 8765)
  • Cloudflared tunnel(s)

Logs are displayed in real-time. Press Ctrl+C to stop all services gracefully.

Prerequisites

  1. Python 3.8+
  2. cloudflared: Install from https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/install-and-setup/installation/
  3. Minecraft Java Server: Running on specified tcp_port (default: localhost:25565)
  4. Geyser (for Bedrock support): Running on specified udp_port (default: localhost:19132)

Architecture

Minecraft Client → Cloudflare Tunnel → WebSocket Bridge → Local MC Server
  • TCP Bridge: Handles Java Edition connections via persistent WebSocket
  • UDP Bridge: Handles Bedrock Edition connections via WebSocket
  • Cloudflared: Creates secure tunnels from Cloudflare edge to local bridges

Troubleshooting

"Cannot start TCP-WS-Bridge" or "Cannot start UDP-WS-Bridge"

Make sure the websockets package is installed:

pip install websockets

"Cannot reach MC" errors

Ensure your Minecraft server is running on the configured port before starting MineConnect.

Cloudflared not found

Install cloudflared and make sure it's in your PATH:

  • Windows: Download from Cloudflare and add to PATH
  • Linux: wget https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64
  • macOS: brew install cloudflared

Development

To modify the package:

  1. Clone the repository
  2. Install in editable mode: pip install -e server/
  3. Make changes to files in server/mineconnect/
  4. Changes take effect immediately

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Author

Priyadarshan Mahankuda (httperry)

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Built with Python and WebSockets
  • Uses Cloudflare tunnels for secure connections
  • Supports both Minecraft Java Edition and Bedrock Edition (via Geyser)

Support

For issues, questions, or contributions, please visit the GitHub repository.

Project details


Download files

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

Source Distribution

mineconnect-1.1.0.tar.gz (23.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mineconnect-1.1.0-py3-none-any.whl (26.5 kB view details)

Uploaded Python 3

File details

Details for the file mineconnect-1.1.0.tar.gz.

File metadata

  • Download URL: mineconnect-1.1.0.tar.gz
  • Upload date:
  • Size: 23.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for mineconnect-1.1.0.tar.gz
Algorithm Hash digest
SHA256 28af75a36f574c22e8ba110e671a101c4b32d3a761300f34e149c4a74a87ad55
MD5 c759ede7e9d64ea172ba7252a0334460
BLAKE2b-256 aef797821ef0a13a774249ebc59f23da4889d3acb82f3cfbfdeb9fc99ac92d61

See more details on using hashes here.

File details

Details for the file mineconnect-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: mineconnect-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 26.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for mineconnect-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c0e97b35877412c60af8630ef8b50d1e60d2dc2c4e921bf7c19132af97e0661d
MD5 a201be496a9d0390bbe5ae2cc3ce086e
BLAKE2b-256 9e91e489a226d1fd14cfa1a40b2aa255a2e11dca57873e5f9c79ca87e4a6bfce

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page