ue-mcp 1.4.13 → 1.4.14-beta.2

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 (137) hide show
  1. package/README.md +5 -5
  2. package/dist/bridge/bridge-timeouts.js +4 -0
  3. package/dist/bridge/bridge-timeouts.js.map +1 -1
  4. package/dist/cli/cli-commands.js +1 -0
  5. package/dist/cli/cli-commands.js.map +1 -1
  6. package/dist/cli/doctor.js +2 -1
  7. package/dist/cli/doctor.js.map +1 -1
  8. package/dist/cli/init.js +1 -1
  9. package/dist/cli/init.js.map +1 -1
  10. package/dist/cli/projects-cli.d.ts +3 -0
  11. package/dist/cli/projects-cli.js +72 -0
  12. package/dist/cli/projects-cli.js.map +1 -0
  13. package/dist/config/user-state.d.ts +10 -0
  14. package/dist/config/user-state.js +21 -0
  15. package/dist/config/user-state.js.map +1 -1
  16. package/dist/core/env.d.ts +2 -0
  17. package/dist/core/env.js +2 -0
  18. package/dist/core/env.js.map +1 -1
  19. package/dist/core/types.d.ts +27 -0
  20. package/dist/daemon/daemon.js +44 -5
  21. package/dist/daemon/daemon.js.map +1 -1
  22. package/dist/daemon/extension-api.d.ts +8 -5
  23. package/dist/daemon-api.d.ts +2 -1
  24. package/dist/daemon-api.js +1 -0
  25. package/dist/daemon-api.js.map +1 -1
  26. package/dist/dispatch/offline.js +1 -0
  27. package/dist/dispatch/offline.js.map +1 -1
  28. package/dist/editor/dialog-guard.d.ts +12 -2
  29. package/dist/editor/dialog-guard.js +68 -2
  30. package/dist/editor/dialog-guard.js.map +1 -1
  31. package/dist/editor/editor-control.js +1 -1
  32. package/dist/editor/editor-control.js.map +1 -1
  33. package/dist/flow/write-methods.js +1 -1
  34. package/dist/flow/write-methods.js.map +1 -1
  35. package/dist/machine/projects.d.ts +85 -0
  36. package/dist/machine/projects.js +286 -0
  37. package/dist/machine/projects.js.map +1 -0
  38. package/dist/pie/script-events.d.ts +4 -1
  39. package/dist/pie/script-events.js.map +1 -1
  40. package/dist/surface/context/instructions.js +20 -0
  41. package/dist/surface/context/instructions.js.map +1 -1
  42. package/dist/tool-counts.json +12 -12
  43. package/dist/tools/asset.js +2 -1
  44. package/dist/tools/asset.js.map +1 -1
  45. package/dist/tools/editor.js +1 -1
  46. package/dist/tools/editor.js.map +1 -1
  47. package/dist/tools/epic/effects.js +11 -0
  48. package/dist/tools/epic/effects.js.map +1 -1
  49. package/dist/tools/epic/fab.generated.d.ts +6 -0
  50. package/dist/tools/epic/fab.generated.js +67 -0
  51. package/dist/tools/epic/fab.generated.js.map +1 -0
  52. package/dist/tools/epic/index.d.ts +2 -0
  53. package/dist/tools/epic/index.js +2 -0
  54. package/dist/tools/epic/index.js.map +1 -1
  55. package/dist/tools/epic/toolset-routes.js +2 -0
  56. package/dist/tools/epic/toolset-routes.js.map +1 -1
  57. package/dist/tools/epic.js +4 -4
  58. package/dist/tools/epic.js.map +1 -1
  59. package/dist/tools/fab-epic.d.ts +23 -0
  60. package/dist/tools/fab-epic.js +109 -0
  61. package/dist/tools/fab-epic.js.map +1 -0
  62. package/dist/tools/fab.js +27 -18
  63. package/dist/tools/fab.js.map +1 -1
  64. package/dist/tools/level.js +9 -2
  65. package/dist/tools/level.js.map +1 -1
  66. package/dist/tools/material.js +1 -1
  67. package/dist/tools/material.js.map +1 -1
  68. package/dist/tools/pie.js +1 -1
  69. package/dist/tools/pie.js.map +1 -1
  70. package/dist/tools/specs/asset.generated.js +92 -3
  71. package/dist/tools/specs/asset.generated.js.map +1 -1
  72. package/dist/tools/specs/fab.generated.js +143 -3
  73. package/dist/tools/specs/fab.generated.js.map +1 -1
  74. package/dist/tools/specs/level.generated.js +183 -9
  75. package/dist/tools/specs/level.generated.js.map +1 -1
  76. package/dist/tools/specs/pie.generated.js +28 -8
  77. package/dist/tools/specs/pie.generated.js.map +1 -1
  78. package/dist/tools/specs/widget.generated.js +8 -1
  79. package/dist/tools/specs/widget.generated.js.map +1 -1
  80. package/dist/ue-mcp.default.yml +522 -76
  81. package/package.json +2 -2
  82. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/BridgeServer.cpp +26 -0
  83. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Asset/AssetHandlers.cpp +24 -0
  84. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Asset/AssetHandlers.h +7 -0
  85. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Asset/AssetHandlers_Mesh.cpp +483 -10
  86. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Dialog/DialogHandlers.cpp +345 -1
  87. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Epic/EpicHandlers_AIAssistant.cpp +34 -6
  88. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Fab/FabDownloads.cpp +766 -0
  89. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Fab/FabDownloads.h +26 -0
  90. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Fab/FabHandlers.cpp +159 -55
  91. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Fab/FabHandlers.h +23 -12
  92. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Fab/FabLibrary.cpp +306 -0
  93. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Fab/FabLibrary.h +55 -0
  94. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Level/LevelHandlers.cpp +34 -2
  95. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Level/LevelHandlers.h +9 -0
  96. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Level/LevelHandlers_Blockout.cpp +12 -8
  97. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Level/LevelHandlers_PerfAudit.cpp +3 -1
  98. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Level/LevelHandlers_Refresh.cpp +479 -0
  99. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Level/LevelHandlers_ReplaceActors.cpp +2 -0
  100. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Level/LevelHandlers_WorldPartition.cpp +824 -12
  101. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Material/MaterialHandlers.cpp +95 -1
  102. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PCG/PCGHandlers.cpp +13 -0
  103. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/MCPPIETestScript.h +8 -3
  104. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEHandlers.cpp +2 -0
  105. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEHandlers_Record.cpp +6 -0
  106. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEHandlers_Replay.cpp +1 -0
  107. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEHandlers_Script.cpp +2 -2
  108. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEInputRecorder.cpp +52 -1
  109. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEInputRecorder.h +16 -0
  110. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEInputReplayer.cpp +65 -1
  111. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEInputReplayer.h +15 -0
  112. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEReplayInputLock.cpp +146 -0
  113. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEReplayInputLock.h +53 -0
  114. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEScriptRunner.cpp +351 -14
  115. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEScriptRunner.h +55 -6
  116. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEScriptValidation.cpp +8 -1
  117. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIESequenceFormat.cpp +59 -0
  118. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIESequenceFormat.h +15 -2
  119. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEUIPointer.cpp +567 -0
  120. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/PIEUIPointer.h +173 -0
  121. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/PIE/SMCPPIEStudioPanel.cpp +41 -6
  122. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Handlers/Widget/WidgetHandlers.cpp +92 -32
  123. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Tests/FabDownloadTests.cpp +140 -0
  124. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Tests/FabEndToEndTests.cpp +365 -0
  125. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Tests/FabLibraryTests.cpp +52 -0
  126. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Tests/PCGGraphAuthoringTests.cpp +5 -2
  127. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Tests/PIEReplayInputLockTests.cpp +77 -0
  128. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Tests/PIEScriptTests.cpp +256 -0
  129. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Tests/PIEScriptValidationTests.cpp +18 -0
  130. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/Tests/PIEUIPointerTests.cpp +246 -0
  131. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/Private/UE_MCP_Bridge.cpp +4 -0
  132. package/plugin/ue_mcp_bridge/Source/UE_MCP_Bridge/UE_MCP_Bridge.Build.cs +85 -13
  133. package/plugin/ue_mcp_bridge/Source/UE_MCP_BridgeRuntime/Private/MCPPIEActionTrigger.cpp +48 -0
  134. package/plugin/ue_mcp_bridge/Source/UE_MCP_BridgeRuntime/Private/MCPPIERemoteControl.cpp +93 -0
  135. package/plugin/ue_mcp_bridge/Source/UE_MCP_BridgeRuntime/Public/MCPPIEActionTrigger.h +52 -0
  136. package/plugin/ue_mcp_bridge/Source/UE_MCP_BridgeRuntime/Public/MCPPIERemoteControl.h +54 -0
  137. package/plugin/ue_mcp_bridge/UE_MCP_Bridge.uplugin +2 -2
