A child-friendly Minecraft Bedrock AI Admin Bot that connects to Bedrock Dedicated Servers using GeyserMC and Floodgate. The bot uses Google's Gemini AI with a comprehensive Minecraft knowledge base to interpret natural language commands safely and accurately.
This bot now features a revolutionary knowledge-based AI system that:
- โ Prevents AI hallucinations by grounding all responses in actual Minecraft data
- ๐ง Uses comprehensive Minecraft knowledge base with all items, blocks, and commands
- ๐ฏ Pre-defined prompt translation that converts kid's messages into structured AI prompts
- ๐ถ Child-friendly language designed specifically for young players
- ๐ก๏ธ Enhanced safety with content filtering and positive reinforcement
- Knowledge-Grounded: AI responses based on actual Minecraft Bedrock data
- Child-Safe Prompting: Specially designed prompts for kids aged 6-12
- Extended Thinking: Multi-step AI reasoning for better command interpretation
- Safety-First: Redirects inappropriate requests to fun alternatives
- "Give me diamonds!" โ
/give @p diamond 5 - "Build me a castle!" โ Generates appropriate build commands
- "Make it daytime!" โ
/time set day - "I'm hungry!" โ
/give @p bread 10
- Load custom
.mcstructurefiles - Natural language matching ("bear" finds bear_habitat.mcstructure)
- Position-aware building near requesting player
- Admin permission system with configurable user lists
- Command sanitization and validation
- Build size limits to prevent griefing
- Blocked dangerous commands (op, ban, kick, etc.)
ai-admin-bot-github/
โโโ mineflayer-bot/
โ โโโ index.js # Main bot with child-friendly responses
โ โโโ commands.js # Legacy command handlers (being phased out)
โ โโโ config.js # Configuration and security settings
โ โโโ minecraft-knowledge.js # ๐ Comprehensive Minecraft knowledge base
โ โโโ prompt-translator.js # ๐ Kid-to-AI prompt translation system
โโโ structures/
โ โโโ README.md # Structure file documentation
โ โโโ *.mcstructure # Custom structure files
โโโ .env.example # Environment configuration template
โโโ package.json # Dependencies and scripts
โโโ Dockerfile # Container deployment
Contains comprehensive data about:
- Items: All tools, blocks, food, weapons (400+ items)
- Commands: Valid Bedrock commands with syntax
- Entities: Mobs, animals, NPCs
- Validation: Functions to check if items/commands exist
- Aliases: Natural language mappings ("food" โ bread, apple, etc.)
Converts kid messages through structured thinking:
Kid says: "I want a sword!"
โ
Prompt Translator creates structured prompt with:
- Child-safe context
- Minecraft knowledge base
- Safety guidelines
- Example responses
โ
Gemini AI processes with full context
โ
Returns: "/give @p diamond_sword 1" + encouraging message- Content filtering for inappropriate requests
- Positive reinforcement instead of saying "no"
- Educational responses that teach Minecraft concepts
- Fallback suggestions when requests aren't possible
Copy .env.example to .env and configure:
# Server Connection
MINECRAFT_HOST=your-server-ip
MINECRAFT_PORT=19132
MINECRAFT_USERNAME=AI_Admin
MINECRAFT_VERSION=1.20.0
# AI Configuration
GEMINI_API_KEY=your-gemini-api-key
# Bot Settings
BOT_DEBUG=false
COMMAND_COOLDOWN=3000
ADMIN_USERS=admin1,admin2
# Child Safety
CHILD_SAFE_MODE=true
MAX_BUILD_SIZE=100npm installPlace .mcstructure files in the structures/ directory:
structures/
โโโ bear_habitat.mcstructure
โโโ castle.mcstructure
โโโ playground.mcstructure
# Production
npm start
# Development (with auto-restart)
npm run dev- "@admin give me diamonds!"
- "@admin I'm hungry, can I have food?"
- "@admin build me a cool house!"
- "@admin make it sunny!"
- "@admin can you come here?"
- "@admin help me!"
- "๐ Here are some shiny diamonds for you! Have fun building!"
- "๐ I got you some yummy food! Enjoy your meal!"
- "๐ Building you an awesome house! This is going to be so cool!"
- Message Detection: Checks for @admin mentions
- Command Categorization: Identifies request type (build, give, etc.)
- Knowledge Lookup: Validates against Minecraft database
- Prompt Translation: Converts to structured AI prompt
- Gemini Processing: AI generates response with full context
- Safety Validation: Ensures command is safe and appropriate
- Execution: Runs command and sends child-friendly response
- Input Sanitization: Cleans and validates all user input
- Command Whitelist: Only allows safe Minecraft commands
- Admin Permissions: Restricts dangerous commands to admins
- Content Filtering: Blocks inappropriate content
- Build Limits: Prevents large griefing builds
Based on research from projects like GabbyGarden and Microsoft's Interactive NPCs:
- Encouraging Language: Always positive, never says "no"
- Simple Vocabulary: Uses words kids understand
- Emoji Communication: Makes responses fun and engaging
- Educational Value: Teaches Minecraft concepts naturally
- Safety First: Redirects inappropriate requests to fun alternatives
- Patience: Handles repeated questions kindly
# Build container
docker build -t minecraft-ai-bot .
# Run with environment file
docker run --env-file .env minecraft-ai-bot- Set
BOT_DEBUG=falsefor cleaner logs - Configure
ADMIN_USERSwith actual admin usernames - Set appropriate
COMMAND_COOLDOWNto prevent spam - Enable
CHILD_SAFE_MODE=truefor kid-friendly operation
- โ Complete knowledge-based AI system
- โ Child-friendly prompt engineering
- โ Comprehensive Minecraft database
- โ Enhanced safety and content filtering
- โ Structured prompt translation
- โ Extended AI reasoning capabilities
To add new features:
- Knowledge Base: Update
minecraft-knowledge.jswith new items/commands - Prompts: Enhance
prompt-translator.jswith better child-friendly prompts - Safety: Add new safety checks in
config.js
This project is designed for educational and family use. Please ensure compliance with Minecraft's Terms of Service and your server's rules.
๐ฎ Built with โค๏ธ for young Minecraft players and their families!