mcp-llm-bridge
Updated at 16 days ago
by bartolli
197
on GitHub
MCP implementation that enables communication between MCP servers and OpenAI-compatible LLMs
Tags
What is mcp-llm-bridge
mcp-llm-bridge
is a tool designed to facilitate the creation of Minecraft chat commands powered by Large Language Models (LLMs). It acts as a bridge between a Minecraft server running Minecraft Command Protocol (MCP) and an LLM, enabling players to execute complex tasks and receive dynamic responses within the game using natural language.
How to use
The README provides a detailed guide on setting up and using mcp-llm-bridge
:
- Prerequisites: Ensure you have Python 3.7 or higher installed.
- Install Dependencies: Install the required Python packages using
pip install -r requirements.txt
. - Configure: Configure
mcp-llm-bridge
by setting environment variables for the LLM API key (OPENAI_API_KEY
for OpenAI, for example), the MCP server address, and any other necessary settings. The.env.template
file should be copied to a.env
file, and edited to have the correct API key. - Run: Execute the
main.py
script to start the bridge. - Minecraft Setup: Ensure your Minecraft server has Minecraft Command Protocol enabled, and configure the server address and port in the bridge's configuration.
- Use in-game: Once connected, you can execute commands in-game by prefixing them with
/llm
. For example:/llm build me a small house
.
Key features
- LLM-powered Minecraft Commands: Enables players to execute complex commands using natural language.
- Minecraft Command Protocol (MCP) Integration: Seamlessly integrates with MCP-enabled Minecraft servers.
- Configurable LLM: Supports various LLMs through configuration, by changing the
llm_interface.py
file to use a different interface. - Customizable Prompts: The prompts sent to the LLM are editable, allowing for fine-tuning of command generation.
- Easy Setup: Simple installation and configuration process.
- Asynchronous Operation: Uses asynchronous operations (asyncio) for efficient handling of multiple requests.
Use cases
- Automated Building: Players can instruct the LLM to build structures, landscapes, or other in-game objects.
- Complex Task Automation: Automate repetitive tasks or chain together multiple actions.
- Interactive Storytelling: Generate dynamic narratives and quests based on player input.
- Educational Applications: Create interactive learning environments where players can learn about programming, design, or other subjects.
- Accessibility: Provide an easier, natural language interface for players with disabilities.
FAQ (generate common questions based on the article content)
- What LLMs are supported? The project is initially configured for OpenAI, but you can change
llm_interface.py
to work with other LLMs with a little bit of coding. - How do I enable Minecraft Command Protocol (MCP) on my server? Consult the documentation for your Minecraft server software to learn how to enable and configure MCP.
- How do I configure the LLM's behavior? You can modify the prompts used by the
mcp-llm-bridge
to influence the generated commands. The prompts can be found inmcp_to_llm/mcp_to_llm.py
. - What if the generated command is not what I expected? Experiment with different prompts and phrasing in your in-game commands to improve the results.
- How do I contribute to the project? The project is open source, so you can contribute by submitting pull requests with bug fixes, new features, or improved documentation.