flockbay 0.10.15
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.
- package/README.md +56 -0
- package/bin/flockbay-mcp.mjs +56 -0
- package/bin/flockbay.mjs +78 -0
- package/dist/codex/flockbayMcpStdioBridge.cjs +383 -0
- package/dist/codex/flockbayMcpStdioBridge.d.cts +2 -0
- package/dist/codex/flockbayMcpStdioBridge.d.mts +2 -0
- package/dist/codex/flockbayMcpStdioBridge.mjs +381 -0
- package/dist/flockbayScreenshotGate-DJX3Is5d.mjs +136 -0
- package/dist/flockbayScreenshotGate-DkxU24cR.cjs +138 -0
- package/dist/index--o4BPz5o.cjs +10311 -0
- package/dist/index-CUp3juDS.mjs +10268 -0
- package/dist/index.cjs +43 -0
- package/dist/index.d.cts +1 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +40 -0
- package/dist/lib.cjs +33 -0
- package/dist/lib.d.cts +957 -0
- package/dist/lib.d.mts +957 -0
- package/dist/lib.mjs +23 -0
- package/dist/runCodex-D3eT-TvB.cjs +3449 -0
- package/dist/runCodex-o6PCbHQ7.mjs +3446 -0
- package/dist/runGemini-Bt0oEj_g.mjs +3183 -0
- package/dist/runGemini-CBxZp6I7.cjs +3185 -0
- package/dist/types-C-jnUdn_.cjs +4498 -0
- package/dist/types-DGd6ea2Z.mjs +4450 -0
- package/kits/kit.open_world/kit.json +59 -0
- package/package.json +130 -0
- package/scripts/claude_local_launcher.cjs +73 -0
- package/scripts/claude_remote_launcher.cjs +16 -0
- package/scripts/claude_version_utils.cjs +391 -0
- package/scripts/ripgrep_launcher.cjs +33 -0
- package/scripts/session_hook_forwarder.cjs +49 -0
- package/scripts/test-codex-abort-history.mjs +77 -0
- package/scripts/unpack-tools.cjs +222 -0
- package/tools/licenses/difftastic-LICENSE +21 -0
- package/tools/licenses/ripgrep-LICENSE +3 -0
- package/tools/unreal-mcp/UPSTREAM_VERSION.md +8 -0
- package/tools/unreal-mcp/upstream/Docs/README.md +8 -0
- package/tools/unreal-mcp/upstream/Docs/Tools/README.md +7 -0
- package/tools/unreal-mcp/upstream/Docs/Tools/actor_tools.md +184 -0
- package/tools/unreal-mcp/upstream/Docs/Tools/blueprint_tools.md +268 -0
- package/tools/unreal-mcp/upstream/Docs/Tools/editor_tools.md +104 -0
- package/tools/unreal-mcp/upstream/Docs/Tools/node_tools.md +274 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Config/FilterPlugin.ini +8 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/Commands/UnrealMCPBlueprintCommands.cpp +1160 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/Commands/UnrealMCPBlueprintNodeCommands.cpp +924 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/Commands/UnrealMCPCommonUtils.cpp +709 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/Commands/UnrealMCPEditorCommands.cpp +896 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/Commands/UnrealMCPProjectCommands.cpp +72 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/Commands/UnrealMCPUMGCommands.cpp +544 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/MCPServerRunnable.cpp +321 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/UnrealMCPBridge.cpp +419 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Private/UnrealMCPModule.cpp +21 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/Commands/UnrealMCPBlueprintCommands.h +34 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/Commands/UnrealMCPBlueprintNodeCommands.h +27 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/Commands/UnrealMCPCommonUtils.h +59 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/Commands/UnrealMCPEditorCommands.h +40 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/Commands/UnrealMCPProjectCommands.h +20 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/Commands/UnrealMCPUMGCommands.h +82 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/MCPServerRunnable.h +34 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/UnrealMCPBridge.h +64 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/Public/UnrealMCPModule.h +22 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/Source/UnrealMCP/UnrealMCP.Build.cs +78 -0
- package/tools/unreal-mcp/upstream/MCPGameProject/Plugins/UnrealMCP/UnrealMCP.uplugin +36 -0
- package/tools/unreal-mcp/upstream/Python/README.md +40 -0
- package/tools/unreal-mcp/upstream/Python/pyproject.toml +22 -0
- package/tools/unreal-mcp/upstream/Python/scripts/actors/test_cube.py +203 -0
- package/tools/unreal-mcp/upstream/Python/scripts/blueprints/test_create_and_spawn_blueprints_with_different_components.py +497 -0
- package/tools/unreal-mcp/upstream/Python/scripts/blueprints/test_create_and_spawn_cube_blueprint.py +194 -0
- package/tools/unreal-mcp/upstream/Python/scripts/node/test_component_reference.py +267 -0
- package/tools/unreal-mcp/upstream/Python/scripts/node/test_create_bird_blueprint_with_input_and_camera.py +618 -0
- package/tools/unreal-mcp/upstream/Python/scripts/node/test_input_mapping.py +366 -0
- package/tools/unreal-mcp/upstream/Python/scripts/node/test_physics_variables.py +390 -0
- package/tools/unreal-mcp/upstream/Python/tools/blueprint_tools.py +420 -0
- package/tools/unreal-mcp/upstream/Python/tools/editor_tools.py +369 -0
- package/tools/unreal-mcp/upstream/Python/tools/node_tools.py +430 -0
- package/tools/unreal-mcp/upstream/Python/tools/project_tools.py +64 -0
- package/tools/unreal-mcp/upstream/Python/tools/umg_tools.py +333 -0
- package/tools/unreal-mcp/upstream/Python/unreal_mcp_server.py +398 -0
- package/tools/unreal-mcp/upstream/Python/uv.lock +521 -0
|
@@ -0,0 +1,430 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Blueprint Node Tools for Unreal MCP.
|
|
3
|
+
|
|
4
|
+
This module provides tools for manipulating Blueprint graph nodes and connections.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import logging
|
|
8
|
+
from typing import Dict, List, Any, Optional
|
|
9
|
+
from mcp.server.fastmcp import FastMCP, Context
|
|
10
|
+
|
|
11
|
+
# Get logger
|
|
12
|
+
logger = logging.getLogger("UnrealMCP")
|
|
13
|
+
|
|
14
|
+
def register_blueprint_node_tools(mcp: FastMCP):
|
|
15
|
+
"""Register Blueprint node manipulation tools with the MCP server."""
|
|
16
|
+
|
|
17
|
+
@mcp.tool()
|
|
18
|
+
def add_blueprint_event_node(
|
|
19
|
+
ctx: Context,
|
|
20
|
+
blueprint_name: str,
|
|
21
|
+
event_name: str,
|
|
22
|
+
node_position = None
|
|
23
|
+
) -> Dict[str, Any]:
|
|
24
|
+
"""
|
|
25
|
+
Add an event node to a Blueprint's event graph.
|
|
26
|
+
|
|
27
|
+
Args:
|
|
28
|
+
blueprint_name: Name of the target Blueprint
|
|
29
|
+
event_name: Name of the event. Use 'Receive' prefix for standard events:
|
|
30
|
+
- 'ReceiveBeginPlay' for Begin Play
|
|
31
|
+
- 'ReceiveTick' for Tick
|
|
32
|
+
- etc.
|
|
33
|
+
node_position: Optional [X, Y] position in the graph
|
|
34
|
+
|
|
35
|
+
Returns:
|
|
36
|
+
Response containing the node ID and success status
|
|
37
|
+
"""
|
|
38
|
+
from unreal_mcp_server import get_unreal_connection
|
|
39
|
+
|
|
40
|
+
try:
|
|
41
|
+
# Handle default value within the method body
|
|
42
|
+
if node_position is None:
|
|
43
|
+
node_position = [0, 0]
|
|
44
|
+
|
|
45
|
+
params = {
|
|
46
|
+
"blueprint_name": blueprint_name,
|
|
47
|
+
"event_name": event_name,
|
|
48
|
+
"node_position": node_position
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
unreal = get_unreal_connection()
|
|
52
|
+
if not unreal:
|
|
53
|
+
logger.error("Failed to connect to Unreal Engine")
|
|
54
|
+
return {"success": False, "message": "Failed to connect to Unreal Engine"}
|
|
55
|
+
|
|
56
|
+
logger.info(f"Adding event node '{event_name}' to blueprint '{blueprint_name}'")
|
|
57
|
+
response = unreal.send_command("add_blueprint_event_node", params)
|
|
58
|
+
|
|
59
|
+
if not response:
|
|
60
|
+
logger.error("No response from Unreal Engine")
|
|
61
|
+
return {"success": False, "message": "No response from Unreal Engine"}
|
|
62
|
+
|
|
63
|
+
logger.info(f"Event node creation response: {response}")
|
|
64
|
+
return response
|
|
65
|
+
|
|
66
|
+
except Exception as e:
|
|
67
|
+
error_msg = f"Error adding event node: {e}"
|
|
68
|
+
logger.error(error_msg)
|
|
69
|
+
return {"success": False, "message": error_msg}
|
|
70
|
+
|
|
71
|
+
@mcp.tool()
|
|
72
|
+
def add_blueprint_input_action_node(
|
|
73
|
+
ctx: Context,
|
|
74
|
+
blueprint_name: str,
|
|
75
|
+
action_name: str,
|
|
76
|
+
node_position = None
|
|
77
|
+
) -> Dict[str, Any]:
|
|
78
|
+
"""
|
|
79
|
+
Add an input action event node to a Blueprint's event graph.
|
|
80
|
+
|
|
81
|
+
Args:
|
|
82
|
+
blueprint_name: Name of the target Blueprint
|
|
83
|
+
action_name: Name of the input action to respond to
|
|
84
|
+
node_position: Optional [X, Y] position in the graph
|
|
85
|
+
|
|
86
|
+
Returns:
|
|
87
|
+
Response containing the node ID and success status
|
|
88
|
+
"""
|
|
89
|
+
from unreal_mcp_server import get_unreal_connection
|
|
90
|
+
|
|
91
|
+
try:
|
|
92
|
+
# Handle default value within the method body
|
|
93
|
+
if node_position is None:
|
|
94
|
+
node_position = [0, 0]
|
|
95
|
+
|
|
96
|
+
params = {
|
|
97
|
+
"blueprint_name": blueprint_name,
|
|
98
|
+
"action_name": action_name,
|
|
99
|
+
"node_position": node_position
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
unreal = get_unreal_connection()
|
|
103
|
+
if not unreal:
|
|
104
|
+
logger.error("Failed to connect to Unreal Engine")
|
|
105
|
+
return {"success": False, "message": "Failed to connect to Unreal Engine"}
|
|
106
|
+
|
|
107
|
+
logger.info(f"Adding input action node for '{action_name}' to blueprint '{blueprint_name}'")
|
|
108
|
+
response = unreal.send_command("add_blueprint_input_action_node", params)
|
|
109
|
+
|
|
110
|
+
if not response:
|
|
111
|
+
logger.error("No response from Unreal Engine")
|
|
112
|
+
return {"success": False, "message": "No response from Unreal Engine"}
|
|
113
|
+
|
|
114
|
+
logger.info(f"Input action node creation response: {response}")
|
|
115
|
+
return response
|
|
116
|
+
|
|
117
|
+
except Exception as e:
|
|
118
|
+
error_msg = f"Error adding input action node: {e}"
|
|
119
|
+
logger.error(error_msg)
|
|
120
|
+
return {"success": False, "message": error_msg}
|
|
121
|
+
|
|
122
|
+
@mcp.tool()
|
|
123
|
+
def add_blueprint_function_node(
|
|
124
|
+
ctx: Context,
|
|
125
|
+
blueprint_name: str,
|
|
126
|
+
target: str,
|
|
127
|
+
function_name: str,
|
|
128
|
+
params = None,
|
|
129
|
+
node_position = None
|
|
130
|
+
) -> Dict[str, Any]:
|
|
131
|
+
"""
|
|
132
|
+
Add a function call node to a Blueprint's event graph.
|
|
133
|
+
|
|
134
|
+
Args:
|
|
135
|
+
blueprint_name: Name of the target Blueprint
|
|
136
|
+
target: Target object for the function (component name or self)
|
|
137
|
+
function_name: Name of the function to call
|
|
138
|
+
params: Optional parameters to set on the function node
|
|
139
|
+
node_position: Optional [X, Y] position in the graph
|
|
140
|
+
|
|
141
|
+
Returns:
|
|
142
|
+
Response containing the node ID and success status
|
|
143
|
+
"""
|
|
144
|
+
from unreal_mcp_server import get_unreal_connection
|
|
145
|
+
|
|
146
|
+
try:
|
|
147
|
+
# Handle default values within the method body
|
|
148
|
+
if params is None:
|
|
149
|
+
params = {}
|
|
150
|
+
if node_position is None:
|
|
151
|
+
node_position = [0, 0]
|
|
152
|
+
|
|
153
|
+
command_params = {
|
|
154
|
+
"blueprint_name": blueprint_name,
|
|
155
|
+
"target": target,
|
|
156
|
+
"function_name": function_name,
|
|
157
|
+
"params": params,
|
|
158
|
+
"node_position": node_position
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
unreal = get_unreal_connection()
|
|
162
|
+
if not unreal:
|
|
163
|
+
logger.error("Failed to connect to Unreal Engine")
|
|
164
|
+
return {"success": False, "message": "Failed to connect to Unreal Engine"}
|
|
165
|
+
|
|
166
|
+
logger.info(f"Adding function node '{function_name}' to blueprint '{blueprint_name}'")
|
|
167
|
+
response = unreal.send_command("add_blueprint_function_node", command_params)
|
|
168
|
+
|
|
169
|
+
if not response:
|
|
170
|
+
logger.error("No response from Unreal Engine")
|
|
171
|
+
return {"success": False, "message": "No response from Unreal Engine"}
|
|
172
|
+
|
|
173
|
+
logger.info(f"Function node creation response: {response}")
|
|
174
|
+
return response
|
|
175
|
+
|
|
176
|
+
except Exception as e:
|
|
177
|
+
error_msg = f"Error adding function node: {e}"
|
|
178
|
+
logger.error(error_msg)
|
|
179
|
+
return {"success": False, "message": error_msg}
|
|
180
|
+
|
|
181
|
+
@mcp.tool()
|
|
182
|
+
def connect_blueprint_nodes(
|
|
183
|
+
ctx: Context,
|
|
184
|
+
blueprint_name: str,
|
|
185
|
+
source_node_id: str,
|
|
186
|
+
source_pin: str,
|
|
187
|
+
target_node_id: str,
|
|
188
|
+
target_pin: str
|
|
189
|
+
) -> Dict[str, Any]:
|
|
190
|
+
"""
|
|
191
|
+
Connect two nodes in a Blueprint's event graph.
|
|
192
|
+
|
|
193
|
+
Args:
|
|
194
|
+
blueprint_name: Name of the target Blueprint
|
|
195
|
+
source_node_id: ID of the source node
|
|
196
|
+
source_pin: Name of the output pin on the source node
|
|
197
|
+
target_node_id: ID of the target node
|
|
198
|
+
target_pin: Name of the input pin on the target node
|
|
199
|
+
|
|
200
|
+
Returns:
|
|
201
|
+
Response indicating success or failure
|
|
202
|
+
"""
|
|
203
|
+
from unreal_mcp_server import get_unreal_connection
|
|
204
|
+
|
|
205
|
+
try:
|
|
206
|
+
params = {
|
|
207
|
+
"blueprint_name": blueprint_name,
|
|
208
|
+
"source_node_id": source_node_id,
|
|
209
|
+
"source_pin": source_pin,
|
|
210
|
+
"target_node_id": target_node_id,
|
|
211
|
+
"target_pin": target_pin
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
unreal = get_unreal_connection()
|
|
215
|
+
if not unreal:
|
|
216
|
+
logger.error("Failed to connect to Unreal Engine")
|
|
217
|
+
return {"success": False, "message": "Failed to connect to Unreal Engine"}
|
|
218
|
+
|
|
219
|
+
logger.info(f"Connecting nodes in blueprint '{blueprint_name}'")
|
|
220
|
+
response = unreal.send_command("connect_blueprint_nodes", params)
|
|
221
|
+
|
|
222
|
+
if not response:
|
|
223
|
+
logger.error("No response from Unreal Engine")
|
|
224
|
+
return {"success": False, "message": "No response from Unreal Engine"}
|
|
225
|
+
|
|
226
|
+
logger.info(f"Node connection response: {response}")
|
|
227
|
+
return response
|
|
228
|
+
|
|
229
|
+
except Exception as e:
|
|
230
|
+
error_msg = f"Error connecting nodes: {e}"
|
|
231
|
+
logger.error(error_msg)
|
|
232
|
+
return {"success": False, "message": error_msg}
|
|
233
|
+
|
|
234
|
+
@mcp.tool()
|
|
235
|
+
def add_blueprint_variable(
|
|
236
|
+
ctx: Context,
|
|
237
|
+
blueprint_name: str,
|
|
238
|
+
variable_name: str,
|
|
239
|
+
variable_type: str,
|
|
240
|
+
is_exposed: bool = False
|
|
241
|
+
) -> Dict[str, Any]:
|
|
242
|
+
"""
|
|
243
|
+
Add a variable to a Blueprint.
|
|
244
|
+
|
|
245
|
+
Args:
|
|
246
|
+
blueprint_name: Name of the target Blueprint
|
|
247
|
+
variable_name: Name of the variable
|
|
248
|
+
variable_type: Type of the variable (Boolean, Integer, Float, Vector, etc.)
|
|
249
|
+
is_exposed: Whether to expose the variable to the editor
|
|
250
|
+
|
|
251
|
+
Returns:
|
|
252
|
+
Response indicating success or failure
|
|
253
|
+
"""
|
|
254
|
+
from unreal_mcp_server import get_unreal_connection
|
|
255
|
+
|
|
256
|
+
try:
|
|
257
|
+
params = {
|
|
258
|
+
"blueprint_name": blueprint_name,
|
|
259
|
+
"variable_name": variable_name,
|
|
260
|
+
"variable_type": variable_type,
|
|
261
|
+
"is_exposed": is_exposed
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
unreal = get_unreal_connection()
|
|
265
|
+
if not unreal:
|
|
266
|
+
logger.error("Failed to connect to Unreal Engine")
|
|
267
|
+
return {"success": False, "message": "Failed to connect to Unreal Engine"}
|
|
268
|
+
|
|
269
|
+
logger.info(f"Adding variable '{variable_name}' to blueprint '{blueprint_name}'")
|
|
270
|
+
response = unreal.send_command("add_blueprint_variable", params)
|
|
271
|
+
|
|
272
|
+
if not response:
|
|
273
|
+
logger.error("No response from Unreal Engine")
|
|
274
|
+
return {"success": False, "message": "No response from Unreal Engine"}
|
|
275
|
+
|
|
276
|
+
logger.info(f"Variable creation response: {response}")
|
|
277
|
+
return response
|
|
278
|
+
|
|
279
|
+
except Exception as e:
|
|
280
|
+
error_msg = f"Error adding variable: {e}"
|
|
281
|
+
logger.error(error_msg)
|
|
282
|
+
return {"success": False, "message": error_msg}
|
|
283
|
+
|
|
284
|
+
@mcp.tool()
|
|
285
|
+
def add_blueprint_get_self_component_reference(
|
|
286
|
+
ctx: Context,
|
|
287
|
+
blueprint_name: str,
|
|
288
|
+
component_name: str,
|
|
289
|
+
node_position = None
|
|
290
|
+
) -> Dict[str, Any]:
|
|
291
|
+
"""
|
|
292
|
+
Add a node that gets a reference to a component owned by the current Blueprint.
|
|
293
|
+
This creates a node similar to what you get when dragging a component from the Components panel.
|
|
294
|
+
|
|
295
|
+
Args:
|
|
296
|
+
blueprint_name: Name of the target Blueprint
|
|
297
|
+
component_name: Name of the component to get a reference to
|
|
298
|
+
node_position: Optional [X, Y] position in the graph
|
|
299
|
+
|
|
300
|
+
Returns:
|
|
301
|
+
Response containing the node ID and success status
|
|
302
|
+
"""
|
|
303
|
+
from unreal_mcp_server import get_unreal_connection
|
|
304
|
+
|
|
305
|
+
try:
|
|
306
|
+
# Handle None case explicitly in the function
|
|
307
|
+
if node_position is None:
|
|
308
|
+
node_position = [0, 0]
|
|
309
|
+
|
|
310
|
+
params = {
|
|
311
|
+
"blueprint_name": blueprint_name,
|
|
312
|
+
"component_name": component_name,
|
|
313
|
+
"node_position": node_position
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
unreal = get_unreal_connection()
|
|
317
|
+
if not unreal:
|
|
318
|
+
logger.error("Failed to connect to Unreal Engine")
|
|
319
|
+
return {"success": False, "message": "Failed to connect to Unreal Engine"}
|
|
320
|
+
|
|
321
|
+
logger.info(f"Adding self component reference node for '{component_name}' to blueprint '{blueprint_name}'")
|
|
322
|
+
response = unreal.send_command("add_blueprint_get_self_component_reference", params)
|
|
323
|
+
|
|
324
|
+
if not response:
|
|
325
|
+
logger.error("No response from Unreal Engine")
|
|
326
|
+
return {"success": False, "message": "No response from Unreal Engine"}
|
|
327
|
+
|
|
328
|
+
logger.info(f"Self component reference node creation response: {response}")
|
|
329
|
+
return response
|
|
330
|
+
|
|
331
|
+
except Exception as e:
|
|
332
|
+
error_msg = f"Error adding self component reference node: {e}"
|
|
333
|
+
logger.error(error_msg)
|
|
334
|
+
return {"success": False, "message": error_msg}
|
|
335
|
+
|
|
336
|
+
@mcp.tool()
|
|
337
|
+
def add_blueprint_self_reference(
|
|
338
|
+
ctx: Context,
|
|
339
|
+
blueprint_name: str,
|
|
340
|
+
node_position = None
|
|
341
|
+
) -> Dict[str, Any]:
|
|
342
|
+
"""
|
|
343
|
+
Add a 'Get Self' node to a Blueprint's event graph that returns a reference to this actor.
|
|
344
|
+
|
|
345
|
+
Args:
|
|
346
|
+
blueprint_name: Name of the target Blueprint
|
|
347
|
+
node_position: Optional [X, Y] position in the graph
|
|
348
|
+
|
|
349
|
+
Returns:
|
|
350
|
+
Response containing the node ID and success status
|
|
351
|
+
"""
|
|
352
|
+
from unreal_mcp_server import get_unreal_connection
|
|
353
|
+
|
|
354
|
+
try:
|
|
355
|
+
if node_position is None:
|
|
356
|
+
node_position = [0, 0]
|
|
357
|
+
|
|
358
|
+
params = {
|
|
359
|
+
"blueprint_name": blueprint_name,
|
|
360
|
+
"node_position": node_position
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
unreal = get_unreal_connection()
|
|
364
|
+
if not unreal:
|
|
365
|
+
logger.error("Failed to connect to Unreal Engine")
|
|
366
|
+
return {"success": False, "message": "Failed to connect to Unreal Engine"}
|
|
367
|
+
|
|
368
|
+
logger.info(f"Adding self reference node to blueprint '{blueprint_name}'")
|
|
369
|
+
response = unreal.send_command("add_blueprint_self_reference", params)
|
|
370
|
+
|
|
371
|
+
if not response:
|
|
372
|
+
logger.error("No response from Unreal Engine")
|
|
373
|
+
return {"success": False, "message": "No response from Unreal Engine"}
|
|
374
|
+
|
|
375
|
+
logger.info(f"Self reference node creation response: {response}")
|
|
376
|
+
return response
|
|
377
|
+
|
|
378
|
+
except Exception as e:
|
|
379
|
+
error_msg = f"Error adding self reference node: {e}"
|
|
380
|
+
logger.error(error_msg)
|
|
381
|
+
return {"success": False, "message": error_msg}
|
|
382
|
+
|
|
383
|
+
@mcp.tool()
|
|
384
|
+
def find_blueprint_nodes(
|
|
385
|
+
ctx: Context,
|
|
386
|
+
blueprint_name: str,
|
|
387
|
+
node_type = None,
|
|
388
|
+
event_type = None
|
|
389
|
+
) -> Dict[str, Any]:
|
|
390
|
+
"""
|
|
391
|
+
Find nodes in a Blueprint's event graph.
|
|
392
|
+
|
|
393
|
+
Args:
|
|
394
|
+
blueprint_name: Name of the target Blueprint
|
|
395
|
+
node_type: Optional type of node to find (Event, Function, Variable, etc.)
|
|
396
|
+
event_type: Optional specific event type to find (BeginPlay, Tick, etc.)
|
|
397
|
+
|
|
398
|
+
Returns:
|
|
399
|
+
Response containing array of found node IDs and success status
|
|
400
|
+
"""
|
|
401
|
+
from unreal_mcp_server import get_unreal_connection
|
|
402
|
+
|
|
403
|
+
try:
|
|
404
|
+
params = {
|
|
405
|
+
"blueprint_name": blueprint_name,
|
|
406
|
+
"node_type": node_type,
|
|
407
|
+
"event_type": event_type
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
unreal = get_unreal_connection()
|
|
411
|
+
if not unreal:
|
|
412
|
+
logger.error("Failed to connect to Unreal Engine")
|
|
413
|
+
return {"success": False, "message": "Failed to connect to Unreal Engine"}
|
|
414
|
+
|
|
415
|
+
logger.info(f"Finding nodes in blueprint '{blueprint_name}'")
|
|
416
|
+
response = unreal.send_command("find_blueprint_nodes", params)
|
|
417
|
+
|
|
418
|
+
if not response:
|
|
419
|
+
logger.error("No response from Unreal Engine")
|
|
420
|
+
return {"success": False, "message": "No response from Unreal Engine"}
|
|
421
|
+
|
|
422
|
+
logger.info(f"Node find response: {response}")
|
|
423
|
+
return response
|
|
424
|
+
|
|
425
|
+
except Exception as e:
|
|
426
|
+
error_msg = f"Error finding nodes: {e}"
|
|
427
|
+
logger.error(error_msg)
|
|
428
|
+
return {"success": False, "message": error_msg}
|
|
429
|
+
|
|
430
|
+
logger.info("Blueprint node tools registered successfully")
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Project Tools for Unreal MCP.
|
|
3
|
+
|
|
4
|
+
This module provides tools for managing project-wide settings and configuration.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
import logging
|
|
8
|
+
from typing import Dict, Any
|
|
9
|
+
from mcp.server.fastmcp import FastMCP, Context
|
|
10
|
+
|
|
11
|
+
# Get logger
|
|
12
|
+
logger = logging.getLogger("UnrealMCP")
|
|
13
|
+
|
|
14
|
+
def register_project_tools(mcp: FastMCP):
|
|
15
|
+
"""Register project tools with the MCP server."""
|
|
16
|
+
|
|
17
|
+
@mcp.tool()
|
|
18
|
+
def create_input_mapping(
|
|
19
|
+
ctx: Context,
|
|
20
|
+
action_name: str,
|
|
21
|
+
key: str,
|
|
22
|
+
input_type: str = "Action"
|
|
23
|
+
) -> Dict[str, Any]:
|
|
24
|
+
"""
|
|
25
|
+
Create an input mapping for the project.
|
|
26
|
+
|
|
27
|
+
Args:
|
|
28
|
+
action_name: Name of the input action
|
|
29
|
+
key: Key to bind (SpaceBar, LeftMouseButton, etc.)
|
|
30
|
+
input_type: Type of input mapping (Action or Axis)
|
|
31
|
+
|
|
32
|
+
Returns:
|
|
33
|
+
Response indicating success or failure
|
|
34
|
+
"""
|
|
35
|
+
from unreal_mcp_server import get_unreal_connection
|
|
36
|
+
|
|
37
|
+
try:
|
|
38
|
+
unreal = get_unreal_connection()
|
|
39
|
+
if not unreal:
|
|
40
|
+
logger.error("Failed to connect to Unreal Engine")
|
|
41
|
+
return {"success": False, "message": "Failed to connect to Unreal Engine"}
|
|
42
|
+
|
|
43
|
+
params = {
|
|
44
|
+
"action_name": action_name,
|
|
45
|
+
"key": key,
|
|
46
|
+
"input_type": input_type
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
logger.info(f"Creating input mapping '{action_name}' with key '{key}'")
|
|
50
|
+
response = unreal.send_command("create_input_mapping", params)
|
|
51
|
+
|
|
52
|
+
if not response:
|
|
53
|
+
logger.error("No response from Unreal Engine")
|
|
54
|
+
return {"success": False, "message": "No response from Unreal Engine"}
|
|
55
|
+
|
|
56
|
+
logger.info(f"Input mapping creation response: {response}")
|
|
57
|
+
return response
|
|
58
|
+
|
|
59
|
+
except Exception as e:
|
|
60
|
+
error_msg = f"Error creating input mapping: {e}"
|
|
61
|
+
logger.error(error_msg)
|
|
62
|
+
return {"success": False, "message": error_msg}
|
|
63
|
+
|
|
64
|
+
logger.info("Project tools registered successfully")
|