ultimate-unreal-engine-mcp 0.1.1 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/package.json +1 -1
  2. package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/MCPBridgeEditor.Build.cs +60 -68
  3. package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/MCPActorCommands.cpp +2 -2
  4. package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/MCPBlueprintHandlers.cpp +2 -2
  5. package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/MCPBlueprintWriteHandlers.cpp +21 -9
  6. package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/MCPBridgeSubsystem.cpp +110 -149
  7. package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/MCPCollisionPhysicsCommands.cpp +3 -3
  8. package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/MCPEditorStateCommands.cpp +1 -0
  9. package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/MCPInputHandlers.cpp +14 -7
  10. package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/MCPPieCommands.cpp +4 -3
  11. package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/MCPSelectionCommands.cpp +1 -1
  12. package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/MCPSequencerCommands.cpp +22 -44
  13. package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/MCPViewportCommands.cpp +1 -1
  14. package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPAICommands.cpp → Optional/MCPAICommands.cpp.disabled} +14 -11
  15. package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPAnimationCommands.cpp → Optional/MCPAnimationCommands.cpp.disabled} +18 -11
  16. package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPAudioCommands.cpp → Optional/MCPAudioCommands.cpp.disabled} +1 -1
  17. package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPChaosCommands.cpp → Optional/MCPChaosCommands.cpp.disabled} +3 -3
  18. package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPGASCommands.cpp → Optional/MCPGASCommands.cpp.disabled} +35 -15
  19. package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPImportExportCommands.cpp → Optional/MCPImportExportCommands.cpp.disabled} +13 -8
  20. package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPLiveLinkCommands.cpp → Optional/MCPLiveLinkCommands.cpp.disabled} +6 -6
  21. package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPMaterialCommands.cpp → Optional/MCPMaterialCommands.cpp.disabled} +38 -29
  22. package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPMotionDesignCommands.cpp → Optional/MCPMotionDesignCommands.cpp.disabled} +9 -9
  23. package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPMovieRenderCommands.cpp → Optional/MCPMovieRenderCommands.cpp.disabled} +4 -9
  24. package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPNetworkingCommands.cpp → Optional/MCPNetworkingCommands.cpp.disabled} +4 -4
  25. package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPValidationCommands.cpp → Optional/MCPValidationCommands.cpp.disabled} +11 -11
  26. package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPWorldPartitionCommands.cpp → Optional/MCPWorldPartitionCommands.cpp.disabled} +43 -26
  27. /package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPAICommands.h → Optional/MCPAICommands.h.disabled} +0 -0
  28. /package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPAnimationCommands.h → Optional/MCPAnimationCommands.h.disabled} +0 -0
  29. /package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPAudioCommands.h → Optional/MCPAudioCommands.h.disabled} +0 -0
  30. /package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPChaosCommands.h → Optional/MCPChaosCommands.h.disabled} +0 -0
  31. /package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPGASCommands.h → Optional/MCPGASCommands.h.disabled} +0 -0
  32. /package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPImportExportCommands.h → Optional/MCPImportExportCommands.h.disabled} +0 -0
  33. /package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPLiveLinkCommands.h → Optional/MCPLiveLinkCommands.h.disabled} +0 -0
  34. /package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPMaterialCommands.h → Optional/MCPMaterialCommands.h.disabled} +0 -0
  35. /package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPMotionDesignCommands.h → Optional/MCPMotionDesignCommands.h.disabled} +0 -0
  36. /package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPMovieRenderCommands.h → Optional/MCPMovieRenderCommands.h.disabled} +0 -0
  37. /package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPNetworkingCommands.h → Optional/MCPNetworkingCommands.h.disabled} +0 -0
  38. /package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPValidationCommands.h → Optional/MCPValidationCommands.h.disabled} +0 -0
  39. /package/unreal-plugin/MCPBridge/Source/MCPBridgeEditor/Private/{MCPWorldPartitionCommands.h → Optional/MCPWorldPartitionCommands.h.disabled} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ultimate-unreal-engine-mcp",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "MCP server giving AI assistants full access to Unreal Engine 5.7 projects",
5
5
  "type": "module",
