Minecraft MCP सर्वर
Minecraft सर्वर प्रबंधन RCON के माध्यम से। आसान कमांड निष्पादन के लिए FastMCP का एकीकरण, Claude Desktop और अन्य MCP क्लाइंट के साथ बातचीत का समर्थन करता है, और स्थानीय विकास और उत्पादन उपयोग के लिए एक लचीला आर्किटेक्चर प्रदान करता है।
सारांश
Minecraft-MCP-Server
एक Python MCP सर्वर जो RCON के माध्यम से Minecraft सर्वर को नियंत्रित करने के लिए डिज़ाइन किया गया है, जो FastMCP का उपयोग करके निर्बाध एकीकरण और कमांड निष्पादन करता है।
🔧 विशेषताएँ
- कमांड शब्दकोश: Minecraft सर्वर के साथ बातचीत को बढ़ाने के लिए कमांड का एक व्यापक सेट प्रदान करता है।
- RCON निष्पादन: वास्तविक समय नियंत्रण के लिए Minecraft सर्वर पर सीधे कमांड निष्पादित करता है।
- क्लाइंट एकीकरण: प्रबंधन के लिए Claude Desktop या किसी भी MCP क्लाइंट के साथ संगत।
- लचीला ढांचा:
stdio
के माध्यम से स्थानीय विकास और HTTP/SSE के माध्यम से उत्पादन वातावरण का समर्थन करता है।
📦 परियोजना संरचना
mcp_server/
├── commands.json # उपयोग के लिए कमांड और उदाहरणों को शामिल करता है
├── server.py # MCP के लिए मुख्य सर्वर स्क्रिप्ट
├── commands.json # संदर्भ समझ के लिए Minecraft कमांड
└── (venv/) # निर्भरताओं के लिए वैकल्पिक वर्चुअल वातावरण
⚙️ स्थापना
-
रिपॉजिटरी क्लोन करें:
cd Minecraft-MCP-Server/mcp_server
-
वातावरण सेट करें और निर्भरताएँ स्थापित करें:
python -m venv venv venv\Scripts\activate pip install mcp[cli] mcrcon
📝 सेटअप
commands.json
फ़ाइल में, आप /give
, /weather
, और /gamemode
जैसे विभिन्न कमांड पाएंगे, जिनमें विवरण और उपयोग के उदाहरण शामिल हैं।
सुनिश्चित करें कि आपके Minecraft server.properties
फ़ाइल में RCON सक्षम है:
enable-rcon=true
rcon.password=minemcp
rcon.port=25575
🚀 सर्वर चलाना
सर्वर शुरू करने के लिए, वर्चुअल वातावरण सक्रिय करें और निष्पादित करें:
venv\Scripts\activate
python server.py
डिफ़ॉल्ट रूप से, MCP सर्वर STDIO मोड में शुरू होता है।
⚙️ Claude Desktop के साथ एकीकरण
Claude Desktop के साथ एकीकृत करने के लिए, claude_desktop_config.json
फ़ाइल में संशोधन करें (जो %APPDATA%\Claude\
में स्थित है):
{
"mcpServers": {
"minecraft-controller": {
"type": "stdio",
"command": "C:\\...\\venv\\Scripts\\python.exe",
"args": ["C:\\...\\mcp_server\\server.py"],
"env": {"PATH": "%PATH%"}
}
}
}
‘minecraft-controller’ सर्वर को सूचीबद्ध करने के लिए Claude को पुनः प्रारंभ करें।
🧪 स्थानीय परीक्षण Python के साथ
आप निम्नलिखित 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("खिलाड़ी:", res)
cmds = await client.read_resource("minecraft://commands")
print("कमांड:", list(cmds.keys())[:5])
asyncio.run(test())
🧰 यह कैसे काम करता है
- FastMCP कार्यक्षमता: कुशल कमांड हैंडलिंग के लिए उपकरणों और संसाधनों को स्वचालित रूप से लोड करता है।
- कमांड संसाधन: संसाधन
minecraft://commands
उपलब्ध कमांड का एक शब्दकोश प्रदान करता है। - कमांड निष्पादन: उपकरण
run_minecraft_command
Minecraft सर्वर पर कमांड भेजने के लिएmcrcon
का उपयोग करता है।
📚 संदर्भ
🛠 अगले कदम
- Docker का उपयोग करके HTTP/SSE परिवहन के लिए समर्थन लागू करें।
- कमांड शब्दकोश के माध्यम से तर्क मान्यता और ऑटो-कंप्लीट सुविधाओं में सुधार करें।
/start
,/stop
,/backup
, और/whitelist
जैसे अतिरिक्त क्रियाओं के लिए लॉगिंग जोड़ें।
अपने Minecraft सर्वर के अनुभव को बढ़ाने के लिए तैयार हो जाएँ! 🚀
विवरण
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/
├── commands.json # Commands dictionary and examples
├── server.py # Main MCP server
├── commands.json # Minecraft commands for context
└── (venv/) # Virtual environment (optional)
⚙️ 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 mcp[cli] mcrcon
📝 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
🚀 Running
Activate the virtual environment and run:
venv\Scripts\activate
python server.py
Monkey patch: starts MCP server in STDIO by default (apidog.com, reddit.com, github.com)
⚙️ Integration with Claude Desktop
In claude_desktop_config.json
(e.g., %APPDATA%\Claude\
):
{
"mcpServers": {
"minecraft-controller": {
"type": "stdio",
"command": "C:\\...\\venv\\Scripts\\python.exe",
"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
- 🎯
FastMCP
automatically loads tools and resources (medium.com, github.com) - Resource
minecraft://commands
provides the commands dictionary - Tool
run_minecraft_command
usesmcrcon
to send commands to Minecraft
📚 References
🛠 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! 🚀
सर्वर कॉन्फ़िगरेशन
{
"mcpServers": {
"minecraft-controller": {
"type": "stdio",
"command": "C:\\...\\venv\\Scripts\\python.exe",
"args": [
"C:\\...\\mcp_server\\server.py"
],
"env": {
"PATH": "%PATH%"
}
}
}
}