feat: Step 6 MCP server bridge for AI agents
- Add ModelContextProtocol + ModelContextProtocol.AspNetCore 1.4.0 to Engine.AI. - Expose AI commands as MCP tools: spawn_model, set_transform, delete_entity, list_entities. - Add AiCommandQueue to marshal commands from the MCP server thread to the main thread. - Start in-process HTTP MCP server in Program.cs (Debug/Release only; excluded in ReleaseAOT). - Add --mcp-port CLI argument to configure the MCP server port. - Fix Flecs.NET package conditions to include ReleaseAOT config.
This commit is contained in:
@@ -16,13 +16,14 @@ public sealed class AiCommandProcessor
|
||||
{
|
||||
private readonly World _world;
|
||||
private readonly Func<string, Mesh> _modelLoader;
|
||||
private readonly JsonSerializerOptions _jsonOptions;
|
||||
|
||||
public JsonSerializerOptions JsonOptions { get; }
|
||||
|
||||
public AiCommandProcessor(World world, Func<string, Mesh> modelLoader)
|
||||
{
|
||||
_world = world;
|
||||
_modelLoader = modelLoader;
|
||||
_jsonOptions = new JsonSerializerOptions
|
||||
JsonOptions = new JsonSerializerOptions
|
||||
{
|
||||
PropertyNameCaseInsensitive = true,
|
||||
Converters =
|
||||
@@ -41,7 +42,7 @@ public sealed class AiCommandProcessor
|
||||
{
|
||||
try
|
||||
{
|
||||
var command = JsonSerializer.Deserialize<AiCommand>(json, _jsonOptions);
|
||||
var command = JsonSerializer.Deserialize<AiCommand>(json, JsonOptions);
|
||||
if (command == null)
|
||||
return AiCommandResult.Error("Failed to parse command.");
|
||||
|
||||
@@ -118,7 +119,7 @@ public sealed class AiCommandProcessor
|
||||
names.Add(name);
|
||||
});
|
||||
|
||||
var json = JsonSerializer.Serialize(names, _jsonOptions);
|
||||
var json = JsonSerializer.Serialize(names, JsonOptions);
|
||||
return AiCommandResult.Ok(json);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user