@@ -0,0 +1,26 @@
1
+ #pragma once
2
+
3
+ #include "CoreMinimal.h"
4
+ #include "Dom/JsonObject.h"
5
+ #include "Interfaces/IBuildManifest.h"
6
+
7
+ namespace MCPFab
8
+ {
9
+ struct FAssetVersion
10
+ {
11
+ FString ListingId, Title, AssetId, Namespace, ArtifactId, Platform, EngineVersion;
12
+ };
13
+
14
+ bool ResolveVersion(const TArray<TSharedPtr<FJsonValue>>& Items, const FString& ListingId,
15
+ const FString& EngineVersion, const FString& Platform, FAssetVersion& Out, FString& Error);
16
+ bool ValidatePackManifest(const IBuildManifestRef& Manifest, FString& Error);
17
+ bool SafePackPath(const FString& Relative);
18
+ FString ChunkUrl(const FString& ManifestUrl, const FString& Subdirectory, const FString& ChunkPath);
19
+
20
+ bool HasActiveDownloads();
21
+ void ShutdownDownloads();
22
+
23
+ #if WITH_DEV_AUTOMATION_TESTS
24
+ FString StartFixtureDownload(const IBuildManifestRef& Manifest, const FString& Cloud, const FString& Output, bool bVerifyOnly = false);
25
+ #endif
26
+ }
@@ -1,4 +1,6 @@
1
1
  #include "FabHandlers.h"
