Docs menu

Getting started

Today the bot runs from its source code, in a terminal. A one-click app is planned. Until then, this page is the whole setup.

What you need

  • Bun 1.3 or later. Bun runs the bot and reads its settings file. Node.js is not needed.
  • A Minecraft Java Edition server, version 1.8 to 26.1. A world opened to LAN from your own game works too.
  • An OpenAI API key. The bot asks OpenAI's model what to do with your chat messages and to plan its days. This costs money; you set the monthly cap.
  • Your Minecraft username. The bot obeys one player only.

Install

  1. Get the code:
git clone https://github.com/TravnikovDev/Minecraft-GPT.git
cd Minecraft-GPT
  1. Install what it depends on:
bun install
  1. Make your settings file from the example:
cp .env.example .env
  1. Open .env and fill in at least your OpenAI key and your Minecraft username:
OPENAI_API_KEY=your_openai_api_key
OWNER_USERNAME=YourMinecraftName
BOT_USERNAME=MinecraftGPT
SERVER_HOST=localhost
SERVER_PORT=25565
AUTH=offline

Start it

With your server running:

bun run src/index.ts

The bot joins the game, greets you, and waits 30 seconds for an order. With none, it starts living its own life. Say "stay with me" in chat if you'd rather it only did what you ask. Talking to the bot has the rest.

If a setting is missing or wrong, the bot stops at once with a message that names it.

Settings

All settings live in the .env file.

SettingWhat it isIf you leave it out
OPENAI_API_KEYYour OpenAI API key.Required
OWNER_USERNAMEYour Minecraft username. The only player whose chat the bot obeys.Required
BOT_USERNAMEThe bot's name in the game.MinecraftGPT
SERVER_HOSTThe server's address.localhost
SERVER_PORTThe server's port. Minecraft's usual port is 25565; a LAN world shows its own when you open it.Set it
AUTHoffline for servers with online-mode=false, microsoft to log in with a real Minecraft account.offline
LLM_MONTHLY_CAP_USDThe most the bot may spend on the AI model in a month, in US dollars. Past it, it makes no more model calls until next month.10
SERVER_AUTOMATIONforbidden on servers that don't allow bots to act on their own: no own life and no jobs, only your commands.allowed
SERVER_CHAT_SPACING_MSMilliseconds between the bot's chat lines, for servers that kick fast talkers.1200

Which login mode

  • AUTH=offline: the bot joins under BOT_USERNAME with no account. The server must run with online-mode=false. This is the simple choice for a private server or a LAN world.
  • AUTH=microsoft: the bot logs in with a real Minecraft account, which it needs its own copy of the game for. The first start gives you a code to enter on Microsoft's sign-in page.

Read your server's rules before bringing a bot. Many public servers don't allow them.

Why OpenAI only

Every command is given to the model as a tool with a strict description of its arguments, so what the model sends back always fits. OpenAI's models enforce that. Other providers don't do so reliably yet, so the bot doesn't support them.