Redot includes a native MCP (Model Context Protocol) server, allowing AI coding assistants (like OpenCode, Claude Desktop, Cursor, or Zed) to interact directly with your game project.
The MCP server provides 5 master controllers:
redot_scene_action: Manage.tscnfiles (add nodes, set properties, instance scenes, and wire signals with automatic callback generation).redot_resource_action: Manage.tresfiles and assets (create/modify materials, themes, inspect.importmetadata).redot_code_intel: Deep script analysis (GDScript syntax validation, symbol extraction, and engine documentation lookup).redot_project_config: Project-level control (configure Input Map, Autoloads, run/stop the game, read logs, and res:// I/O).redot_game_control: Vision & Interaction (capture screenshots, click UI elements with high-precision, and inspect the live scene tree recursively).
{
"mcp": {
"redot": {
"type": "local",
"command": [
"/path/to/redot.editor.binary",
"--headless",
"--mcp-server",
"--path",
"/path/to/your/project"
],
"enabled": true
}
}
}You can execute automated tests headlessly using the --run-tests flag:
./bin/redot.<platform> --headless --run-tests=res://tests/my_test.gdNote: Your test script should have a func run(): method.
If you are developing inside a Nix environment, use the provided wrapper to ensure all libraries are correctly linked:
- Locate the
redot-mcp.shscript in the engine root. - In your
opencode.jsonor MCP client config, use:
{
"mcp": {
"redot": {
"type": "local",
"command": ["/path/to/redot-engine/redot-mcp.sh", "/path/to/your/project"],
"enabled": true
}
}
}To get the most out of Redot's MCP server, agents should follow these guidelines:
- Scene Editing: Use
redot_scene_actionfor all.tscnmodifications. Avoid editing TSCN files as raw text to prevent breaking node UIDs and internal references. - Scripting: For existing
.gdfiles, use native text editing tools (likeedit) for precise logic changes. Useredot_project_config(action="create_file_res")only when creating new scripts from scratch. - Live Interaction: Always
wait3-5 seconds afterrunbefore attempting vision or input actions to allow the bridge to initialize. - Spatial Awareness: Use
redot_game_control(action="inspect_live", recursive=true)to discover UI paths and their pre-calculated screen coordinates for 100% accurate clicking. - Debugging: Use
redot_project_config(action="output")to read real-time logs andredot_code_intel(action="validate")to syntax-check fixes before running the game. - Script Editing Policy: The MCP tool
create_file_resis restricted to creating new files. To edit existing.gdscripts, agents must use native text editing tools (likeedit). This ensures precision and prevents accidental overwrites of complex logic.