6
6
  "engines": {
@@ -1,68 +1,60 @@
1
- // MCPBridgeEditor.Build.cs
2
- // Editor module: UEditorSubsystem lifecycle, editor API handlers (Phases 8-29).
3
- // Depends on MCPBridgeRuntime for the TCP server.
4
- // This module is guarded by WITH_EDITOR -- never ships to cooked builds.
5
-
6
- using UnrealBuildTool;
7
-
8
- public class MCPBridgeEditor : ModuleRules
9
- {
10
- public MCPBridgeEditor(ReadOnlyTargetRules Target) : base(Target)
11
- {
12
- PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
13
-
14
- PublicDependencyModuleNames.AddRange(new string[]
15
- {
16
- "Core",
17
- "MCPBridgeRuntime",
18
- });
19
-
20
- PrivateDependencyModuleNames.AddRange(new string[]
21
- {
22
- "CoreUObject",
23
- "Engine",
24
- "UnrealEd",
25
- "EditorSubsystem",
26
- "Json",
27
- "Kismet",
28
- "BlueprintGraph",
29
- "AssetRegistry",
30
- "EnhancedInput",
31
- "LevelEditor",
32
- "SlateCore",
33
- "DataValidation",
34
- "LevelSequence",
35
- "MovieScene",
36
- "MovieSceneTracks",
37
- "LevelSequenceEditor",
38
- "MaterialEditor",
39
- "AssetTools",
40
- "AnimGraph",
41
- "AnimGraphRuntime",
42
- "IKRig",
43
- "WorldPartitionEditor",
44
- "PhysicsCore",
45
- "MetasoundEngine",
46
- "MetasoundFrontend",
47
- "InterchangeEngine",
48
- "InterchangePipelines",
49
- "AIModule",
50
- "StateTreeModule",
51
- "NavigationSystem",
52
- "GameplayAbilities", // Phase 25 - GAS
53
- "GameplayTags", // Phase 25 - GAS
54
- "GameplayTasks", // Phase 25 - GAS
55
- "GeometryCollectionEngine", // Phase 26 - Chaos destruction (UGeometryCollectionComponent)
56
- "ChaosCloth", // Phase 26 - Chaos cloth simulation parameters
57
- "LiveLinkInterface", // Phase 27 - ILiveLinkClient, FLiveLinkSubjectKey, FLiveLinkSubjectFrameData
58
- "LiveLink", // Phase 27 - ULiveLinkSubjectSettings for per-subject enabled state control
59
- "AvalancheRundown", // Phase 28 - Motion Design Scene State machines (experimental)
60
- "AvalancheTransition", // Phase 28 - Motion Design Transition Logic trees (experimental)
61
- "RemoteControl", // Phase 28 - Remote Control preset read/write
62
- "MovieRenderPipelineCore", // Phase 29 - UMoviePipelineQueue, UMoviePipelineExecutorJob, config/settings types
63
- "MovieRenderPipelineEditor", // Phase 29 - UMoviePipelineQueueSubsystem
64
- "OnlineSubsystem", // Phase 30 - IOnlineSubsystem, IOnlineSession, FOnlineSessionSettings
65
- "OnlineSubsystemUtils", // Phase 30 - Online subsystem helper utilities
66
- });
67
- }
68
- }
1
+ // MCPBridgeEditor.Build.cs
2
+ // Editor module: UEditorSubsystem lifecycle, editor API handlers.
3
+ // Depends on MCPBridgeRuntime for the TCP server.
4
+ // This module is guarded by WITH_EDITOR -- never ships to cooked builds.
5
+ //
6
+ // Only modules that ship with every UE 5.7 binary install are linked here.
7
+ // Handlers for optional plugins live in the Private/Optional/ subfolder
8
+ // and are NOT compiled by default. To enable them, move them to Private/
9
+ // and add their module dependencies below.
10
+
11
+ using UnrealBuildTool;
12
+
13
+ public class MCPBridgeEditor : ModuleRules
14
+ {
15
+ public MCPBridgeEditor(ReadOnlyTargetRules Target) : base(Target)
16
+ {
17
+ PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
18
+
19
+ PublicDependencyModuleNames.AddRange(new string[]
20
+ {
21
+ "Core",
22
+ "MCPBridgeRuntime",
23
+ });
24
+
25
+ PrivateDependencyModuleNames.AddRange(new string[]
26
+ {
27
+ // Core engine (always present)
28
+ "CoreUObject",
29
+ "Engine",
30
+ "UnrealEd",
31
+ "EditorSubsystem",
32
+ "Json",
33
+ "SlateCore",
34
+ "InputCore",
35
+ "AssetTools",
36
+ "AssetRegistry",
37
+ "LevelEditor",
38
+ "PhysicsCore",
39
+
40
+ // Blueprint (always present in editor)
41
+ "Kismet",
42
+ "BlueprintGraph",
43
+
44
+ // Sequencer (always present in editor)
45
+ "LevelSequence",
46
+ "LevelSequenceEditor",
47
+ "MovieScene",
48
+ "MovieSceneTracks",
49
+
50
+ // Input (always present)
51
+ "EnhancedInput",
52
+
53
+ // AI (always present)
54
+ "AIModule",
55
+ "NavigationSystem",
56
+ "GameplayTags",
57
+ "GameplayTasks",
58
+ });
59
+ }
60
+ }
@@ -177,10 +177,10 @@ void RegisterActorCommands(FMCPCommandRouter& Router)
177
177
  }
