A stealthy Mineflayer bot that haunts your Minecraft server - simulating human-like movement to prevent AFK kicks.
Named after the Minecraft mob that punishes AFK players. Fight fire with fire.
- Human-like movement - random walking, jumping, sneaking, and head rotation
- Multi-bot support - run multiple bots simultaneously with staggered connections
- Auto-reconnect - automatically reconnects after being kicked or disconnected
- Fully configurable - server address, bot names, and timings via a single
.envfile - Version auto-detect - works with any Minecraft server version supported by Mineflayer
- Graceful shutdown - cleanly disconnects all bots on
Ctrl + C
- Node.js v16 or higher
- A Minecraft server (offline / cracked mode for username-only auth)
git clone https://github.com/mohanadtr/minecraft-bot.git
cd minecraft-botnpm installCopy the example environment file and edit it with your server details:
cp .env.example .envOpen .env and set your values:
SERVER_HOST=your.server.ip
SERVER_PORT=25565
BOT_USERNAMES=Steve,Alex,Notchnpm startYou should see output like:
==================================================
👻 phantom - Minecraft Anti-AFK Bot
==================================================
Server : your.server.ip:25565
Bots : Steve, Alex, Notch
==================================================
[Steve] Connecting to your.server.ip:25565...
[Steve] ✓ Logged in!
[Steve] ✓ Spawned successfully!
All configuration is handled through environment variables (.env file):
| Variable | Default | Description |
|---|---|---|
SERVER_HOST |
localhost |
Minecraft server address |
SERVER_PORT |
25565 |
Minecraft server port |
BOT_USERNAMES |
DragonSlayer77,ShadowNinjaXD,EnderLegend99 |
Comma-separated bot usernames |
RECONNECT_DELAY |
30000 |
Delay before reconnecting (ms) |
CONNECTION_DELAY |
5000 |
Delay between each bot connection (ms) |
Each bot performs a cycle of randomized actions to mimic a real player:
| Action | Frequency | Details |
|---|---|---|
| Walk | Every 3s | Moves in a random direction for 0.5–2s |
| Jump | Every 2s | 30% chance to jump |
| Look around | Every 5s | Rotates head to a random angle |
| Sneak | Every 10s | 10% chance to sneak for 2s |
If a bot is kicked or disconnected, it waits for RECONNECT_DELAY ms and then reconnects automatically.
phantom/
├── index.js # Main bot logic
├── .env.example # Environment variable template
├── .gitignore
├── package.json
├── LICENSE # MIT License
└── README.md
Contributions are welcome! Feel free to:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License.
This tool is intended for personal use on servers you own or have permission to use bots on. Always respect server rules and terms of service. The authors are not responsible for any misuse.