2
+ #include "FabLibrary.h"
3
+ #include "FabDownloads.h"
2
4
  #include "HandlerRegistry.h"
3
5
  #include "HandlerUtils.h"
4
6
 
@@ -7,6 +9,9 @@
7
9
  #include "Misc/PackageName.h"
8
10
  #include "Engine/Engine.h"
9
11
  #include "HAL/PlatformProcess.h"
12
+ #include "Interfaces/IPluginManager.h"
13
+ #include "Misc/Paths.h"
14
+ #include "Runtime/Launch/Resources/Version.h"
10
15
 
11
16
  #ifndef WITH_FAB_PLUGIN
12
17
  #define WITH_FAB_PLUGIN 0
@@ -21,15 +26,73 @@
21
26
 
22
27
  static const TCHAR* FabModuleName = TEXT("Fab");
23
28
 
24
- // The Fab plugin is an engine editor plugin, enabled by default on 5.8 but not
25
- // guaranteed to be present or loaded (disabled, or an older engine). Every
26
- // action funnels through this so callers get a clear message instead of a
27
- // crash or an "Unknown method".
29
+ // The Fab plugin is not part of the engine install. The Epic Games Launcher
30
+ // delivers it as its own catalog item, "Fab UE Plugin" (app FabPlugin_<x.y>,
31
+ // flagged to install with the engine), into Engine/Plugins/Fab. A UE 5.9
32
+ // install can come without it (#1889), a source build never has it, and a
33
+ // project can disable it. Every action funnels through IsFabModuleLoaded so
34
+ // callers get a clear message instead of a crash or an "Unknown method".
28
35
  static bool IsFabModuleLoaded()
29
36
  {
30
37
  return FModuleManager::Get().IsModuleLoaded(FabModuleName);
31
38
  }
32
39
 
40
+ // Why Fab cannot answer, as one sentence naming what is missing and how to get
41
+ // it. Distinguishes a plugin that is not installed in this engine from one that
42
+ // is installed but disabled or not loaded.
43
+ static FString FabUnavailableReason()
44
+ {
45
+ const FString EngineVersion = FString::Printf(TEXT("%d.%d"), ENGINE_MAJOR_VERSION, ENGINE_MINOR_VERSION);
46
+ TSharedPtr<IPlugin> Plugin = IPluginManager::Get().FindPlugin(FabModuleName);
47
+ if (!Plugin.IsValid())
48
+ {
49
+ return FString::Printf(
50
+ TEXT("The Fab plugin is not installed in this engine (looked for %s). Unreal Engine %s does not bundle it: the Epic Games Launcher installs it as "
51
+ "the separate 'Fab UE Plugin' item (FabPlugin_%s). In the launcher open Unreal Engine > Library, find Fab UE Plugin, choose Install to Engine "
52
+ "and pick %s, then restart the editor. A source-built engine needs the plugin copied into Engine/Plugins/Fab."),
53
+ *FPaths::ConvertRelativePathToFull(FPaths::Combine(FPaths::EnginePluginsDir(), TEXT("Fab"))),
54
+ *EngineVersion, *EngineVersion, *EngineVersion);
55
+ }
56
+ if (!Plugin->IsEnabled())
57
+ {
58
+ return FString::Printf(
59
+ TEXT("The Fab plugin is installed (%s) but this project disables it. Enable Fab in Edit > Plugins (or set \"Enabled\": true for Fab in the .uproject) and restart the editor."),
60
+ *FPaths::ConvertRelativePathToFull(Plugin->GetBaseDir()));
61
+ }
62
+ return FString::Printf(
63
+ TEXT("The Fab plugin is installed and enabled (%s) but its module is not loaded. Restart the editor; if it still does not load, check the log for Fab module load errors."),
64
+ *FPaths::ConvertRelativePathToFull(Plugin->GetBaseDir()));
65
+ }
66
+
67
+ // The refusal every Fab action returns while the module is not loaded:
68
+ // errorCode PLUGIN_NOT_AVAILABLE, the reason, and the plugin's state.
69
+ static TSharedPtr<FJsonValue> FabUnavailableError()
70
+ {
71
+ TSharedPtr<FJsonObject> Obj = MCPErrorObject(FabUnavailableReason());
72
+ Obj->SetStringField(TEXT("errorCode"), TEXT("PLUGIN_NOT_AVAILABLE"));
73
+ TSharedPtr<IPlugin> Plugin = IPluginManager::Get().FindPlugin(FabModuleName);
74
+ Obj->SetBoolField(TEXT("pluginInstalled"), Plugin.IsValid());
75
+ Obj->SetBoolField(TEXT("pluginEnabled"), Plugin.IsValid() && Plugin->IsEnabled());
76
+ return MakeShared<FJsonValueObject>(Obj);
77
+ }
78
+
79
+ // The same check and refusal for the handlers defined in FabDownloads.cpp.
80
+ bool FFabHandlers::IsFabLoaded() { return IsFabModuleLoaded(); }
81
+ TSharedPtr<FJsonValue> FFabHandlers::UnavailableError() { return FabUnavailableError(); }
82
+
83
+ // The refusal of an action that needs the native Fab API when this build of
84
+ // the bridge was compiled without it, although the module is loaded now. Only
85
+ // defined where it is called, so a build with Fab has no unused function.
86
+ #if !WITH_FAB_PLUGIN
87
+ static TSharedPtr<FJsonValue> FabNativeApiMissingError(const TCHAR* What)
88
+ {
89
+ return MCPErrorWithCode(TEXT("PLUGIN_NOT_AVAILABLE"), FString::Printf(
90
+ TEXT("%s needs the Fab plugin's native API, and this build of the bridge was compiled without it because the Fab plugin was not in the engine "
91
+ "when the bridge was built. Rebuild the UE_MCP_Bridge plugin now that Fab is installed."),
92
+ What));
93
+ }
94
+ #endif
95
+
33
96
  // Run one of the Fab plugin's registered console commands (Fab.Login,
34
97
  // Fab.Logout, Fab.ClearCache, Fab.TEDS.MyFolderIntegration, ...). These are
35
98
  // FAutoConsoleCommands, so they route through GEngine->Exec without any
@@ -83,12 +146,29 @@ TSharedPtr<FJsonValue> FFabHandlers::Status(const TSharedPtr<FJsonObject>& Param
83
146
  // native Fab API in this build, vs. console-command-only.
84
147
  Res->SetBoolField(TEXT("nativeApiLinked"), WITH_FAB_PLUGIN ? true : false);
85
148
  Res->SetBoolField(TEXT("fabWindowOpened"), HasFabBrowserApiInstance());
149
+ TSharedPtr<IPlugin> Plugin = IPluginManager::Get().FindPlugin(FabModuleName);
150
+ Res->SetBoolField(TEXT("pluginInstalled"), Plugin.IsValid());
151
+ Res->SetBoolField(TEXT("pluginEnabled"), Plugin.IsValid() && Plugin->IsEnabled());
152
+ if (Plugin.IsValid())
153
+ {
154
+ Res->SetStringField(TEXT("pluginDir"), FPaths::ConvertRelativePathToFull(Plugin->GetBaseDir()));
155
+ Res->SetStringField(TEXT("pluginVersion"), Plugin->GetDescriptor().VersionName);
156
+ }
157
+ Res->SetObjectField(TEXT("librarySync"), MCPFab::Library().Describe());
158
+ MCPFab::FSession Session; FString AuthError;
159
+ Res->SetBoolField(TEXT("authenticated"), bLoaded && MCPFab::ReadSession(Session, AuthError));
86
160
 
87
161
  if (!bLoaded)
88
162
  {
89
- Res->SetStringField(TEXT("note"), TEXT("Fab plugin module not loaded. It ships enabled by default on UE 5.8; enable it in the editor's Plugins panel if missing."));
163
+ // Still a successful read: status reports the state, and the reason is
164
+ // the same sentence every other Fab action refuses with.
165
+ Res->SetStringField(TEXT("errorCode"), TEXT("PLUGIN_NOT_AVAILABLE"));
166
+ Res->SetStringField(TEXT("note"), FString::Printf(TEXT("Fab plugin module not loaded. %s"), *FabUnavailableReason()));
90
167
  return MCPResult(Res);
91
168
  }
169
+ #if !WITH_FAB_PLUGIN
170
+ Res->SetStringField(TEXT("note"), TEXT("The Fab module is loaded, but this build of the bridge was compiled without the Fab plugin's native API, so list_cached, cache_info and import_file refuse until the bridge is rebuilt with Fab installed."));
171
+ #endif
92
172
 
93
173
  #if WITH_FAB_PLUGIN
94
174
  Res->SetStringField(TEXT("cacheLocation"), FFabAssetsCache::GetCacheLocation());
@@ -100,21 +180,30 @@ TSharedPtr<FJsonValue> FFabHandlers::Status(const TSharedPtr<FJsonObject>& Param
100
180
 
101
181
  TSharedPtr<FJsonValue> FFabHandlers::Login(const TSharedPtr<FJsonObject>& Params)
102
182
  {
103
- if (!IsFabModuleLoaded()) return MCPError(TEXT("Fab plugin not loaded"));
183
+ if (!IsFabModuleLoaded()) return FabUnavailableError();
184
+ // Already signed in: say so instead of putting a sign-in window in front of
185
+ // the user for an account they are already using.
186
+ {
187
+ MCPFab::FSession Existing; FString NoSession;
188
+ if (MCPFab::ReadSession(Existing, NoSession))
189
+ {
190
+ auto Already = MCPSuccess();
191
+ Already->SetBoolField(TEXT("authenticated"), true);
192
+ Already->SetBoolField(TEXT("unchanged"), true);
193
+ Already->SetStringField(TEXT("note"), TEXT("A Fab session is already active, so no sign-in window was opened. Call fab(sync_library) next."));
194
+ MCPSetNoRollback(Already, TEXT("Nothing changed: the existing session was left as it was."));
195
+ return MCPResult(Already);
196
+ }
197
+ }
104
198
  // Fab.Login opens the EOS account-portal login flow. Asynchronous: this
105
199
  // returns once the flow is triggered, not once the user has authenticated.
106
200
  if (!RunFabConsoleCommand(TEXT("Fab.Login")))
107
201
  return MCPError(TEXT("Failed to invoke Fab.Login console command"));
108
202
  auto Res = MCPSuccess();
109
203
  Res->SetStringField(TEXT("note"), TEXT("Login flow triggered. Complete authentication in the account-portal window if prompted; call fab(status) afterward."));
110
- // No idempotency flag, and the reason is stated rather than left as an
111
- // absence: the Fab module publishes no authentication or library-sync state
112
- // this build can read, so nothing here can measure whether the call changed
113
- // anything. A fabricated unchanged=false would be a claim, not a reading.
204
+ // Opening the portal cannot establish whether authentication will finish.
114
205
  Res->SetBoolField(TEXT("idempotencyObservable"), false);
115
- Res->SetStringField(TEXT("idempotencyNote"),
116
- TEXT("Whether an account was already signed in, and whether this flow ends in one being signed in, are both decided outside this call. Nothing in the Fab module reports that state back, so this call cannot say whether it changed "
117
- "anything. fab(status) is the closest reading available and does not cover it."));
206
+ Res->SetStringField(TEXT("idempotencyNote"), TEXT("The portal returns before authentication completes. Poll status.authenticated to observe the resulting native session; this call cannot attribute a later login to itself."));
118
207
 
119
208
  // No inverse. This opens the EOS account-portal flow and returns before
120
209
  // anything has authenticated, so it creates no state of its own to undo.
@@ -130,19 +219,15 @@ TSharedPtr<FJsonValue> FFabHandlers::Login(const TSharedPtr<FJsonObject>& Params
130
219
 
131
220
  TSharedPtr<FJsonValue> FFabHandlers::Logout(const TSharedPtr<FJsonObject>& Params)
132
221
  {
133
- if (!IsFabModuleLoaded()) return MCPError(TEXT("Fab plugin not loaded"));
222
+ if (!IsFabModuleLoaded()) return FabUnavailableError();
134
223
  if (!RunFabConsoleCommand(TEXT("Fab.Logout")))
135
224
  return MCPError(TEXT("Failed to invoke Fab.Logout console command"));
225
+ MCPFab::ResetLibrary();
226
+ FString ClearError; MCPFab::PublishLibrary({}, ClearError);
136
227
  auto Res = MCPSuccess();
137
- Res->SetStringField(TEXT("note"), TEXT("Persistent Fab auth cleared."));
138
- // No idempotency flag, and the reason is stated rather than left as an
139
- // absence: the Fab module publishes no authentication or library-sync state
140
- // this build can read, so nothing here can measure whether the call changed
141
- // anything. A fabricated unchanged=false would be a claim, not a reading.
228
+ Res->SetStringField(TEXT("note"), TEXT("Native Fab logout requested. Poll status.authenticated for completion."));
142
229
  Res->SetBoolField(TEXT("idempotencyObservable"), false);
143
- Res->SetStringField(TEXT("idempotencyNote"),
144
- TEXT("Whether a session was there to clear is not readable from here. Nothing in the Fab module reports that state back, so this call cannot say whether it changed "
145
- "anything. fab(status) is the closest reading available and does not cover it."));
230
+ Res->SetStringField(TEXT("idempotencyNote"), TEXT("EOS finishes logout asynchronously. Poll status.authenticated until false; this call cannot yet measure completion."));
146
231
 
147
232
  // No inverse. Logging back in means the user authenticating in the EOS
148
233
  // account portal; fab(login) only opens that window and cannot restore the
@@ -156,40 +241,28 @@ TSharedPtr<FJsonValue> FFabHandlers::Logout(const TSharedPtr<FJsonObject>& Param
156
241
 
157
242
  TSharedPtr<FJsonValue> FFabHandlers::SyncLibrary(const TSharedPtr<FJsonObject>& Params)
158
243
  {
159
- if (!IsFabModuleLoaded()) return MCPError(TEXT("Fab plugin not loaded"));
160
- // Loads the user's owned Fab library ("My Folder") into TEDS so it surfaces
161
- // in the Content Browser. Optional batch size controls how many items are
162
- // pulled per sync request.
163
- const int32 BatchSize = OptionalInt(Params, TEXT("batchSize"), 0);
164
- const FString Command = BatchSize > 0
165
- ? FString::Printf(TEXT("Fab.TEDS.MyFolderIntegration %d"), BatchSize)
166
- : FString(TEXT("Fab.TEDS.MyFolderIntegration"));
167
- if (!RunFabConsoleCommand(Command))
168
- return MCPError(TEXT("Failed to invoke Fab.TEDS.MyFolderIntegration console command"));
244
+ if (!IsFabModuleLoaded()) return FabUnavailableError();
245
+ const int32 BatchSize = OptionalInt(Params, TEXT("batchSize"), 100);
246
+ FString Error;
247
+ {
248
+ MCPFab::FSession Session;
249
+ if (!MCPFab::ReadSession(Session, Error))
250
+ return MCPErrorWithCode(TEXT("FAB_NOT_SIGNED_IN"), Error + TEXT(" Then call fab(sync_library) again."));
251
+ }
252
+ if (!MCPFab::StartLibrarySync(BatchSize, Error)) return MCPError(Error);
169
253
  auto Res = MCPSuccess();
170
- Res->SetStringField(TEXT("note"), TEXT("Library sync queued. Owned Fab items load into the Content Browser asynchronously; requires an active Fab login."));
171
- // No idempotency flag, and the reason is stated rather than left as an
172
- // absence: the Fab module publishes no authentication or library-sync state
173
- // this build can read, so nothing here can measure whether the call changed
174
- // anything. A fabricated unchanged=false would be a claim, not a reading.
254
+ Res->SetObjectField(TEXT("librarySync"), MCPFab::Library().Describe());
175
255
  Res->SetBoolField(TEXT("idempotencyObservable"), false);
176
- Res->SetStringField(TEXT("idempotencyNote"),
177
- TEXT("The sync runs asynchronously and its results land in the Content Browser after this call has returned. Nothing in the Fab module reports that state back, so this call cannot say whether it changed "
178
- "anything. fab(status) is the closest reading available and does not cover it."));
179
-
180
- // No inverse. This loads what the user already owns into the editor's TEDS
181
- // index so the Content Browser can show it. Nothing un-lists a library, and
182
- // the listing is rebuilt from the account on the next sync anyway.
256
+ Res->SetStringField(TEXT("idempotencyNote"), TEXT("Completion is observed asynchronously through librarySync; starting does not establish a changed snapshot."));
257
+ Res->SetStringField(TEXT("note"), TEXT("Sync started. Poll fab(status).librarySync for complete or failed; the previous snapshot is retained on failure."));
183
258
  Res->SetBoolField(TEXT("rollbackPossible"), false);
184
- Res->SetStringField(TEXT("rollbackNote"),
185
- TEXT("Syncing populates an in-editor index of the library the account already owns. There is no call that "
186
- "un-lists it, and nothing on disk or in the project changed."));
259
+ Res->SetStringField(TEXT("rollbackNote"), TEXT("Updates an in-editor index of already-owned content; no project files are changed."));
187
260
  return MCPResult(Res);
188
261
  }
189
262
 
190
263
  TSharedPtr<FJsonValue> FFabHandlers::ListCached(const TSharedPtr<FJsonObject>& Params)
191
264
  {
192
- if (!IsFabModuleLoaded()) return MCPError(TEXT("Fab plugin not loaded"));
265
+ if (!IsFabModuleLoaded()) return FabUnavailableError();
193
266
  #if WITH_FAB_PLUGIN
194
267
  auto Res = MCPSuccess();
195
268
  const TArray<FString> Cached = FFabAssetsCache::GetCachedAssets();
@@ -203,13 +276,13 @@ TSharedPtr<FJsonValue> FFabHandlers::ListCached(const TSharedPtr<FJsonObject>& P
203
276
  Res->SetStringField(TEXT("cacheLocation"), FFabAssetsCache::GetCacheLocation());
204
277
  return MCPResult(Res);
205
278
  #else
206
- return MCPError(TEXT("Fab native API not linked in this build (Fab plugin absent at build time). Cache listing unavailable."));
279
+ return FabNativeApiMissingError(TEXT("Listing the Fab download cache"));
207
280
  #endif
208
281
  }
209
282
 
210
283
  TSharedPtr<FJsonValue> FFabHandlers::CacheInfo(const TSharedPtr<FJsonObject>& Params)
211
284
  {
212
- if (!IsFabModuleLoaded()) return MCPError(TEXT("Fab plugin not loaded"));
285
+ if (!IsFabModuleLoaded()) return FabUnavailableError();
213
286
  #if WITH_FAB_PLUGIN
214
287
  auto Res = MCPSuccess();
215
288
  Res->SetStringField(TEXT("cacheLocation"), FFabAssetsCache::GetCacheLocation());
@@ -218,13 +291,14 @@ TSharedPtr<FJsonValue> FFabHandlers::CacheInfo(const TSharedPtr<FJsonObject>& Pa
218
291
  Res->SetNumberField(TEXT("count"), FFabAssetsCache::GetCachedAssets().Num());
219
292
  return MCPResult(Res);
220
293
  #else
221
- return MCPError(TEXT("Fab native API not linked in this build (Fab plugin absent at build time). Cache info unavailable."));
294
+ return FabNativeApiMissingError(TEXT("Reading the Fab download cache"));
222
295
  #endif
223
296
  }
224
297
 
225
298
  TSharedPtr<FJsonValue> FFabHandlers::ClearCache(const TSharedPtr<FJsonObject>& Params)
226
299
  {
227
- if (!IsFabModuleLoaded()) return MCPError(TEXT("Fab plugin not loaded"));
300
+ if (MCPFab::HasActiveDownloads()) return MCPError(TEXT("Pause or cancel active download jobs before clearing their cache."));
301
+ if (!IsFabModuleLoaded()) return FabUnavailableError();
228
302
 
229
303
  // Read the cache size first so the result can say whether this call actually
230
304
  // deleted anything. Only available when the native API is linked; without it
@@ -265,7 +339,7 @@ TSharedPtr<FJsonValue> FFabHandlers::ImportFile(const TSharedPtr<FJsonObject>& P
265
339
  FString Destination;
266
340
  if (auto Err = RequireString(Params, TEXT("destination"), Destination)) return Err;
267
341
 
268
- if (!IsFabModuleLoaded()) return MCPError(TEXT("Fab plugin not loaded"));
342
+ if (!IsFabModuleLoaded()) return FabUnavailableError();
269
343
  #if WITH_FAB_PLUGIN
270
344
  if (!FPaths::FileExists(Source))
271
345
  return MCPError(FString::Printf(TEXT("Source file not found on disk: %s"), *Source));
@@ -349,7 +423,7 @@ TSharedPtr<FJsonValue> FFabHandlers::ImportFile(const TSharedPtr<FJsonObject>& P
349
423
  }
350
424
  return MCPResult(Res);
351
425
  #else
352
- return MCPError(TEXT("Fab native API not linked in this build (Fab plugin absent at build time). Import unavailable."));
426
+ return FabNativeApiMissingError(TEXT("Importing through the Fab pipeline"));
353
427
  #endif
354
428
  }
355
429
 
@@ -412,8 +486,38 @@ void FFabHandlers::RegisterHandlers(FMCPHandlerRegistry& Registry)
412
486
  Registry.RegisterHandler(TEXT("fab_logout"), &Logout, {},
413
487
  MCPSpec::ContractExempt(TEXT("Takes no parameters and clears the stored Fab credentials when called")));
414
488
  Registry.RegisterHandler(TEXT("fab_sync_library"), &SyncLibrary, {
415
- MCPParam::Optional(TEXT("batchSize"), EType::Integer, TEXT("Library items to pull per sync request (default the plugin's own)")),
489
+ MCPParam::Optional(TEXT("batchSize"), EType::Integer, TEXT("Library items per request, 1-1000 (default 100)")),
416
490
  }, MCPSpec::ContractExempt(TEXT("Queues a Fab library sync whatever the batch size")));
491
+ Registry.RegisterHandler(TEXT("fab_list_owned"), &ListOwned, {
492
+ MCPParam::Optional(TEXT("query"), EType::String, TEXT("Filter owned item titles, no catalog requests")),
493
+ MCPParam::Optional(TEXT("offset"), EType::Integer, TEXT("Result offset (default 0)")),
494
+ MCPParam::Optional(TEXT("limit"), EType::Integer, TEXT("Result limit, 1-200 (default 50)")),
495
+ });
496
+ Registry.RegisterHandler(TEXT("fab_download"), &Download, {
497
+ MCPParam::Required(TEXT("listingId"), EType::String, TEXT("Owned Fab listing UUID")),
498
+ MCPParam::Optional(TEXT("engineVersion"), EType::String, TEXT("UE version from the listing's projectVersions, e.g. 5.8 (default this editor's)")),
499
+ MCPParam::Optional(TEXT("platform"), EType::String, TEXT("Target platform from projectVersions, e.g. Windows or Mac (default this editor's)")),
500
+ MCPParam::Optional(TEXT("outputDirectory"), EType::String, TEXT("Absolute pack output directory (default native Fab cache/UE-MCP/listing/artifact)")),
501
+ MCPParam::Optional(TEXT("verifyOnly"), EType::Boolean, TEXT("SHA verify existing files without repairing or downloading (default false)")),
502
+ });
503
+ Registry.RegisterHandler(TEXT("fab_download_status"), &DownloadStatus, {
504
+ MCPParam::Optional(TEXT("jobId"), EType::String, TEXT("Job identifier; omit to list all editor-session jobs")),
505
+ });
506
+ Registry.RegisterHandler(TEXT("fab_pause_download"), &PauseDownload, {
507
+ MCPParam::Required(TEXT("jobId"), EType::String, TEXT("Active download job identifier")),
508
+ });
509
+ Registry.RegisterHandler(TEXT("fab_resume_download"), &ResumeDownload, {
510
+ MCPParam::Required(TEXT("jobId"), EType::String, TEXT("Paused, failed or cancelled job identifier; obtains a fresh distribution signature")),
511
+ });
512
+ Registry.RegisterHandler(TEXT("fab_cancel_download"), &CancelDownload, {
513
+ MCPParam::Required(TEXT("jobId"), EType::String, TEXT("Job to cancel; verified files and native staging remain resumable")),
514
+ });
515
+ Registry.RegisterHandler(TEXT("fab_install_pack"), &InstallPack, {
516
+ MCPParam::Required(TEXT("jobId"), EType::String, TEXT("Completed, SHA-verified asset-pack download to copy into project Content, preserving paths")),
517
+ });
518
+ Registry.RegisterHandler(TEXT("fab_remove_installation"), &RemoveInstallation, {
519
+ MCPParam::Required(TEXT("jobId"), EType::String, TEXT("Remove only unchanged, unloaded files that this job created in project Content")),
520
+ });
417
521
  Registry.RegisterHandler(TEXT("fab_list_cached"), &ListCached, {});
418
522
  Registry.RegisterHandler(TEXT("fab_cache_info"), &CacheInfo, {});
419
523
  Registry.RegisterHandler(TEXT("fab_clear_cache"), &ClearCache, {},
@@ -4,18 +4,15 @@
4
4
  #include "Dom/JsonValue.h"
5
5
  #include "Dom/JsonObject.h"
6
6
 
7
- // Fab asset importer. Fab is Epic's unified content marketplace; the engine
8
- // ships an editor plugin (/Engine/Plugins/Fab) whose window is a web frontend
9
- // (catalog browse, library, purchase, signed-URL resolution all live server
10
- // side) sitting on top of a thin native download+import layer. This category
11
- // drives the parts of that native layer that don't need the web frontend:
12
- // login lifecycle, syncing the user's owned library into the Content Browser,
13
- // inspecting/clearing the download cache, and importing owned/local source
14
- // files into the project via the Fab import pipeline.
15
- //
16
- // Store catalog browsing and signed-URL resolution are out of scope: Fab
17
- // publishes no search API, and its terms forbid automated access to fab.com.
18
- // fab_open_search only hands the user fab.com's own search page (#1485).
7
+ // Native Fab account lifecycle, owned library synchronization, resumable UE
8
+ // asset-pack downloads, cache inspection and Content import. The Epic Games
9
+ // Launcher installs the Fab editor plugin into Engine/Plugins/Fab as its own
10
+ // "Fab UE Plugin" item, not as part of the engine (#1889). These handlers send
11
+ // no catalog requests of their own: Fab publishes no public search API and its
12
+ // terms forbid automated access to fab.com, so open_search only opens that page
13
+ // (#1485). Catalog search and listing import inside the editor are what the Fab
14
+ // plugin's own FabToolset does in Unreal's Toolset Registry (UE 5.9); the server
15
+ // finds it with fab(list_epic_tools) and runs it through epic_call_tool.
19
16
  class FFabHandlers
20
17
  {
21
18
  public:
@@ -28,6 +25,11 @@ public:
28
25
  static void SetUrlLauncherForTesting(FUrlLauncher Launcher);
29
26
 
30
27
  private:
28
+ /** Whether the Fab editor module is loaded in this editor. */
29
+ static bool IsFabLoaded();
30
+ /** The PLUGIN_NOT_AVAILABLE refusal: what is missing and how to get it. */
31
+ static TSharedPtr<FJsonValue> UnavailableError();
32
+
31
33
  static TSharedPtr<FJsonValue> Status(const TSharedPtr<FJsonObject>& Params);
32
34
  static TSharedPtr<FJsonValue> Login(const TSharedPtr<FJsonObject>& Params);
33
35
  static TSharedPtr<FJsonValue> Logout(const TSharedPtr<FJsonObject>& Params);
@@ -38,5 +40,14 @@ private:
38
40
  static TSharedPtr<FJsonValue> ImportFile(const TSharedPtr<FJsonObject>& Params);
39
41
  static TSharedPtr<FJsonValue> OpenSearch(const TSharedPtr<FJsonObject>& Params);
40
42
 
43
+ static TSharedPtr<FJsonValue> ListOwned(const TSharedPtr<FJsonObject>& Params);
44
+ static TSharedPtr<FJsonValue> Download(const TSharedPtr<FJsonObject>& Params);
45
+ static TSharedPtr<FJsonValue> DownloadStatus(const TSharedPtr<FJsonObject>& Params);
46
+ static TSharedPtr<FJsonValue> PauseDownload(const TSharedPtr<FJsonObject>& Params);
47
+ static TSharedPtr<FJsonValue> ResumeDownload(const TSharedPtr<FJsonObject>& Params);
48
+ static TSharedPtr<FJsonValue> CancelDownload(const TSharedPtr<FJsonObject>& Params);
49
+ static TSharedPtr<FJsonValue> InstallPack(const TSharedPtr<FJsonObject>& Params);
50
+ static TSharedPtr<FJsonValue> RemoveInstallation(const TSharedPtr<FJsonObject>& Params);
51
+
41
52
  static FUrlLauncher UrlLauncherOverride;
42
53
  };