178
178
 
179
179
  // Find actor class by name; try exact name then A-prefixed name.
180
- UClass* ActorClass = FindObject<UClass>(ANY_PACKAGE, *ClassName);
180
+ UClass* ActorClass = FindFirstObject<UClass>( *ClassName);
181
181
  if (!ActorClass)
182
182
  {
183
- ActorClass = FindObject<UClass>(ANY_PACKAGE, *(TEXT("A") + ClassName));
183
+ ActorClass = FindFirstObject<UClass>( *(TEXT("A") + ClassName));
184
184
  }
185
185
  if (!ActorClass)
186
186
  {
@@ -12,7 +12,7 @@
12
12
 
13
13
  // Blueprint APIs
14
14
  #include "Engine/Blueprint.h"
15
- #include "BlueprintEditorUtils.h"
15
+ #include "Kismet2/BlueprintEditorUtils.h"
16
16
  #include "EdGraph/EdGraph.h"
17
17
  #include "EdGraph/EdGraphNode.h"
18
18
  #include "EdGraph/EdGraphPin.h"
@@ -28,7 +28,7 @@
28
28
  #include "AssetRegistry/AssetRegistryModule.h"
29
29
  #include "AssetRegistry/IAssetRegistry.h"
30
30
  #include "AssetRegistry/AssetData.h"
31
- #include "Blueprint/BlueprintTags.h"
31
+ #include "Blueprint/BlueprintSupport.h"
32
32
 
33
33
  // JSON APIs
34
34
  #include "Dom/JsonObject.h"
@@ -31,6 +31,7 @@
31
31
  // Asset APIs
32
32
  #include "AssetRegistry/AssetRegistryModule.h"
33
33
  #include "UObject/Package.h"
34
+ #include "UObject/SavePackage.h"
34
35
  #include "Misc/PackageName.h"
35
36
 
36
37
  // JSON APIs
@@ -146,17 +147,17 @@ void RegisterBlueprintWriteHandlers(FMCPCommandRouter& Router)
146
147
 
147
148
  // T-10-01: Validate the asset path is a well-formed long package name.
148
149
  // Rejects path traversal ("../") and bare filenames.
149
- FString ValidationError;
150
+ FText ValidationError;
150
151
  if (!FPackageName::IsValidLongPackageName(AssetPath, /*bIncludeReadOnlyRoots=*/false, &ValidationError))
151
152
  {
152
153
  UE_LOG(LogTemp, Warning, TEXT("[MCPBridge] blueprint.create: Invalid asset path '%s': %s"),
153
- *AssetPath, *ValidationError);
154
+ *AssetPath, *ValidationError.ToString());
154
155
  SendError(SendResponse, CorrelationId, TEXT("invalid_asset_path"));
155
156
  return;
156
157
  }
157
158
 
158
159
  // Resolve the parent class by name (try short name first, then full path).
159
- UClass* ParentClass = FindObject<UClass>(ANY_PACKAGE, *ParentClassName);
160
+ UClass* ParentClass = FindFirstObject<UClass>( *ParentClassName);
160
161
  if (!ParentClass)
161
162
  {
162
163
  ParentClass = LoadObject<UClass>(nullptr, *ParentClassName);
@@ -214,8 +215,10 @@ void RegisterBlueprintWriteHandlers(FMCPCommandRouter& Router)
214
215
  // Save the package to disk so the asset persists.
215
216
  FString FilePath = FPackageName::LongPackageNameToFilename(
216
217
  AssetPath, FPackageName::GetAssetPackageExtension());
217
- UPackage::SavePackage(Pkg, NewBP, RF_Standalone, *FilePath,
218
- GError, nullptr, false, true, SAVE_NoError);
218
+ FSavePackageArgs SaveArgs;
219
+ SaveArgs.TopLevelFlags = RF_Standalone;
220
+ SaveArgs.SaveFlags = SAVE_NoError;
221
+ UPackage::SavePackage(Pkg, NewBP, *FilePath, SaveArgs);
219
222
 
220
223
  // Notify the Asset Registry so the asset appears in the Content Browser.
221
224
  FAssetRegistryModule::AssetCreated(NewBP);
@@ -288,7 +291,7 @@ void RegisterBlueprintWriteHandlers(FMCPCommandRouter& Router)
288
291
  }
