Get the FREE Ultimate OpenClaw Setup Guide →

Godot -for-local-LLM

A sleek C# class library designed to integrate a local Model Context Protocol (MCP) server with a local Large Language Model (LLM), tailored for Godot-based games. This library empowers your LLM to seamlessly interact with the game world through structured tool commands, bringing your Echoes of Ir-style vision to life.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio viktorfaubl-godot-mcp-server-for-local-llm dotnet run --project GodotMCPServer.csproj \
  --env MCP_SERVER_PORT="Optional: specify port if needed" \
  --env DOTNET_ENVIRONMENT="Development"

How to use

This MCP server provides a C#-based integration layer that connects a local LLM to a Godot game via the Model Context Protocol (MCP). It exposes two primary components: MCPHandler, which routes tool commands from the LLM to the game's logic, and LLMManager, which sends prompts to a local LLM server and processes the returned tool commands. You can extend functionality by registering new in-game actions through the MCPHandler, enabling your LLM to request actions like opening doors, disarming traps, or querying world state. In practice, you attach the MCPHandler as a Godot node in your scene, then use LLMManager to query your local LLM server (for example via a /completion endpoint) and interpret responses that may contain action objects to be executed by your game logic.

How to install

Prerequisites:\n- .NET 9.0 SDK and runtime installed on your development machine.\n- Godot Engine (tested with Godot 4.4) and Godot C# support configured in your project.\n- A local LLM server accessible via a /completion endpoint that accepts JSON input and returns JSON output.\n\nStep-by-step:\n1) Clone the repository:\n git clone [repository-url]\n2) Build the project (from the repository root or the relevant Godot/C# project folder):\n dotnet build\n3) Integrate into Godot:\n - Copy or reference the built DLLs into your Godot C# project, or add the Godot project/solution to your workspace and reference the library project.\n4) Configure your MCP server entry: ensure the Godot scene contains a MCPHandler node and the LLMManager is pointed at your local LLM endpoint.\n5) Run the MCP server:\n dotnet run --project GodotMCPServer.csproj\n6) Run Godot and load your project. Use MCPHandler in scene scripts to register actions and LLMManager to query the local LLM.

Additional notes

Tips and considerations:\n- Ensure the LLM server supports a /completion endpoint with JSON request/response. The MCP flow expects a JSON action like {"action": "open_door", "parameters": {"target": "door_1"}}.\n- Register new in-game actions by extending the MCPHandler and binding your game logic to the action identifiers (e.g., MCPHandler.Instance.RegisterAction("open_door", OpenDoorMethod)).\n- When working with Godot, you can leverage print statements and node signals to debug MCP interactions in real time.\n- Environment variables for the .NET process can be used to tune logging levels or ports if you host multiple LLM sessions.\n- If you encounter model prompts that do not parse as actions, consider adding a validation step in MCPHandler to guard execution and provide fallback responses.\n- Maintain consistency in action names and parameter schemas to minimize misinterpretation by the LLM.

Related MCP Servers

Sponsor this space

Reach thousands of developers