Play Minecraft with an AI companion using Mindcraft
Set up Mindcraft v0.1.4 with Node.js and a DeepSeek API key, configure the bot profile and local connection, open a world to LAN and chat with the agent in game.
Verification
- Test environment
- Unknown
- Tested on
- Unknown
- Last updated
- 2026-11-20
Related models: DeepSeek-V4.1-Flash-1017
Mindcraft connects language models to Minecraft through Mineflayer, so an AI agent can join your world and play alongside you. It can run several agents, but start with one: multi-agent compatibility was less reliable in the author's experience. This guide uses Mindcraft v0.1.4 and the DeepSeek API.
1. What you need
- Minecraft Java Edition in a compatible version (the v0.1.4 README recommends 1.21.6).
- An API key from a supported provider (DeepSeek here). A local model also works (see the Ollama guide on this site), but running Minecraft and a model together needs strong hardware, and small models struggle.
- Node.js and npm. The original used Node 20, which is now end of life; Node.js 22 LTS meets Mineflayer's requirement. The README warns of native-dependency problems on Node 24+.
2. Download and install dependencies
Download the v0.1.4 source ZIP from the GitHub release and extract it. In the folder containing main.js, package.json, andy.json and settings.js, run:
npm install
3. Add your key and choose the model
Copy keys.example.json to keys.json, put your key in DEEPSEEK_API_KEY and leave the other providers empty. Keep this file private. Then set andy.json to:
{
"name": "andy",
"model": "deepseek/deepseek-flash"
}
You can rename the bot, but on official (Microsoft-authenticated) servers the name must be a valid Minecraft profile name, with no Chinese characters.
4. Configure the local connection
In settings.js, update or confirm these entries and keep the rest:
"host": "127.0.0.1",
"port": 55916,
"auth": "offline",
"profiles": ["./andy.json"],
"language": "en",
"allow_insecure_coding": false,
Leave allow_insecure_coding off: enabling it lets the model generate and run code on your computer.
5. Open to LAN and start
Start Minecraft, create a test world, choose Open to LAN with port 55916 (if Minecraft assigns another port, put that in settings.js), then run:
node main.js
The agent joins after a moment, and you can talk to it in game chat.
Tips
languagecan be set tozh-CNand other languages, but messages are machine-translated and can read oddly.max_messagescontrols retained chat history; output limits go in the model'sparamsper the README.- Connection refused? Check LAN is on, ports match and the version is supported. The author found token use fairly modest.
Adapted from the XMLans blog: Play Minecraft with an AI Companion Using Mindcraft (Chinese original: 从零开始教你如何让AI陪你玩我的世界).
Sources
- 从零开始教你如何让AI陪你玩我的世界(星梦博客)www
.xmlans .com (opens in a new tab) · checked 2026-11-20 - Play Minecraft with an AI Companion Using Mindcraft (XMLans blog)en
.xmlans .com (opens in a new tab) · checked 2026-11-20 - Mindcraft v0.1.4 release (GitHub)github
.com (opens in a new tab) · checked 2026-11-20