289
292
 
290
293
  // T-10-02: Resolve node class and validate it is a non-abstract UEdGraphNode subclass.
291
- UClass* NodeClass = FindObject<UClass>(ANY_PACKAGE, *NodeType);
294
+ UClass* NodeClass = FindFirstObject<UClass>( *NodeType);
292
295
  if (!NodeClass)
293
296
  {
294
297
  UE_LOG(LogTemp, Warning, TEXT("[MCPBridge] blueprint.addNode: Node type '%s' not found"), *NodeType);
@@ -649,9 +652,18 @@ void RegisterBlueprintWriteHandlers(FMCPCommandRouter& Router)
649
652
  return;
650
653
  }
651
654
 
652
- // T-10-05: SetBlueprintVariableDefaultValue returns bool; use named error code on failure.
653
- bool bSet = FBlueprintEditorUtils::SetBlueprintVariableDefaultValue(
654
- BP, FName(*TargetName), DefaultValue);
655
+ // Find the variable in NewVariables and set its DefaultValue directly.
656
+ bool bSet = false;
657
+ const FName VarName(*TargetName);
658
+ for (FBPVariableDescription& VarDesc : BP->NewVariables)
659
+ {
660
+ if (VarDesc.VarName == VarName)
661
+ {
662
+ VarDesc.DefaultValue = DefaultValue;
663
+ bSet = true;
664
+ break;
665
+ }
666
+ }
655
667
  if (!bSet)
