MCP HubMCP Hub
yuniko-software

minecraft-mcp-server

by: yuniko-software

A Minecraft MCP Server powered by Mineflayer API. It allows to control a Minecraft character in real-time, allowing AI assistants to build structures, explore the world, and interact with the game environment through natural language instruction

39created 20/03/2025
Visit
Mineflayer
AI

📌Overview

Purpose: The Minecraft MCP Server enables interaction between large language models, like Claude, and Minecraft, allowing users to control in-game characters through commands processed via the Model Context Protocol.

Overview: This bot, leveraging the Mineflayer API, integrates AI-driven capabilities into the Minecraft environment. Users can command the bot to perform various tasks within the game, enhancing gameplay with AI interaction.

Key Features:

  • AI Bot Control: The bot can execute commands sent via Claude Desktop, enabling users to interact with Minecraft through natural language, enhancing user experience with AI assistance.

  • Comprehensive Command Set: Includes movements, inventory management, block interaction, and entity communication, giving extensive control over gameplay actions.

  • Image-Based Building: Users can upload images for the bot to replicate structures in Minecraft, demonstrating the AI's application in creative and user-driven building tasks.


Minecraft MCP Server

⚠️ IMPORTANT COMPATIBILITY WARNING: As of March 25, 2025, Minecraft 1.21.5 was just released. This bot is currently NOT compatible with Minecraft 1.21.5. Please use Minecraft 1.21.4 until an update with 1.21.5 support is released.

A Minecraft bot powered by large language models and the Mineflayer API. This bot uses the Model Context Protocol (MCP) to enable Claude and other supported models to control a Minecraft character.

Prerequisites

  • Node.js
  • A running Minecraft game (tested with Minecraft 1.21.4 Java Edition included in Microsoft Game Pass)
  • Claude Desktop

Getting Started

This bot is designed to be used with Claude Desktop through the Model Context Protocol (MCP).

Run Minecraft

Create a singleplayer world and open it to LAN (ESC -> Open to LAN). The bot will try to connect using port 25565 and hostname localhost. These parameters can be configured in claude_desktop_config.json in a later step.

MCP Configuration

Make sure that Claude Desktop is installed. Open File -> Settings -> Developer -> Edit Config. It should open the installation directory. Find the file claude_desktop_config.json and insert the following code:

{
  "mcpServers": {
    "minecraft": {
      "command": "npx",
      "args": [
        "-y",
        "github:yuniko-software/minecraft-mcp-server",
        "--host",
        "localhost",
        "--port",
        "25565",
        "--username",
        "ClaudeBot"
      ]
    }
  }
}

Double-check that the --port and --host parameters are correct. Completely reboot the Claude Desktop application (close it in the OS tray).

Running the Bot

Make sure the Minecraft game is running and the world is opened to LAN. Then start the Claude Desktop application; the bot should join the game.

It may take some time for Claude Desktop to boot the MCP server. The indicator that the server has booted successfully is a hammer icon that appears next to the chat.

You can give the bot commands through any active Claude Desktop chat. You can also upload images of buildings and ask the bot to build them.

Remember to mention that the bot should perform an action in Minecraft in your prompt, as this triggers the MCP server. It will then ask for your permission.

Using Claude 3.7 Sonnet may produce interesting results, making the bot-agent more intelligent.

Example usage: https://claude.ai/share/535d5f69-f102-4cdb-9801-f74ea5709c0b

Available Commands

Once connected to a Minecraft server, Claude can use these commands:

Movement

  • get-position - Get the current position of the bot
  • move-to-position - Move to specific coordinates
  • look-at - Make the bot look at specific coordinates
  • jump - Make the bot jump
  • move-in-direction - Move in a specific direction for a duration

Inventory

  • list-inventory - List all items in the bot's inventory
  • find-item - Find a specific item in inventory
  • equip-item - Equip a specific item

Block Interaction

  • place-block - Place a block at specified coordinates
  • dig-block - Dig a block at specified coordinates
  • get-block-info - Get information about a block
  • find-block - Find the nearest block of a specific type

Entity Interaction

  • find-entity - Find the nearest entity of a specific type

Communication

  • send-chat - Send a chat message in-game

Contributing

This application was made in just two days, and the code is simple and straightforward. Contributions including refactoring, new features, tests, error handling, and documentation are greatly appreciated!

Feel free to submit pull requests or open issues for improvements. Some areas for enhancement include:

  • Additional documentation
  • More robust error handling
  • Tests for different components
  • New functionality and commands