Initial checkin of Blueprint-MCP plugin

This commit is contained in:
2026-03-05 19:26:46 -05:00
parent 9cc1cb502b
commit 8367bd2221
4571 changed files with 1211887 additions and 7 deletions

View File

@@ -0,0 +1,2 @@
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
export declare function registerBlueprintListResource(server: McpServer): void;

View File

@@ -0,0 +1,11 @@
import { isUEHealthy, ueGet } from "../ue-bridge.js";
export function registerBlueprintListResource(server) {
server.resource("blueprint-list", "blueprint:///list", { description: "List of all exported Blueprints", mimeType: "application/json" }, async (uri) => {
if (!(await isUEHealthy())) {
return { contents: [{ uri: uri.href, text: "[]", mimeType: "application/json" }] };
}
const data = await ueGet("/api/list");
return { contents: [{ uri: uri.href, text: JSON.stringify(data.blueprints, null, 2), mimeType: "application/json" }] };
});
}
//# sourceMappingURL=blueprint-list.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"blueprint-list.js","sourceRoot":"","sources":["../../src/resources/blueprint-list.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAErD,MAAM,UAAU,6BAA6B,CAAC,MAAiB;IAC7D,MAAM,CAAC,QAAQ,CACb,gBAAgB,EAChB,mBAAmB,EACnB,EAAE,WAAW,EAAE,iCAAiC,EAAE,QAAQ,EAAE,kBAAkB,EAAE,EAChF,KAAK,EAAE,GAAG,EAAE,EAAE;QACZ,IAAI,CAAC,CAAC,MAAM,WAAW,EAAE,CAAC,EAAE,CAAC;YAC3B,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,kBAAkB,EAAE,CAAC,EAAE,CAAC;QACrF,CAAC;QACD,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,WAAW,CAAC,CAAC;QACtC,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,QAAQ,EAAE,kBAAkB,EAAE,CAAC,EAAE,CAAC;IACzH,CAAC,CACF,CAAC;AACJ,CAAC"}

View File

@@ -0,0 +1,2 @@
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
export declare function registerWorkflowRecipesResource(server: McpServer): void;

View File

