Skip to content

About

Fabric mod that runs an MCP server inside Minecraft so an agent can see and control your player

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Minecraft MCP

A Fabric client mod that runs an MCP server inside Minecraft, letting an agent see and control your player in singleplayer worlds and on multiplayer servers. There is nothing to configure: install the mod, launch the game, and point your agent at the server.

Note

Written with AI. The code and docs were written by an AI coding agent (Claude Code), with me directing it and testing the result in game. I haven't reviewed the code line by line, so treat it accordingly.

  • Endpoint: http://127.0.0.1:25599/mcp (Streamable HTTP, MCP revision 2026-07-28 only)
  • Requirements: Minecraft 26.3, Fabric Loader 0.19.0 or newer (tested with 0.19.0 and 0.20.0), and Java 25. Fabric API is not needed.

Setup

  1. Build the mod with ./gradlew build (requires JDK 25) and copy build/libs/minecraft-mcp-<version>.jar into your instance's mods folder.

  2. Add the server to your agent. For example, in Claude Code:

    claude mcp add --transport http minecraft http://127.0.0.1:25599/mcp
  3. Start the game and open a singleplayer world or join a server.

Permissions at a glance

  • Without cheats or operator rights: Everything works except get_mob_brain and update_blocks, and run_command is limited to standard player commands.
  • With cheats (Allow Commands) or operator rights: Unlocks full run_command access and update_blocks.
  • Singleplayer with cheats only: Unlocks get_mob_brain (mob AI exists only on the server) and provides exact server-side data for get_blocks and watch_blocks. Everything except get_mob_brain works on multiplayer servers.

Tools

Tool What it does
get_status Returns a text summary of the game state: open screen, position, facing, targeted block or entity, health, inventory, available commands, and recent chat.
get_blocks Lists loaded blocks in a box (up to 4,096 positions), including which sides redstone components work with and which blocks are powered. Power states are exact in singleplayer with cheats; otherwise they come from client state, which misses comparator output.
get_surface Maps the surface of an area from above (up to 4,096 columns; 25×25 around the player by default), showing the height and type of each column's top block while skipping plants and leaves.
get_entities Lists entities near the player, nearest first, with their UUIDs.
get_mob_brain Inspects a mob's AI: its target and path, plus either its brain (activities, running behaviors, memories) or its prioritized goals (marking active ones). Accepts a UUID or entity type, or inspects the mob the player is looking at. Singleplayer with cheats only (mob AI runs only on the server).
screenshot Captures the game window as an image. Hides the HUD by default unless requested; open menus are always shown.
run_command Runs a command—or a batch of up to 256 (in a single game tick in singleplayer with cheats)—as the player and returns the output once changes appear in game. Can optionally watch a box like watch_blocks to capture what the commands trigger. Runs whatever commands the player is allowed to run.
use_block Aims at a block by coordinates and right-clicks it like a player, failing with a reason if it is out of reach or hidden. Can optionally watch a box like watch_blocks to capture what the click triggers.
input Runs a sequence of keyboard and mouse actions—key presses/holds, clicks, cursor moves, scrolling, typing, look/look_at/look_at_block, and waits—one step per game tick.
update_blocks Makes blocks in a box react to their surroundings, which blocks placed by /setblock and /fill do not do on their own. Requires cheats in singleplayer, or operator rights on a server (where it works via /fill).
watch_blocks Records every block change in a box over a number of ticks, tick by tick and in order (for example, to see what a redstone circuit does). Exact on the server in singleplayer with cheats; otherwise recorded from client updates.

Runtime behavior

  • Background input: Input goes directly to Minecraft's input handlers, so it works while the game window is in the background. For screenshots, however, the window must not be minimized.
  • No pausing: The game never pauses—not when its window loses focus, and not while a menu is open (opening the pause menu still saves the world). Run this mod in a separate Minecraft instance for the agent, not your own play instance.
  • Held-key release: Any keys the agent leaves held down are released automatically after 5 minutes without a tool call.
  • Chat echo: Commands run by the agent appear in chat as [MCP] /command, followed by their output, unless the sendCommandFeedback game rule is off.
  • Single instance only: Only one Minecraft instance can run the MCP server at a time; a second instance fails to start with a port-in-use error (25599).

Multiplayer

Multiplayer support is newer and has had far less real-world testing than singleplayer: so far only against local vanilla and Paper 26.3 servers, both as an operator and not. Expect rough edges.

  • Commands run through chat: Commands are sent as if typed in chat, so the server treats them like any player's. Other operators see them in chat and logs, and command output is read from the feedback the server sends to chat.
  • Chat must not be hidden: If chat is set to Hidden in Minecraft's options, the server sends no command output.
  • Operator vs. non-operator execution:
    • Operators: Each command is followed by a /tellraw to your player to mark where its output ends. The marker itself is kept out of chat.
    • Non-operators: Vanilla servers kick players who aren't in the op list for sending a 10th command within 10 seconds. Without operator rights, commands therefore run one at a time, spaced a second apart, with at most 8 per call.
    • Permissions plugins: A server that grants operator commands through a permissions plugin rather than its op list may still kick for operator-style batches.
  • No stealth: Nothing is done to hide any of this from servers or anti-cheat plugins.

Security

There is no authentication. The server listens only on 127.0.0.1 and refuses requests from web pages on other sites, so remote websites cannot reach it. However, any program running on your machine can control the game and, with cheats or operator rights enabled, run any command.

Prior art and design choices

  • yuniko-software/minecraft-mcp-server — a Node MCP server that joins a LAN-opened world as a separate bot player via Mineflayer, with one tool per bot action.
  • denfry/mcpfabric — a Fabric and NeoForge mod with 50+ tools across many Minecraft versions (including dedicated servers), accessed through a separate Node MCP server and a bearer token.

This mod makes different decisions:

  • Few, general tools. Coding agents do well with little more than a shell, so this server exposes Minecraft's own general interfaces instead of a tool per action: commands, keyboard and mouse input, screenshots, and fast read-only views of the world. Anything a player can do is in reach without a dedicated tool.
  • Nothing to set up. One jar in the mods folder—no Fabric API, Node, config file, bearer token, or opening worlds to LAN. The agent plays as you rather than joining as a separate bot, in your singleplayer worlds and on the servers you play on, with your permissions.
  • The latest MCP revision only. It is a stateless server for MCP 2026-07-28 over Streamable HTTP, with no sessions to keep alive. Supporting only the latest revision is intentional to keep things as simple as possible. You are welcome to maintain your own fork if you require support for older MCP revisions. Let's also hope that harnesses stuck on the old revisions get with the times sooner rather than later.

Development

# Start a development client with an offline account
./gradlew runClient

# Jump straight into a singleplayer world
./gradlew runClient --args="--quickPlaySingleplayer '<world folder>'"

# Join a local server (run the server with online-mode=false for the offline account)
./gradlew runClient --args="--quickPlayMultiplayer 127.0.0.1:25565"

License

MIT

About

Fabric mod that runs an MCP server inside Minecraft so an agent can see and control your player

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages