Add in-editor Slate setup wizard (Tools > MCP Setup Wizard)

Native UE editor tab (SMCPWizard) so setup happens inside Unreal, not just the
Node CLI. Three sections:
- Remote Control: live status of the :30010 bridge + a button to start it
  (WebControl.StartServer + EnableServerOnStartup).
- API keys: paste/save the agent-gateway Anthropic token (auth.env) and
  ElevenLabs key (integrations.json) — both git-ignored.
- MCP tools: lists the catalogue from tools.json.

Wiring:
- UEBlueprintMCPEditor module registers a nomad tab + a Tools-menu entry.
- Build.cs gains the Projects module (IPluginManager).
- server.js exports TOOLS and only launches the stdio server when run directly
  (isMain), so src/dumpTools.mjs can generate tools.json. `npm run dump-tools`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Bonchellon
2026-06-24 01:35:53 +03:00
parent b04ba768b4
commit 341e694ab5
10 changed files with 799 additions and 12 deletions

View File

@ -20,6 +20,10 @@
#include "ToolMenuEntry.h"
#include "ToolMenuSection.h"
#include "ToolMenus.h"
#include "Framework/Docking/TabManager.h"
#include "Widgets/Docking/SDockTab.h"
#include "Styling/AppStyle.h"
#include "SMCPWizard.h"
#define LOCTEXT_NAMESPACE "UEBlueprintMCPEditor"
@ -27,6 +31,7 @@ namespace
{
const TCHAR* MCPZoneCommentText = TEXT("MCP Zone");
const TCHAR* LegacyMCPZoneCommentText = TEXT("MCP Draft Zone");
const FName MCPWizardTabId(TEXT("MCPSetupWizard"));
bool IsMCPZoneComment(const UEdGraphNode* Node)
{
@ -150,6 +155,12 @@ void FUEBlueprintMCPEditorModule::ShutdownModule()
{
FCoreDelegates::OnPostEngineInit.RemoveAll(this);
if (bWizardTabRegistered && FSlateApplication::IsInitialized())
{
FGlobalTabmanager::Get()->UnregisterNomadTabSpawner(MCPWizardTabId);
bWizardTabRegistered = false;
}
if (MCPZoneInputProcessor.IsValid() && FSlateApplication::IsInitialized())
{
FSlateApplication::Get().UnregisterInputPreProcessor(MCPZoneInputProcessor);
@ -163,9 +174,52 @@ void FUEBlueprintMCPEditorModule::ShutdownModule()
}
}
void FUEBlueprintMCPEditorModule::RegisterWizardTabAndMenu()
{
// Nomad tab that hosts the wizard.
if (!bWizardTabRegistered && FSlateApplication::IsInitialized())
{
FGlobalTabmanager::Get()->RegisterNomadTabSpawner(
MCPWizardTabId,
FOnSpawnTab::CreateRaw(this, &FUEBlueprintMCPEditorModule::SpawnWizardTab))
.SetDisplayName(LOCTEXT("MCPWizardTabTitle", "MCP Setup Wizard"))
.SetTooltipText(LOCTEXT("MCPWizardTabTooltip", "Set up the UE Blueprint MCP: Remote Control, API keys, and the tool list."))
.SetMenuType(ETabSpawnerMenuType::Hidden);
bWizardTabRegistered = true;
}
// Tools menu entry to open it.
UToolMenu* ToolsMenu = UToolMenus::Get()->ExtendMenu("LevelEditor.MainMenu.Tools");
if (ToolsMenu)
{
FToolMenuSection& Section = ToolsMenu->FindOrAddSection("MCP", LOCTEXT("MCPMenuSection", "MCP"));
Section.AddMenuEntry(
"OpenMCPSetupWizard",
LOCTEXT("OpenMCPWizard", "MCP Setup Wizard"),
LOCTEXT("OpenMCPWizardTip", "Open the UE Blueprint MCP setup wizard (Remote Control, API keys, tools)."),
FSlateIcon(FAppStyle::GetAppStyleSetName(), "Icons.Settings"),
FUIAction(FExecuteAction::CreateLambda([]()
{
FGlobalTabmanager::Get()->TryInvokeTab(MCPWizardTabId);
})));
}
}
TSharedRef<SDockTab> FUEBlueprintMCPEditorModule::SpawnWizardTab(const FSpawnTabArgs& Args)
{
return SNew(SDockTab)
.TabRole(ETabRole::NomadTab)
[
SNew(SMCPWizard)
];
}
void FUEBlueprintMCPEditorModule::RegisterMenus()
{
FToolMenuOwnerScoped OwnerScoped(this);
RegisterWizardTabAndMenu();
UToolMenu* Toolbar = UToolMenus::Get()->ExtendMenu("AssetEditor.BlueprintEditor.ToolBar");
FToolMenuSection& Section = Toolbar->FindOrAddSection("Settings");