@@ -0,0 +1,131 @@
export function registerWorkflowRecipesResource(server) {
server.resource("workflow-recipes", "blueprint:///recipes", { description: "Workflow recipes for common Blueprint migration tasks", mimeType: "text/markdown" }, async (uri) => {
const recipes = `# Blueprint MCP Workflow Recipes
## Recipe 1: Migrate BP Struct to C++ USTRUCT
When replacing a Blueprint UserDefinedStruct (e.g. \`S_Vitals\`) with a C++ USTRUCT (e.g. \`FVitals\`):
### Steps
1. **Identify all usages** of the old struct:
\`\`\`
search_by_type(typeName="S_Vitals")
find_asset_references(assetPath="/Game/Blueprints/WebUI/S_Vitals")
\`\`\`
2. **Change variable types** in each Blueprint that declares a variable of this type:
\`\`\`
change_variable_type(blueprint="BP_PatientManager", variable="CurrentVitals", newType="FVitals", typeCategory="struct")
\`\`\`
3. **Change function/event parameter types** where the struct is used as a parameter:
\`\`\`
change_function_parameter_type(blueprint="BP_PatientManager", functionName="UpdateVitals", paramName="Vitals", newType="FVitals")
\`\`\`
4. **Update Break/Make struct nodes** to use the new type:
\`\`\`
change_struct_node_type(blueprint="BP_PatientJson", nodeId="<guid>", newType="FVitals")
\`\`\`
5. **Refresh all nodes** in each modified Blueprint:
\`\`\`
refresh_all_nodes(blueprint="BP_PatientManager")
\`\`\`
6. **Validate** each Blueprint compiles cleanly:
\`\`\`
validate_blueprint(blueprint="BP_PatientManager")
\`\`\`
7. **Delete the old BP struct** once all references are removed:
\`\`\`
find_asset_references(assetPath="/Game/Blueprints/WebUI/S_Vitals")
delete_asset(assetPath="/Game/Blueprints/WebUI/S_Vitals")
\`\`\`
### Tips
- Use \`dryRun=true\` on mutation tools to preview changes first
- Use batch mode to change multiple variables/parameters at once
- The \`search_by_type\` tool is more granular than \`find_asset_references\` for finding specific usages
- After changing parameter types, check delegate graphs that bind to those functions
---
## Recipe 2: Convert BP Function Library to C++
When replacing a Blueprint Function Library (e.g. \`FL_StateParsers\`) with a C++ equivalent (e.g. \`UStateParsersLibrary\`):
### Steps
1. **Identify all Blueprints** that call functions from the library:
\`\`\`
find_asset_references(assetPath="/Game/Blueprints/WebUI/FL_StateParsers")
\`\`\`
2. **For each referencing Blueprint**, redirect function calls:
\`\`\`
replace_function_calls(blueprint="BP_PatientJson", oldClass="FL_StateParsers", newClass="StateParsersLibrary")
\`\`\`
3. **Refresh nodes** to update pin types:
\`\`\`
refresh_all_nodes(blueprint="BP_PatientJson")
\`\`\`
4. **Fix broken connections** reported by replace_function_calls:
- Use \`get_blueprint_graph\` to inspect the affected graph
- Use \`connect_pins\` to rewire broken data connections
- If pin types changed, use \`change_struct_node_type\` for Break/Make nodes
5. **Validate** each Blueprint:
\`\`\`
validate_blueprint(blueprint="BP_PatientJson")
\`\`\`
6. **Delete the old BP function library**:
\`\`\`
delete_asset(assetPath="/Game/Blueprints/WebUI/FL_StateParsers")
\`\`\`
### Tips
- Preview with \`dryRun=true\` on \`replace_function_calls\` first
- If function signatures changed (different parameter types), connections will break and need manual rewiring
- The \`brokenConnections\` array in the response tells you exactly which pins lost their wires
---
## Recipe 3: C++ Rebuild Safety
When rebuilding a C++ module containing USTRUCT/UENUM definitions:
### Before Rebuild
1. Analyze impact:
\`analyze_rebuild_impact(moduleName="YourModule")\`
2. Snapshot HIGH-risk Blueprints:
\`snapshot_graph(blueprint="BP_Affected1")\`
\`snapshot_graph(blueprint="BP_Affected2")\`
### After Rebuild
3. Assess damage:
\`find_disconnected_pins(filter="/Game/Blueprints/")\`
4. Diff each snapshot:
\`diff_graph(blueprint="BP_Affected1", snapshotId="snap_...")\`
5. Fix broken struct types:
\`change_struct_node_type(blueprint="BP_Affected1", nodeId="...", newType="FYourStruct")\`
6. Restore connections:
\`restore_graph(blueprint="BP_Affected1", snapshotId="snap_...")\`
7. Verify:
\`validate_blueprint(blueprint="BP_Affected1")\`
\`find_disconnected_pins(blueprint="BP_Affected1")\`
`;
return { contents: [{ uri: uri.href, text: recipes, mimeType: "text/markdown" }] };
});
}
//# sourceMappingURL=workflow-recipes.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"workflow-recipes.js","sourceRoot":"","sources":["../../src/resources/workflow-recipes.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,+BAA+B,CAAC,MAAiB;IAC/D,MAAM,CAAC,QAAQ,CACb,kBAAkB,EAClB,sBAAsB,EACtB,EAAE,WAAW,EAAE,uDAAuD,EAAE,QAAQ,EAAE,eAAe,EAAE,EACnG,KAAK,EAAE,GAAG,EAAE,EAAE;QACZ,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4HrB,CAAC;QACI,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC,EAAE,CAAC;IACrF,CAAC,CACF,CAAC;AACJ,CAAC"}