
Godot
STDIOModel Context Protocol server for seamless AI assistant integration with Godot game engine
Model Context Protocol server for seamless AI assistant integration with Godot game engine
A comprehensive Model Context Protocol (MCP) server for seamless AI assistant integration with the Godot game engine.
Godot MCP bridges the gap between AI assistants and the Godot game engine by providing a standardized Model Context Protocol interface. This powerful integration enables AI assistants like Claude, Cursor, and Cline to directly interact with Godot projects through a comprehensive set of tools.
The server acts as a middleware layer between your AI assistant and Godot, translating natural language commands into specific Godot operations. When you ask your AI to "create a player scene with a sprite," the MCP server:
This creates a powerful feedback loop where AI assistants can learn from actual Godot behavior, leading to more accurate code generation and debugging assistance.
# Clone the repository git clone https://github.com/bradypp/godot-mcp.git cd godot-mcp # Install dependencies npm install # Build the project npm run build
Add to your Cline MCP settings file:
{ "mcpServers": { "godot": { "command": "node", "args": ["/absolute/path/to/godot-mcp/build/index.js"], "env": { "DEBUG": "false", "READ_ONLY": "false", "GODOT_PATH": "/path/to/godot" }, "disabled": false, "autoApprove": [ "launch_editor", "run_project", "get_debug_output", "stop_project", "get_godot_version", "list_projects", "get_project_info", "create_scene", "add_node", "edit_node", "remove_node", "load_sprite", "export_mesh_library", "save_scene", "get_uid", "update_project_uids" ] } } }
godot
command
node /absolute/path/to/godot-mcp/build/index.js
Create .cursor/mcp.json
in your project root:
{ "mcpServers": { "godot": { "command": "node", "args": ["/absolute/path/to/godot-mcp/build/index.js"], "env": { "DEBUG": "false", "GODOT_PATH": "/path/to/godot", "READ_ONLY_MODE": "false" } } } }
Variable | Description | Default | Example |
---|---|---|---|
GODOT_PATH | Path to Godot executable | Auto-detected | /usr/bin/godot4 |
DEBUG | Enable detailed logging | false | true |
READ_ONLY_MODE | Restrict to read-only operations | false | true |
get_godot_version
Get the installed Godot version information.
Parameters: None
Example Response:
{ "version": "4.2.1.stable", "platform": "linux.x86_64" }
launch_editor
Launch the Godot editor for a specific project.
Parameters:
projectPath
(string, required): Path to the Godot project directoryExample:
{ "projectPath": "/home/user/my-game" }
run_project
Execute a Godot project and capture output.
Parameters:
projectPath
(string, required): Path to the Godot project directoryscene
(string, optional): Specific scene to runExample:
{ "projectPath": "/home/user/my-game", "scene": "scenes/MainMenu.tscn" }
list_projects
Find Godot projects in a specified directory.
Parameters:
directory
(string, required): Directory to search for projectsrecursive
(boolean, optional): Whether to search recursively (default: false)get_project_info
Retrieve detailed metadata about a Godot project.
Parameters:
projectPath
(string, required): Path to the Godot project directoryExample Response:
{ "name": "My Awesome Game", "path": "/home/user/my-awesome-game", "godotVersion": "4.2.1.stable.official", "structure": { "scenes": 12, "scripts": 8, "assets": 45, "other": 3 } }
create_scene
Create a new scene in a Godot project.
Parameters:
projectPath
(string, required): Path to the Godot project directoryscenePath
(string, required): Path for the new scene file (relative to project)rootNodeType
(string, optional): Type of the root node (default: "Node2D")Example:
{ "projectPath": "/home/user/my-game", "scenePath": "scenes/Player.tscn", "rootNodeType": "CharacterBody2D" }
add_node
Add a node to an existing scene.
Parameters:
projectPath
(string, required): Path to the Godot project directoryscenePath
(string, required): Path to the scene file (relative to project)nodeType
(string, required): Type of node to add (e.g., "Sprite2D", "CollisionShape2D")nodeName
(string, required): Name for the new nodeparentNodePath
(string, optional): Path to parent node (defaults to root)properties
(object, optional): Additional properties to setExample:
{ "projectPath": "/home/user/my-game", "scenePath": "scenes/Player.tscn", "nodeType": "Sprite2D", "nodeName": "PlayerSprite", "properties": { "position": { "x": 100, "y": 50 }, "scale": { "x": 2.0, "y": 2.0 } } }
edit_node
Edit properties of an existing node in a scene.
Parameters:
projectPath
(string, required): Path to the Godot project directoryscenePath
(string, required): Path to the scene file (relative to project)nodePath
(string, required): Path to the node to editproperties
(object, required): Properties to updateExample:
{ "projectPath": "/home/user/my-game", "scenePath": "scenes/Player.tscn", "nodePath": "PlayerSprite", "properties": { "position": { "x": 200, "y": 100 }, "modulate": { "r": 1.0, "g": 0.5, "b": 0.5, "a": 1.0 } } }
remove_node
Remove a node from a scene.
Parameters:
projectPath
(string, required): Path to the Godot project directoryscenePath
(string, required): Path to the scene file (relative to project)nodePath
(string, required): Path to the node to removeload_sprite
Load a texture into a Sprite2D node.
Parameters:
projectPath
(string, required): Path to the Godot project directoryscenePath
(string, required): Path to the scene file (relative to project)nodePath
(string, required): Path to the Sprite2D nodetexturePath
(string, required): Path to the texture file (relative to project)save_scene
Save a scene, optionally as a new variant.
Parameters:
projectPath
(string, required): Path to the Godot project directoryscenePath
(string, required): Path to the scene file (relative to project)newPath
(string, optional): New path to save as variantget_debug_output
Retrieve current debug output and errors from running projects.
Parameters: None
stop_project
Stop any currently running Godot project.
Parameters: None
get_uid
Get the UID for a specific file in a Godot project.
Parameters:
projectPath
(string, required): Path to the Godot project directoryfilePath
(string, required): Path to the file (relative to project)update_project_uids
Update UID references in a project by resaving resources.
Parameters:
projectPath
(string, required): Path to the Godot project directoryThe Godot MCP server follows a modular architecture designed for maintainability and extensibility:
src/
├── config/ # Configuration management
├── core/ # Core functionality
│ ├── GodotExecutor.ts # Godot command execution
│ ├── PathManager.ts # Path detection and validation
│ ├── ProcessManager.ts # Process lifecycle management
│ └── ParameterNormalizer.ts # Input parameter handling
├── server/ # MCP server implementation
│ ├── GodotMCPServer.ts # Main server class
│ └── types.ts # Type definitions
├── tools/ # Tool implementations
│ ├── BaseToolHandler.ts # Shared tool functionality
│ ├── ToolRegistry.ts # Tool registration and filtering
│ ├── debug/ # Debug-related tools
│ ├── project/ # Project management tools
│ ├── scene/ # Scene manipulation tools
│ ├── system/ # System information tools
│ └── uid/ # UID management tools
├── utils/ # Utility functions
└── scripts/ # Godot operation scripts
Tools are registered in the ToolRegistry
with metadata indicating their capabilities:
export interface ToolRegistration { definition: ToolDefinition; handler: (args: any) => Promise<ToolResponse>; readOnly: boolean; }
The registry automatically filters tools based on the current mode (read-only vs. full access) and provides a unified interface for tool discovery and execution.
Complex Godot operations use a centralized GDScript approach:
godot_operations.gd
This architecture provides better performance, maintainability, and reliability compared to generating temporary scripts for each operation.
"Launch the Godot editor for my project at /path/to/my-game" "Run my Godot project and show me any errors" "Get information about my project structure and settings"
"Create a new Player scene with a CharacterBody2D root node" "Add a Sprite2D node called 'PlayerSprite' to my Player scene" "Load the character texture 'textures/player.png' into the PlayerSprite node" "Set the Player's position to (100, 50) and scale to 2x" "Create a CollisionShape2D node as a child of the Player root"
"Create a complete UI scene with buttons for Start Game, Settings, and Quit" "Export my 3D level models as a MeshLibrary for use with GridMap" "Analyze my project structure and suggest performance improvements" "Debug this GDScript error and help me fix the character controller" "Create a save system scene with file I/O nodes and data management"
Read-only mode provides a secure way to analyze Godot projects without making any modifications. This is ideal for CI/CD pipelines, code reviews, educational environments, and shared development scenarios.
Set the READ_ONLY_MODE
environment variable to "true"
:
{ "mcpServers": { "godot": { "command": "node", "args": ["/absolute/path/to/godot-mcp/build/index.js"], "env": { "READ_ONLY_MODE": "true" } } } }
System Tools:
get_godot_version
: Get Godot version informationProject Tools:
launch_editor
: Launch Godot editorrun_project
: Run projects to analyze behaviorlist_projects
: Discover projects in directoriesget_project_info
: Retrieve project metadataDebug Tools:
get_debug_output
: Capture console outputstop_project
: Stop running projectsUID Tools:
get_uid
: Get file UIDs (Godot 4.4+)Scene Modification Tools:
create_scene
: Create new scenesadd_node
: Add nodes to scenesedit_node
: Modify node propertiesremove_node
: Remove nodes from scenesload_sprite
: Load textures into nodesexport_mesh_library
: Export MeshLibrary resourcessave_scene
: Save scene modificationsUID Modification Tools:
update_project_uids
: Update UID referencesError: Could not find a valid Godot executable path
Solutions:
Set GODOT_PATH environment variable:
export GODOT_PATH="/path/to/godot" # or for Windows: set GODOT_PATH="C:\Program Files\Godot\godot.exe"
Verify Godot installation:
# Test if Godot is accessible godot --version # or try: godot4 --version
Common Godot paths:
C:\Program Files\Godot\godot.exe
/Applications/Godot.app/Contents/MacOS/Godot
/usr/bin/godot4
or /usr/local/bin/godot
Error: MCP server not responding or tools not available
Solutions:
"DEBUG": "true"
node /path/to/godot-mcp/build/index.js
Error: Invalid project path
or project.godot not found
Solutions:
ls /path/to/project/project.godot
Error: Build fails or dependencies missing
Solutions:
Clean and rebuild:
npm run clean npm install npm run build
Clear npm cache:
npm cache clean --force
If you encounter issues not covered here:
DEBUG=true
Q: What versions of Godot are supported? A: Godot 3.5+ and all Godot 4.x versions. Some features (like UID management) require Godot 4.4+.
Q: Can I use this with Godot 3.x projects? A: Yes, most features work with Godot 3.5+. Scene management and project operations are fully supported.
Q: Is this safe to use on production projects? A: Yes, especially with read-only mode enabled. The server includes comprehensive validation and error handling.
Q: How does the server detect my Godot installation?
A: The server checks common installation paths for each platform. You can override detection with the GODOT_PATH
environment variable.
Q: Can I run multiple instances of the server? A: Yes, each instance operates independently. Useful for working with multiple projects simultaneously.
Q: What happens if Godot crashes during an operation? A: The server detects process failures and returns appropriate error messages with suggestions for resolution.
Q: Are temporary files created during operations? A: No, the server uses a bundled GDScript approach that avoids temporary file creation for better performance and security.
Q: Which AI assistants work with this server? A: Any AI assistant supporting the Model Context Protocol, including Cline, Roo Code, Cursor, VS Code, Claude Desktop, and others.
Q: Can I customize which tools are available? A: Yes, through the autoApprove configuration or by modifying the tool registry for custom builds.
Q: How do I know if the integration is working? A: The AI assistant should be able to list available tools and execute them. Enable debug mode to see detailed operation logs.
Q: Can I add custom tools to the server?
A: Yes, the modular architecture makes it easy to add new tools. See CONTRIBUTING.md
for development guidelines.
Q: How do I contribute to the project? A: Fork the repository, make your changes, and submit a pull request. Please follow the existing code style and include tests.
Q: Is the server extensible for other game engines? A: The MCP architecture is engine-agnostic, but this implementation is specifically designed for Godot. Similar servers could be created for other engines.
We welcome contributions to improve Godot MCP! Please see our CONTRIBUTING.md
guide for:
# Fork and clone the repository git clone https://github.com/your-username/godot-mcp.git cd godot-mcp # Install dependencies npm install # Start development mode npm run dev # Run tests npm test # Build for production npm run build
This project is licensed under the MIT License - see the LICENSE
file for details.
This project was originally forked from Coding-Solo/godot-mcp.
Built with ❤️ for the Godot and AI development communities