Minecraft MCP Server

Minecraft MCP Server

A client library that connects AI agents to Minecraft servers, providing full game control with 30 verified skills for common tasks including movement, combat, crafting, and building.

Category
访问服务器

README

Fundamental Labs/Minecraft Client

This library is the Client library for a Minecraft Game Skills and MCP Integration.

Fairies MCP Client (https://fairies.ai/) also supports direct connection with a single click.

Features

  • Full Minecraft Control: Connect AI agents to Minecraft servers and control bots
  • 30 Verified Skills: Pre-built, tested skills for common Minecraft tasks
  • Flexible Connection: Connect to any Minecraft server with optional per-bot configuration
  • Multi-Bot Support: Manage multiple bots simultaneously
  • MCP Standard: Compatible with any MCP client (Claude Desktop, etc.)

Installation

Direct call via npx (Recommended)

npx --y -- @fundamentallabs/minecraft-mcp

Via npm (Recommended)

npm install -g @fundamentallabs/minecraft-mcp

From Source

git clone https://github.com/FundamentalLabs/minecraft-mcp.git
cd minecraft-mcp/minecraft-client/mcp-server
npm install
npm run build

Usage

Starting the Server

You can start the MCP server with optional default connection settings:

# Start with no defaults (connection specified per bot)
minecraft-mcp

# Start with default connection settings
minecraft-mcp -h play.example.com -p 25565

Command Line Options

Options:
  -p, --port <port>  Minecraft server port (default: 25565)
  -h, --host <host>  Minecraft server host (default: localhost)
  --help            Display help

Integration with Claude Desktop or JSON configurations Locally

Add to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

For remote installation (recommended)

{
  "mcpServers": {
    "minecraft": {
      "command": "npx",
      "args": ["-y", "-- @fundamentallabs/minecraft-mcp"]
    }
  }
}

If running locally from source:

{
  "mcpServers": {
    "minecraft": {
      "command": "node",
      "args": ["/path/to/minecraft-mcp/minecraft-client/mcp-server/dist/mcp-server.js"]
    }
  }
}

Replace /path/to/minecraft-mcp with the actual path where you cloned the repository.

Integration with Other MCP Clients

The server uses stdio transport and can be integrated with any MCP client:

# Using the MCP inspector for testing
cd minecraft-client/mcp-server
npx @modelcontextprotocol/inspector node dist/mcp-server.js -- -p 25565

Available Skills

Bot Management

  • joinGame - Spawn a new bot into the Minecraft game

    • username (required): Bot's username
    • host (optional): Server host (defaults to 'localhost' or command line option)
    • port (optional): Server port (defaults to 25565 or command line option)
  • leaveGame - Disconnect bot(s) from the game

    • username (optional): Specific bot to disconnect
    • disconnectAll (optional): Disconnect all bots if true

Movement & Navigation

  • goToSomeone - Navigate to another player
  • goToKnownLocation - Navigate to specific coordinates
  • runAway - Run away from threats
  • swimToLand - Swim to nearest land when in water

Combat & Hunting

  • attackSomeone - Attack players, mobs, or animals
  • hunt - Hunt animals or mobs

Resource Gathering

  • mineResource - Mine specific blocks or resources
  • harvestMatureCrops - Harvest mature crops from farmland
  • pickupItem - Pick up items from the ground

Crafting & Smelting

  • craftItems - Craft items using a crafting table
  • cookItem - Cook items in a furnace
  • smeltItem - Smelt items in a furnace
  • retrieveItemsFromNearbyFurnace - Get smelted items from furnace

Inventory Management

  • openInventory - Open the bot's inventory
  • equipItem - Equip armor, tools, or weapons
  • dropItem - Drop items from inventory
  • giveItemToSomeone - Give items to another player

Building & Farming

  • placeItemNearYou - Place blocks near the bot
  • prepareLandForFarming - Prepare land for farming
  • useItemOnBlockOrEntity - Use items on blocks or entities

Survival

  • eatFood - Eat food to restore hunger
  • rest - Rest to regain health
  • sleepInNearbyBed - Find and sleep in a bed

Storage

  • openNearbyChest - Open a nearby chest

Fun

  • dance - Make the bot dance

Vision

  • lookAround - Look around and observe the environment

Communication

  • readChat - Read recent chat messages from the server
  • sendChat - Send chat messages or commands to the server

Building

  • buildSomething - Build structures using Minecraft commands (requires cheats/operator permissions). Supports both static command arrays and dynamic JavaScript code.
  • buildPixelArt - Build pixel art from an image in Minecraft (requires cheats/operator permissions). Converts an image to pixel art using colored blocks. Maximum size is 256x256 blocks.

API Example

When integrated with an MCP client, you can control the bot like this:

// First, spawn a bot
await client.callTool('joinGame', { username: 'MyBot' });

// Make the bot mine some wood
await client.callTool('mineResource', { name: 'oak_log', count: 10 });

// Craft wooden planks
await client.callTool('craftItems', { item: 'oak_planks', count: 40 });

// Navigate to coordinates
await client.callTool('goToKnownLocation', { x: 100, y: 64, z: 200 });

// Build a structure using commands (requires cheats) - Script mode
await client.callTool('buildSomething', {
  buildScript: [
    { command: "fill", x1: 0, y1: 64, z1: 0, x2: 10, y2: 64, z2: 10, block: "stone" },
    { command: "fill", x1: 1, y1: 65, z1: 1, x2: 9, y2: 68, z2: 9, block: "oak_planks" },
    { command: "setblock", x: 5, y: 65, z: 1, block: "oak_door" }
  ]
});

// Build dynamically with JavaScript (requires cheats) - Code mode
await client.callTool('buildSomething', {
  code: `
    // Build a pyramid centered on the bot
    const size = 10;
    for (let y = 0; y < size; y++) {
      const level = size - y;
      fill(pos.x - level, pos.y + y, pos.z - level,
           pos.x + level, pos.y + y, pos.z + level, 'sandstone');
      await wait(5); // Small delay between levels
    }
    log('Pyramid complete!');
  `
});

// Build pixel art from an image (requires cheats)
await client.callTool('buildPixelArt', {
  imagePath: 'https://example.com/logo.png',
  width: 64,
  height: 64,
  x: 0,
  y: 80,
  z: 100,
  facing: 'north'
});

// Read recent chat messages
await client.callTool('readChat', {
  count: 30,
  timeLimit: 300,  // Last 5 minutes
  filterType: 'chat'  // Only player messages
});

// Send a chat message
await client.callTool('sendChat', {
  message: 'Hello everyone! I am a bot.'
});

// Send a command
await client.callTool('sendChat', {
  message: '/time set day'
});

// Send a whisper
await client.callTool('sendChat', {
  message: '/msg Steve I can help you build!',
  delay: 1000  // Wait 1 second before sending
});

Architecture

The MCP server:

  • Uses stdio transport for communication with AI clients
  • Dynamically loads skills from the verified skills directory
  • Manages multiple bot instances (currently uses the first bot for all operations)
  • Provides a unified interface for all bot actions

Requirements

  • Node.js >= 18.0.0
  • A Minecraft server (Java Edition) to connect to
  • An MCP-compatible client (like Claude Desktop)

Troubleshooting

"Skill implementation not found" Error

The MCP server needs to be run from the cloned repository with built skills. Make sure you:

  1. Cloned the full repository
  2. Ran npm install in the minecraft-client directory
  3. Ran npm run build in the minecraft-client directory
  4. Are running the MCP server from the correct directory

Bot won't connect

  • Ensure your Minecraft server is running and accessible
  • Check that the port and host are correct
  • Verify the server allows the Minecraft version the bot uses

Skills not working

  • Make sure the bot has spawned successfully before using skills
  • Some skills require specific items or conditions
  • Check the bot's console output for error messages

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT - see LICENSE file for details

Support

For issues and feature requests, please use the GitHub issue tracker.

Testing

To test with the Anthropic MPC inspector

'npx @modelcontextprotocol/inspector node ./dist/mcp-server.js'

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选