Minecraft MCP Server
A Python MCP server to control a Minecraft server via RCON using FastMCP.
Minecraft-MCP-Server
Python MCP Server to control a Minecraft server via RCON, using FastMCP.
π§ Features
- Exposes a set of commands (dictionary) to contextualize the LLM
- Executes commands on the Minecraft server via RCON
- Integration with Claude Desktop or any MCP client
- Simple structure:
stdio(local development) or HTTP/SSE (production)
π¦ Project Structure
mcp_server/
βββ __pycache__/
βββ .env # Environment variables for Gemini and paths
βββ commands.json # Commands dictionary and examples
βββ mcp_chat_client.py # NEW: Client that listens to @ai messages from chat
βββ server.py # Main MCP server
βββ .gitattributes
βββ .gitignore
βββ readme.md
βββ requirements.txt
βοΈ Installation
- Clone the repository:
cd Minecraft-MCP-Server/mcp_server - Create an environment and install dependencies:
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt
π Setup
In the commands.json file, you will have a list of commands like /give, /weather, /gamemode, etc., with descriptions and examples.
Donβt forget to enable RCON in the Minecraft server.properties file:
enable-rcon=true
rcon.password=minemcp
rcon.port=25575
Create a .env file like this:
MINECRAFT_LOG_PATH=C:\Users\YourUser\Desktop\mineserver\logs\latest.log
MCP_SERVER_PATH=mcp_server/server.py
GEMINI_API_KEY=your_gemini_api_key
π Running the MCP Server
Activate the virtual environment and run:
venv\Scripts\activate python mcp_server/server.py
Monkey patch: starts MCP server in STDIO by default (apidog.com, reddit.com, github.com)
π¬ Running the Chat Client (@ai)
After starting the server, in a new terminal, run the chat client:
venv\Scripts\activate python mcp_server/mcp_chat_client.py
This script monitors the Minecraft server log and listens for player chat messages that start with @ai. It sends the message to the Gemini API and executes the resulting command on the server via MCP.
β οΈ Important: The server must be started before running the client.
Current version has a known memory overflow bug if the client starts before the server.
βοΈ Integration with Claude Desktop
In claude_desktop_config.json (e.g., %APPDATA%\Claude\):
{ "mcpServers": { "minecraft-controller": { "type": "stdio", "command": "/home/qkeq/Documentos/GitHub/Minecraft-MCP-Server/venv/bin/python3", "args": ["C:\...\mcp_server\server.py"], "env": {"PATH": "%PATH%"} } } }
Then restart Claude β the βminecraft-controllerβ server will appear.
π§ͺ Local Test with Python
from fastmcp import Client import asyncio
async def test(): client = Client("mcp_server/server.py") async with client: res = await client.call_tool("run_minecraft_command", {"command": "/list"}) print("Players:", res) cmds = await client.read_resource("minecraft://commands") print("Commands:", list(cmds.keys())[:5])
asyncio.run(test())
π§° How It Works
- π―
FastMCPautomatically loads tools and resources (medium.com, github.com) - Resource
minecraft://commandsprovides the commands dictionary - Tool
run_minecraft_commandusesmcrconto send commands to Minecraft
π References
- [FastMCP v2 β Sample README] (pypi.org)
- [mcrcon β Python RCON client] (pypi.org)
π Next Steps
- Support for HTTP/SSE transport with Docker
- Argument validation/autocomplete via commands dictionary
- Logging extra actions:
/start,/stop,/backup,/whitelist
Ready to make your server smart! π
Related Servers
Scout Monitoring MCP
sponsorPut performance and error data directly in the hands of your AI assistant.
Alpha Vantage MCP Server
sponsorAccess financial market data: realtime & historical stock, ETF, options, forex, crypto, commodities, fundamentals, technical indicators, & more
Tatara MCP Server
An MCP server for interacting with the Tatara blockchain ecosystem. Requires configuration for the Tatara RPC endpoint and a wallet private key.
Vibes
Transforms Claude Desktop into a conversational development environment using distributed MCP servers.
GrowthBook
Create and read feature flags, review experiments, generate flag types, search docs, and interact with GrowthBook's feature flagging and experimentation platform.
Openapi MCP
An MCP server that lets LLMs inspect and interact with OpenAPI specifications.
MCP QEMU VM Control
Give your AI full computer access β safely. Let Claude (or any MCP-compatible LLM) see your screen, move the mouse, type on the keyboard, and run commands β all inside an isolated QEMU virtual machine. Perfect for AI-driven automation, testing, and computer-use experiments without risking your host system.
Zen MCP
An AI-powered server providing access to multiple models for code analysis, problem-solving, and collaborative development with guided workflows.
llm-mcp
A Ruby gem for integrating Large Language Models (LLMs) via the Model Context Protocol (MCP) into development workflows.
MCP Gemini CLI
Integrate with Google Gemini through its command-line interface (CLI).
AvaloniaUI
Tools, resources, and guidance for building cross-platform applications with AvaloniaUI.
EVM MCP Server
Provides blockchain services for over 30 EVM-compatible networks through a unified interface.