GodotMcp.SemanticKernel.Plugin
1.8.1
dotnet add package GodotMcp.SemanticKernel.Plugin --version 1.8.1
NuGet\Install-Package GodotMcp.SemanticKernel.Plugin -Version 1.8.1
<PackageReference Include="GodotMcp.SemanticKernel.Plugin" Version="1.8.1" />
<PackageVersion Include="GodotMcp.SemanticKernel.Plugin" Version="1.8.1" />
<PackageReference Include="GodotMcp.SemanticKernel.Plugin" />
paket add GodotMcp.SemanticKernel.Plugin --version 1.8.1
#r "nuget: GodotMcp.SemanticKernel.Plugin, 1.8.1"
#:package GodotMcp.SemanticKernel.Plugin@1.8.1
#addin nuget:?package=GodotMcp.SemanticKernel.Plugin&version=1.8.1
#tool nuget:?package=GodotMcp.SemanticKernel.Plugin&version=1.8.1
Godot-MCP-SK-Plugin
A .NET 10 Semantic Kernel plugin that connects SK agents/apps to GodotMCP.Server 1.2+ (including newer tool surfaces such as camera settings in current releases) via the .NET global tool godot-mcp, using the official ModelContextProtocol .NET SDK over stdio (initialize, tools/list, tools/call) and dynamically exposing Godot automation tools as Kernel functions.
Key Features
Architecture
GodotMcp.Core: interfaces, models, exceptions.GodotMcp.Infrastructure: stdio client, process manager, serialization, conversion, options.GodotMcp.Plugin: Semantic Kernel integration, function mapping, DI extensions.GodotMcp.Tests: unit/integration/property-based tests.
Quick Start
var builder = Host.CreateApplicationBuilder(args);
builder.Services.AddGodotMcp(options =>
{
options.ExecutablePath = "godot-mcp";
options.GodotExecutablePath = Environment.GetEnvironmentVariable("GODOT_PATH");
});
using var host = builder.Build();
var plugin = host.Services.GetRequiredService<GodotPlugin>();
await plugin.InitializeAsync();
var result = await plugin.InvokeToolAsync(
"create_scene",
new Dictionary<string, object?>
{
["projectPath"] = @"C:\GodotProjects\MyGame",
["fileName"] = "Main.tscn",
["rootNodeName"] = "Main",
["root_type"] = "Node2D"
});
SK Registration Modes
- Expanded mode (recommended):
kernel.RegisterGodotTools(host.Services, "godot")- Registers each discovered method as an individual function like
godot_create_scene.
- Registers each discovered method as an individual function like
- Router mode:
kernel.Plugins.AddFromObject(plugin, "godot")- Exposes a single
invoke_godot_tool(toolName, parameters)function.
- Exposes a single
Configuration
appsettings.json:
{
"GodotMcp": {
"ExecutablePath": "godot-mcp",
"GodotExecutablePath": null,
"ConnectionTimeoutSeconds": 30,
"RequestTimeoutSeconds": 60,
"MaxRetryAttempts": 3,
"BackoffStrategy": "Exponential",
"InitialRetryDelayMs": 1000,
"EnableProcessPooling": true,
"MaxIdleTimeSeconds": 300,
"ToolDefinitionsPath": null,
"EnableMessageLogging": false
}
}
Environment overrides:
GODOT_MCP_PATH: overrides the MCP server executable path.GODOT_PATH: Godot binary path used by server CLI-backed tools.
Current GD Tool Surface
This plugin supports full dynamic discovery and invocation of the local GD_MCP-Server tools across:
- Core and diagnostics
- Projects
- Scenes and nodes
- Scripts
- Resources and imports
- Editor/export automation
- Integration discovery and health tooling
Detailed reference: Docs/tool-contracts.md.
Typed Module Wrappers And Skills
In addition to dynamic discovery, the plugin exposes strongly-typed module wrappers (Infrastructure) and Semantic Kernel skill methods (Plugin) for common workflows.
Project module:
create_godot_projectget_project_infoconfigure_autoloadadd_plugin
UI module (ui.*):
ui.list_controlsui.add_control(with fallback support forui.create_control)ui.set_control_properties(with fallback support forui.update_control)ui.set_layout_preset(with fallback support forui.apply_layout_preset)ui.list_themesui.apply_theme
Lighting module (light.*):
light.listlight.createlight.updatelight.tunelight.validate
Script module:
create_scriptattach_scriptvalidate_script
Import module:
generate_import_filecreate_texturecreate_audioreimport_asset
Lint module (lint.* + compatibility):
lint.scene_advancedlint.project_advancedlint_project(via compatibility wrapper)
Physics module (physics.*):
physics.list_bodiesphysics.create_bodyphysics.update_bodyphysics.list_shapesphysics.create_shapephysics.update_shapephysics.set_layersphysics.run_checksphysics.validate
Camera module (camera.*):
camera.listcamera.createcamera.updatecamera.validate
Documentation module (docs.*):
query_system_documentation— search this repository’s DocFX output (_site/manifest.json) and/or Markdown underdocs/(same parameters as the Godot MCP server tool).query_godot_engine_documentation— search official Godot Engine docs via Read the Docs (HTTPS todocs.godotengine.org; requires outbound network on the MCP server).
Local system documentation: the server needs docs/docfx.json in the Godot MCP git repo. For manifest search, build the site first (for example dotnet docfx docs/docfx.json), which produces _site/manifest.json. If godot-mcp runs as a global tool outside the repo, set GODOT_MCP_REPO_ROOT to the repository root (folder containing docs/docfx.json) so the server can resolve paths.
Godot Engine documentation: works from any machine where the MCP server can reach https://docs.godotengine.org (Read the Docs JSON API).
Typed results use GodotMcpDocumentationToolResult<T> in C#, mapping MCP fields success, message, optional suggestedRemediation, and structured payload data for reliable parsing in agents.
These typed surfaces are additive: if a server does not expose a given command, dynamic discovery still provides the authoritative runtime list.
Typed Module Quick Examples
var mcpClient = host.Services.GetRequiredService<IMcpClient>();
const string projectRoot = @"C:\GodotProjects\MyGame";
// UI: apply a theme to a control
var uiTheme = await mcpClient.UiApplyThemeAsync(
new UiApplyThemeRequest(new McpProjectFile(projectRoot, "scenes/ui.tscn"), "./RootPanel", "dark_flat"));
// Lighting: tune an existing light
var tunedLight = await mcpClient.LightTuneAsync(
new LightTuneRequest(
new McpProjectFile(projectRoot, "scenes/main.tscn"),
"./Sun",
new Dictionary<string, object?>
{
["energy"] = 2.5,
["color"] = new { r = 1.0, g = 0.95, b = 0.85, a = 1.0 }
}));
// Physics: set layers and run checks
var layerResult = await mcpClient.PhysicsSetLayersAsync(
new PhysicsSetLayersRequest(new McpProjectFile(projectRoot, "scenes/main.tscn"), "./Player", collisionLayer: 2, collisionMask: 5));
var checks = await mcpClient.PhysicsRunChecksAsync(
new PhysicsRunChecksRequest(new McpProjectFile(projectRoot, "scenes/main.tscn"), "./Player"));
Documentation
Docs/tool-contracts.mdDocs/godot-cli-setup.mdDocs/docker-mcp-setup.mdDocs/testing-guide.mdSkills/SKILL.md
Test
dotnet test GodotMcp.sln
dotnet test GodotMcp.sln --collect:"XPlat Code Coverage" --settings coverlet.runsettings
Configuration Options
| Option | Type | Default | Description |
|---|---|---|---|
ExecutablePath |
string | "godot-mcp" |
Path to the godot-mcp executable |
ConnectionTimeoutSeconds |
int | 30 |
Maximum time to wait for connection establishment |
RequestTimeoutSeconds |
int | 60 |
Maximum time to wait for request completion |
MaxRetryAttempts |
int | 3 |
Number of retry attempts for transient failures |
BackoffStrategy |
enum | Exponential |
Retry backoff strategy (Linear or Exponential) |
InitialRetryDelayMs |
int | 1000 |
Initial delay before first retry in milliseconds |
EnableProcessPooling |
bool | true |
Reuse godot-mcp process across requests |
MaxIdleTimeSeconds |
int | 300 |
Maximum idle time before process shutdown |
ToolDefinitionsPath |
string? | null |
Path to predefined tool definitions (fallback) |
EnableMessageLogging |
bool | false |
Enable detailed request/response logging |
Backoff Strategies
- Linear: Delay = InitialRetryDelayMs × attempt number
- Exponential: Delay = InitialRetryDelayMs × 2^(attempt number)
Available Functions
The plugin is discovery-first and maps the server-advertised tools from tools/list at runtime.
Typical families available on recent GD_MCP-Server builds include:
- Core:
health_check,get_server_info,get_server_capabilities - Project:
create_godot_project,get_project_info - Scene/Node:
create_scene,add_node,set_node_property,remove_node - Script/Resource:
create_script,attach_script,create_resource,reimport_asset - Typed modules (when exposed by server):
ui.*,light.*,physics.*,camera.*
The exact list depends on the connected server version and installed integrations. Use ListToolsAsync() to inspect the authoritative runtime surface.
Advanced Usage
Custom Type Converters
Register custom converters for specialized types:
var parameterConverter = host.Services.GetRequiredService<IParameterConverter>();
parameterConverter.RegisterConverter(new MyCustomTypeConverter());
public class MyCustomTypeConverter : ITypeConverter<MyCustomType>
{
public object? ToMcp(MyCustomType value)
{
// Convert to MCP format
return new { /* ... */ };
}
public MyCustomType? FromMcp(object? mcpValue)
{
// Convert from MCP format
return new MyCustomType(/* ... */);
}
}
Error Handling
The plugin provides a comprehensive exception hierarchy:
try
{
await plugin.InvokeToolAsync("Godot_create_scene", parameters);
}
catch (TimeoutException ex)
{
Console.WriteLine($"Request timed out after {ex.Timeout}");
}
catch (McpServerException ex)
{
Console.WriteLine($"Godot server error: {ex.Message} (Code: {ex.ErrorCode})");
}
catch (NetworkException ex)
{
Console.WriteLine($"Network error: {ex.Message}");
}
catch (ProtocolException ex)
{
Console.WriteLine($"Protocol violation: {ex.Message}");
}
catch (GodotMcpException ex)
{
Console.WriteLine($"General error: {ex.Message}");
}
Health Monitoring
Check connection health:
var mcpClient = host.Services.GetRequiredService<IMcpClient>();
bool isHealthy = await mcpClient.PingAsync();
Console.WriteLine($"Connection healthy: {isHealthy}");
var state = mcpClient.State;
Console.WriteLine($"Connection state: {state}");
Graceful Degradation
Use predefined tool definitions as fallback:
{
"GodotMcp": {
"ToolDefinitionsPath": "Godot-tools.json"
}
}
Create Godot-tools.json:
[
{
"name": "Godot_create_scene",
"description": "Creates a new Godot scene",
"parameters": {
"sceneName": {
"name": "sceneName",
"type": "string",
"description": "Name of the scene",
"required": true
}
}
}
]
Project Structure
Godot-MCP-SK-Plugin/
├── src/
│ ├── GodotMcp.Core/ # Domain models, interfaces, and exceptions
│ │ ├── Interfaces/ # Core abstractions (IMcpClient, IParameterConverter, etc.)
│ │ ├── Models/ # DTOs and domain models (McpRequest, McpResponse, etc.)
│ │ ├── Exceptions/ # Custom exception types
│ │ └── Utilities/ # Helper utilities (LogSanitizer)
│ ├── GodotMcp.Infrastructure/ # MCP client and process management
│ │ ├── Client/ # StdioMcpClient implementation
│ │ ├── Process/ # ProcessManager for godot-mcp lifecycle
│ │ ├── Serialization/ # JSON-RPC request/response handling
│ │ ├── Conversion/ # Parameter type conversion
│ │ └── Configuration/ # Configuration options and validation
│ └── GodotMcp.Plugin/ # Semantic Kernel integration
│ ├── Mapping/ # FunctionMapper for tool discovery
│ ├── Extensions/ # ServiceCollectionExtensions for DI
│ ├── Validation/ # Input validation
│ └── GodotPlugin.cs # Main plugin class
└── tests/
└── GodotMcp.Tests/ # Unit and integration tests
├── CoreTests/ # Core layer tests
├── InfrastructureTests/ # Infrastructure layer tests
└── PluginTests/ # Plugin layer tests
Technology Stack
- .NET 10 (2026 LTS) - Latest long-term support release
- C# 13 - File-scoped namespaces, collection expressions, required members
- Microsoft.SemanticKernel - AI agent framework integration
- System.Text.Json - High-performance JSON serialization with source generators
- xUnit - Unit testing framework
- NSubstitute - Mocking framework for tests
- FsCheck - Property-based testing library
Security
The plugin implements comprehensive security measures:
Secure Logging
All logging operations automatically sanitize sensitive information:
- Passwords and Tokens: Never logged in plain text
- API Keys: Automatically redacted from logs
- Email Addresses: Replaced with
[EMAIL_REDACTED] - JWT Tokens: Detected and redacted (eyJ... format)
- Bearer Tokens: Removed from authorization headers
- Connection Strings: Password fields redacted
The LogSanitizer utility provides automatic detection and redaction of sensitive data patterns.
Input Validation
All parameters are validated before being sent to the godot-mcp server:
- Tool names validated against registered tools
- Parameter types checked for compatibility
- Null values handled appropriately
- Prevents injection attacks and malformed requests
Error Message Sanitization
Error messages are sanitized to prevent information disclosure about internal system details while maintaining useful diagnostic information.
Performance
The plugin is optimized for high performance:
- System.Text.Json Source Generators: Zero-reflection serialization
- FrozenDictionary: Immutable, high-performance lookups for tool definitions
- PipeReader/PipeWriter: Efficient stdio communication
- ValueTask: Reduced allocations for hot paths
- LoggerMessage Source Generators: Zero-allocation structured logging
- Process Pooling: Reuse godot-mcp process across requests
Contributing
Contributions are welcome! Please follow these guidelines:
Development Setup
- Clone the repository
- Install .NET 10 SDK
- Install godot-mcp-Server:
dotnet tool install -g godot-mcp - Restore dependencies:
dotnet restore - Build the solution:
dotnet build - Run tests:
dotnet test
Code Style
- Follow clean architecture principles
- Use file-scoped namespaces
- Enable nullable reference types
- Use collection expressions for initialization
- Add XML documentation comments to all public APIs
- Write unit tests for all new functionality
- Maintain >80% code coverage
Pull Request Process
- Create a feature branch from
main - Implement your changes with tests
- Ensure all tests pass:
dotnet test - Update documentation as needed
- Submit a pull request with a clear description
Testing Guidelines
- Write both unit tests and property-based tests
- Use NSubstitute for mocking dependencies
- Test error handling and edge cases
- Verify thread safety for concurrent scenarios
- Include integration tests for end-to-end flows
Building and Testing
Build
# Build entire solution
dotnet build GodotMcp.sln
# Build specific project
dotnet build src/GodotMcp.Plugin/GodotMcp.Plugin.csproj
# Build in Release mode
dotnet build -c Release
Test
# Run all tests
dotnet test GodotMcp.sln
# Run tests with coverage
dotnet test --collect:"XPlat Code Coverage"
# Run specific test project
dotnet test tests/GodotMcp.Tests/GodotMcp.Tests.csproj
# Run tests with detailed output
dotnet test --logger "console;verbosity=detailed"
Package
# Create NuGet package
dotnet pack -c Release
# Package will be created in bin/Release/
Troubleshooting
Connection Issues
Problem: NetworkException: Failed to connect to godot-mcp server
Solutions:
- Verify godot-mcp is installed:
dotnet tool list -g - Check Godot Editor is running
- Increase
ConnectionTimeoutSecondsin configuration - Check godot-mcp logs for errors
Timeout Errors
Problem: TimeoutException: Request timed out
Solutions:
- Increase
RequestTimeoutSecondsfor long-running operations - Check Godot Editor is responsive
- Verify network connectivity
- Enable
EnableMessageLoggingto debug request/response flow
Tool Not Found
Problem: GodotMcpException: Tool not found: Godot_xxx
Solutions:
- Verify godot-mcp-Server version supports the tool
- Call
ListToolsAsync()to see available tools - Check tool name spelling
- Provide
ToolDefinitionsPathas fallback
Process Management Issues
Problem: Multiple godot-mcp processes running
Solutions:
- Enable
EnableProcessPoolingto reuse processes - Properly dispose of
GodotPluginand services - Check
MaxIdleTimeSecondsconfiguration - Manually kill orphaned processes
License
MIT License - See LICENSE file for details
Acknowledgments
- Built on Microsoft Semantic Kernel
- Integrates with godot-mcp-Server
- Follows Model Context Protocol specification
Support
- Issues: Report bugs and feature requests on GitHub Issues
- Discussions: Join commGodot discussions on GitHub Discussions
- Documentation: Full API documentation available in XML comments
Version History
1.0.0 (Initial Release)
- Stdio-based MCP communication
- Automatic tool discovery
- Type-safe parameter conversion
- Retry logic with configurable backoff
- Health monitoring
- Secure logging
- Comprehensive test coverage (>80%)
- Clean architecture implementation
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.6)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.6)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.6)
- Microsoft.Extensions.Logging (>= 10.0.6)
- Microsoft.SemanticKernel (>= 1.74.0)
- ModelContextProtocol (>= 1.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
This package is part of the Godot MCP ecosystem.
Contributions from the Godot MCP community are welcome.