656
668
  {
657
669
  UE_LOG(LogTemp, Warning, TEXT("[MCPBridge] blueprint.setDefault: Variable '%s' not found in '%s'"),
@@ -1,149 +1,110 @@
1
- // MCPBridgeSubsystem.cpp (updated by Plans 07-02, 08-01, 09-01, 09-02, 10-01, 12-01, 12-02, 13-01, 17-01, 18-01, 19-01, 20-01, 21-01, 22-01, 23-01, 25-01, 26-01, 27-01, 28-01, 29-01, 30-01)
2
- // Wires FMCPCommandRouter and FMCPTcpServer into the editor subsystem lifecycle.
3
-
4
- #include "MCPBridgeSubsystem.h"
5
- #include "MCPBlueprintHandlers.h"
6
- #include "MCPActorCommands.h"
7
- #include "MCPAssetCommands.h"
8
- #include "MCPBlueprintWriteHandlers.h"
9
- #include "MCPEditorStateCommands.h"
10
- #include "MCPPieCommands.h"
11
- #include "MCPViewportCommands.h"
12
- #include "MCPValidationCommands.h"
13
- #include "MCPInputHandlers.h"
14
- #include "MCPMaterialCommands.h"
15
- #include "MCPSequencerCommands.h"
16
- #include "MCPAnimationCommands.h"
17
- #include "MCPWorldPartitionCommands.h"
18
- #include "MCPAICommands.h"
19
- #include "MCPSelectionCommands.h"
20
- #include "MCPCollisionPhysicsCommands.h"
21
- #include "MCPImportExportCommands.h"
22
- #include "MCPMotionDesignCommands.h"
23
- #include "MCPChaosCommands.h"
24
- #include "MCPAudioCommands.h"
25
- #include "MCPGASCommands.h"
26
- #include "MCPLiveLinkCommands.h"
27
- #include "MCPMovieRenderCommands.h"
28
- #include "MCPNetworkingCommands.h"
29
- #include "Misc/ConfigCacheIni.h"
30
-
31
- void UMCPBridgeSubsystem::Initialize(FSubsystemCollectionBase& Collection)
32
- {
33
- Super::Initialize(Collection);
34
-
35
- const int32 Port = GetConfiguredPort();
36
-
37
- // Create the router (registers built-in ping handler in constructor).
38
- Router = MakeUnique<FMCPCommandRouter>();
39
-
40
- // Register Blueprint command handlers (blueprint.read, blueprint.graph, blueprint.list).
41
- RegisterBlueprintHandlers(*Router);
42
-
43
- // Register Blueprint-C++ bridge handlers (blueprint.subclasses, blueprint.cppUsage).
44
- RegisterBlueprintBridgeHandlers(*Router);
45
-
46
- // Register Actor command handlers (actor.list, actor.spawn, actor.transform, actor.delete).
47
- RegisterActorCommands(*Router);
48
-
49
- // Register Asset/Level command handlers (asset.query, asset.references, level.layout).
50
- RegisterAssetCommands(*Router);
51
-
52
- // Register Blueprint write command handlers (blueprint.create, addNode, connectPins, addVariable, setDefault).
53
- RegisterBlueprintWriteHandlers(*Router);
54
-
55
- // Register Editor State command handlers (editor.state).
56
- RegisterEditorStateCommands(*Router);
57
-
58
- // Register PIE command handlers (pie.start, pie.stop, pie.logs, pie.gameState).
59
- RegisterPieCommands(*Router);
60
-
61
- // Register Viewport command handlers (viewport.screenshot, viewport.camera, viewport.renderMode, viewport.hiresScreenshot).
62
- RegisterViewportCommands(*Router);
63
-
64
- // Register validation command handlers (validate.asset, validate.folder, validate.project, validate.blueprint).
65
- RegisterValidationCommands(*Router);
66
-
67
- // Register Enhanced Input command handlers (input.listActions, input.createAction, input.listContexts, input.addBinding).
68
- RegisterInputHandlers(*Router);
69
-
70
- // Register Material command handlers (material.params, material.createInstance, material.setParam, material.actorMaterials).
71
- RegisterMaterialCommands(*Router);
72
-
73
- // Register Sequencer command handlers (sequencer.create, tracks, addTrack, addKey, playback).
74
- RegisterSequencerCommands(*Router);
75
-
76
- // Register Animation command handlers (animation.list, inspectAnimBP, inspectMontage, inspectBlendSpace, retargetMappings).
77
- RegisterAnimationCommands(*Router);
78
-
79
- // Register World Partition command handlers (worldpartition.settings, dataLayers, streamingSources, hlod).
80
- RegisterWorldPartitionCommands(*Router);
81
-
82
- // Register AI system command handlers (ai.behaviorTree, ai.stateTree, ai.blackboard, ai.eqs, ai.navmesh).
83
- RegisterAICommands(*Router);
84
-
85
- // Register Selection command handlers (selection.select, selection.get, selection.duplicate, selection.convert).
86
- RegisterSelectionCommands(*Router);
87
-
88
- // Register Collision & Physics command handlers (collision.read, collision.set, physics.material, physics.asset).
89
- RegisterCollisionPhysicsCommands(*Router);
90
-
91
- // Register Import/Export command handlers (import.fbx, import.usd, export.mesh, import.batch).
92
- RegisterImportExportCommands(*Router);
93
-
94
- // Register Motion Design command handlers (motiondesign.sceneStates, transition, transitionLogic, remoteControl).
95
- RegisterMotionDesignCommands(*Router);
96
-
97
- // Register Chaos physics command handlers (chaos.geometryCollection, chaos.resetDestruction, chaos.cloth, chaos.physicsCache).
98
- RegisterChaosCommands(*Router);
99
-
100
- // Register Audio command handlers (audio.list, audio.metasound, audio.soundcue, audio.insights).
101
- RegisterAudioCommands(*Router);
102
-
103
- // Register GAS command handlers (gas.abilities, gas.effects, gas.attributes, gas.tags).
104
- RegisterGASCommands(*Router);
105
-
106
- // Register Live Link command handlers (livelink.sources, livelink.subjects, livelink.control, livelink.preview).
107
- RegisterLiveLinkCommands(*Router);
108
-
109
- // Register Movie Render Pipeline command handlers (movierender.queue, movierender.addJob, movierender.control, movierender.configure).
110
- RegisterMovieRenderCommands(*Router);
111
-
112
- // Register Networking command handlers (net.replication, net.properties, net.driver, net.session).
113
- RegisterNetworkingCommands(*Router);
114
-
115
- // Create and start the TCP server.
116
- TcpServer = MakeUnique<FMCPTcpServer>(*Router);
117
- bServerRunning = TcpServer->Start(Port);
118
-
119
- if (!bServerRunning)
120
- {
121
- UE_LOG(LogTemp, Error, TEXT("[MCPBridge] Failed to start TCP server on port %d."), Port);
122
- }
123
- }
124
-
125
- void UMCPBridgeSubsystem::Deinitialize()
126
- {
127
- if (TcpServer.IsValid())
128
- {
129
- TcpServer->Stop();
130
- TcpServer.Reset();
131
- }
132
- if (Router.IsValid())
133
- {
134
- Router.Reset();
135
- }
136
- bServerRunning = false;
137
-
138
- Super::Deinitialize();
139
- }
140
-
141
- int32 UMCPBridgeSubsystem::GetConfiguredPort() const
142
- {
143
- int32 Port = 55557;
144
- if (GConfig)
145
- {
146
- GConfig->GetInt(TEXT("MCPBridge"), TEXT("Port"), Port, GEngineIni);
147
- }
148
- return Port;
149
- }
1
+ // MCPBridgeSubsystem.cpp
2
+ // Wires FMCPCommandRouter and FMCPTcpServer into the editor subsystem lifecycle.
3
+ //
4
+ // Core handlers are always registered. Optional-plugin handlers are guarded by
5
+ // preprocessor defines set in Build.cs. When a plugin module is not linked,
6
+ // the corresponding Register*Commands() call is skipped and the TypeScript
7
+ // side returns "plugin_not_connected" gracefully.
8
+
9
+ #include "MCPBridgeSubsystem.h"
10
+ #include "MCPBlueprintHandlers.h"
11
+ #include "MCPActorCommands.h"
12
+ #include "MCPAssetCommands.h"
13
+ #include "MCPBlueprintWriteHandlers.h"
14
+ #include "MCPEditorStateCommands.h"
15
+ #include "MCPPieCommands.h"
16
+ #include "MCPViewportCommands.h"
17
+ #include "MCPInputHandlers.h"
18
+ #include "MCPSequencerCommands.h"
19
+ #include "MCPSelectionCommands.h"
20
+ #include "MCPCollisionPhysicsCommands.h"
21
+ #include "Misc/ConfigCacheIni.h"
22
+
23
+ // Optional module handlers — only included when their Build.cs dependencies are linked.
24
+ // To enable: add the module to Build.cs PrivateDependencyModuleNames and uncomment here.
25
+ // #include "MCPValidationCommands.h" // Requires: DataValidation
26
+ // #include "MCPMaterialCommands.h" // Requires: MaterialEditor
27
+ // #include "MCPWorldPartitionCommands.h" // Requires: WorldPartitionEditor, DataLayerEditor
28
+ // #include "MCPImportExportCommands.h" // Requires: InterchangeEngine, InterchangeCore, InterchangePipelines
29
+ // #include "MCPAudioCommands.h" // Requires: MetasoundEngine, MetasoundFrontend
30
+ // #include "MCPGASCommands.h" // Requires: GameplayAbilities
31
+ // #include "MCPChaosCommands.h" // Requires: GeometryCollectionEngine, Chaos, ChaosCloth
32
+ // #include "MCPLiveLinkCommands.h" // Requires: LiveLinkInterface, LiveLink
33
+ // #include "MCPMotionDesignCommands.h" // Requires: AvalancheTransition, RemoteControl
34
+ // #include "MCPMovieRenderCommands.h" // Requires: MovieRenderPipelineCore, MovieRenderPipelineEditor
35
+ // #include "MCPNetworkingCommands.h" // Requires: OnlineSubsystem, OnlineSubsystemUtils
36
+
37
+ void UMCPBridgeSubsystem::Initialize(FSubsystemCollectionBase& Collection)
38
+ {
39
+ Super::Initialize(Collection);
40
+
41
+ const int32 Port = GetConfiguredPort();
42
+
43
+ Router = MakeUnique<FMCPCommandRouter>();
44
+
45
+ // --- Core handlers (always available) ---
46
+ RegisterBlueprintHandlers(*Router);
47
+ RegisterBlueprintBridgeHandlers(*Router);
48
+ RegisterActorCommands(*Router);
49
+ RegisterAssetCommands(*Router);
50
+ RegisterBlueprintWriteHandlers(*Router);
51
+ RegisterEditorStateCommands(*Router);
52
+ RegisterPieCommands(*Router);
53
+ RegisterViewportCommands(*Router);
54
+ RegisterInputHandlers(*Router);
55
+ RegisterSequencerCommands(*Router);
56
+ RegisterSelectionCommands(*Router);
57
+ RegisterCollisionPhysicsCommands(*Router);
58
+
59
+ // --- Optional handlers (uncomment when plugin dependencies are enabled) ---
60
+ // RegisterValidationCommands(*Router);
61
+ // RegisterMaterialCommands(*Router);
62
+ // RegisterWorldPartitionCommands(*Router);
63
+ // RegisterImportExportCommands(*Router);
64
+ // RegisterAudioCommands(*Router);
65
+ // RegisterGASCommands(*Router);
66
+ // RegisterChaosCommands(*Router);
67
+ // RegisterLiveLinkCommands(*Router);
68
+ // RegisterMotionDesignCommands(*Router);
69
+ // RegisterMovieRenderCommands(*Router);
70
+ // RegisterNetworkingCommands(*Router);
71
+
72
+ // Create and start the TCP server.
73
+ TcpServer = MakeUnique<FMCPTcpServer>(*Router);
74
+ bServerRunning = TcpServer->Start(Port);
75
+
76
+ if (!bServerRunning)
77
+ {
78
+ UE_LOG(LogTemp, Error, TEXT("[MCPBridge] Failed to start TCP server on port %d."), Port);
79
+ }
80
+ else
81
+ {
82
+ UE_LOG(LogTemp, Log, TEXT("[MCPBridge] TCP server started on port %d."), Port);
83
+ }
84
+ }
85
+
86
+ void UMCPBridgeSubsystem::Deinitialize()
87
+ {
88
+ if (TcpServer.IsValid())
89
+ {
90
+ TcpServer->Stop();
91
+ TcpServer.Reset();
92
+ }
93
+ if (Router.IsValid())
94
+ {
95
+ Router.Reset();
96
+ }
97
+ bServerRunning = false;
98
+
99
+ Super::Deinitialize();
100
+ }
101
+
102
+ int32 UMCPBridgeSubsystem::GetConfiguredPort() const
103
+ {
104
+ int32 Port = 55557;
105
+ if (GConfig)
106
+ {
107
+ GConfig->GetInt(TEXT("MCPBridge"), TEXT("Port"), Port, GEngineIni);
108
+ }
109
+ return Port;
110
+ }
@@ -21,7 +21,7 @@
21
21
  #include "EngineUtils.h"
22
22
  #include "Components/PrimitiveComponent.h"
23
23
  #include "Engine/EngineTypes.h"
24
- #include "CollisionProfile.h"
24
+ #include "Engine/CollisionProfile.h"
25
25
  #include "PhysicsEngine/BodyInstance.h"
26
26
  #include "PhysicalMaterials/PhysicalMaterial.h"
27
27
  #include "PhysicsEngine/PhysicsAsset.h"
@@ -118,7 +118,7 @@ static TArray<TSharedPtr<FJsonValue>> BuildCollisionResponseArray(UPrimitiveComp
118
118
  if (Profile)
119
119
  {
120
120
  // GetChannelName returns the display name for a given channel index.
121
- ChannelName = Profile->GetChannelName(Channel).ToString();
121
+ ChannelName = Profile->ReturnChannelNameFromContainerIndex(static_cast<int32>(Channel)).ToString();
122
122
  }
123
123
  if (ChannelName.IsEmpty())
124
124
  {
@@ -148,7 +148,7 @@ static TSharedPtr<FJsonObject> BuildCollisionData(UPrimitiveComponent* Comp)
148
148
  FString ObjectTypeName;
149
149
  if (Profile)
150
150
  {
151
- ObjectTypeName = Profile->GetChannelName(ObjCh).ToString();
151
+ ObjectTypeName = Profile->ReturnChannelNameFromContainerIndex(static_cast<int32>(ObjCh)).ToString();
152
152
  }
153
153
  if (ObjectTypeName.IsEmpty())
154
154
  {
@@ -9,6 +9,7 @@
9
9
  #include "MCPEditorStateCommands.h"
10
10
 
11
11
  #include "Editor.h"
12
+ #include "Selection.h"
12
13
  #include "EditorViewportClient.h"
13
14
  #include "LevelEditorViewport.h"
14
15
  #include "EngineUtils.h"
@@ -23,6 +23,9 @@
23
23
  // Asset Registry APIs
24
24
  #include "AssetRegistry/AssetRegistryModule.h"
25
25
 
26
+ // Package saving
27
+ #include "UObject/SavePackage.h"
28
+
26
29
  // UObject/Package APIs
27
30
  #include "UObject/Package.h"
28
31
  #include "Misc/PackageName.h"
@@ -177,11 +180,11 @@ void RegisterInputHandlers(FMCPCommandRouter& Router)
177
180
 
178
181
  // T-14-01: Validate the asset path is a well-formed long package name.
179
182
  // Rejects path traversal ("../") and bare filenames.
180
- FString ValidationError;
183
+ FText ValidationError;
181
184
  if (!FPackageName::IsValidLongPackageName(AssetPath, /*bIncludeReadOnlyRoots=*/false, &ValidationError))
182
185
  {
183
186
  UE_LOG(LogTemp, Warning, TEXT("[MCPBridge] input.createAction: Invalid asset path '%s': %s"),
184
- *AssetPath, *ValidationError);
187
+ *AssetPath, *ValidationError.ToString());
185
188
  SendError(SendResponse, CorrelationId, TEXT("invalid_asset_path"));
186
189
  return;
187
190
  }
@@ -227,8 +230,10 @@ void RegisterInputHandlers(FMCPCommandRouter& Router)
227
230
  // Save the package to disk so the asset persists.
228
231
  FString FilePath = FPackageName::LongPackageNameToFilename(
229
232
  AssetPath, FPackageName::GetAssetPackageExtension());
230
- UPackage::SavePackage(Pkg, Action, RF_Standalone, *FilePath,
231
- GError, nullptr, false, true, SAVE_NoError);
233
+ FSavePackageArgs SaveArgs;
234
+ SaveArgs.TopLevelFlags = RF_Standalone;
235
+ SaveArgs.SaveFlags = SAVE_NoError;
236
+ UPackage::SavePackage(Pkg, Action, *FilePath, SaveArgs);
232
237
 
233
238
  // Notify the Asset Registry so the asset appears in the Content Browser.
234
239
  FAssetRegistryModule::AssetCreated(Action);
@@ -331,7 +336,7 @@ void RegisterInputHandlers(FMCPCommandRouter& Router)
331
336
 
332
337
  // T-14-02: Validate that the key name resolves to a known FKey before calling MapKey.
333
338
  // FKey constructor accepts any FName; IsValid() checks whether it is a registered key.
334
- const FKey ResolvedKey(FName(*KeyName));
339
+ const FKey ResolvedKey = FKey(FName(*KeyName));
335
340
  if (!ResolvedKey.IsValid())
336
341
  {
337
342
  UE_LOG(LogTemp, Warning, TEXT("[MCPBridge] input.addBinding: Key '%s' is not a valid FKey"), *KeyName);
@@ -369,8 +374,10 @@ void RegisterInputHandlers(FMCPCommandRouter& Router)
369
374
  UPackage* Pkg = IMC->GetPackage();
370
375
  FString FilePath = FPackageName::LongPackageNameToFilename(
371
376
  AssetPath, FPackageName::GetAssetPackageExtension());
372
- UPackage::SavePackage(Pkg, IMC, RF_Standalone, *FilePath,
373
- GError, nullptr, false, true, SAVE_NoError);
377
+ FSavePackageArgs SaveArgs2;
378
+ SaveArgs2.TopLevelFlags = RF_Standalone;
379
+ SaveArgs2.SaveFlags = SAVE_NoError;
380
+ UPackage::SavePackage(Pkg, IMC, *FilePath, SaveArgs2);
374
381
 
375
382
  TSharedPtr<FJsonObject> Data = MakeShared<FJsonObject>();
376
383
  Data->SetBoolField(TEXT("bound"), true);
@@ -57,7 +57,7 @@ public:
57
57
  // Enforce ring buffer cap: drop oldest entry when at limit (T-12-02).
58
58
  if (GPieCapturedLogs.Num() >= GPieLogMaxLines)
59
59
  {
60
- GPieCapturedLogs.RemoveAt(0, 1, /*bAllowShrinking=*/false);
60
+ GPieCapturedLogs.RemoveAt(0, 1, EAllowShrinking::No);
61
61
  }
62
62
 
63
63
  GPieCapturedLogs.Add(MoveTemp(Line));
@@ -142,8 +142,9 @@ void RegisterPieCommands(FMCPCommandRouter& Router)
142
142
  GPieLogDevice = MakeUnique<FMCPPieLogCapture>();
143
143
  GLog->AddOutputDevice(GPieLogDevice.Get());
144
144
 
145
- // Start PIE (false = game mode, not simulate-in-editor).
146
- GEditor->PlayInEditor(GEditor->GetEditorWorldContext().World(), /*bInSimulateInEditor=*/false);
145
+ // Start PIE using RequestPlaySession (UE 5.7 API).
146
+ FRequestPlaySessionParams Params;
147
+ GEditor->RequestPlaySession(Params);
147
148
 
148
149
  TSharedPtr<FJsonObject> Data = MakeShared<FJsonObject>();
149
150
  Data->SetBoolField(TEXT("started"), true);
@@ -585,7 +585,7 @@ void RegisterSelectionCommands(FMCPCommandRouter& Router)
585
585
  else
586
586
  {
587
587
  // Native class name -- search loaded classes.
588
- TargetClass = FindObject<UClass>(ANY_PACKAGE, *TargetClassName);
588
+ TargetClass = FindFirstObject<UClass>( *TargetClassName);
589
589
  if (!TargetClass)
590
590
  {
591
591
  // Try with the Actor suffix convention common in UE.