unreal-engine-mcp-server 0.2.1 → 0.3.0
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/.env.production +1 -1
- package/README.md +0 -17
- package/dist/index.js +4 -4
- package/dist/resources/assets.d.ts +1 -1
- package/dist/resources/assets.js +3 -3
- package/dist/tools/consolidated-tool-definitions.js +156 -14
- package/dist/tools/consolidated-tool-handlers.js +1 -1
- package/dist/tools/tool-definitions.js +141 -25
- package/dist/tools/tool-handlers.js +42 -9
- package/dist/unreal-bridge.js +2 -2
- package/dist/utils/response-validator.js +3 -3
- package/dist/utils/safe-json.js +1 -1
- package/package.json +3 -10
- package/server.json +2 -2
- package/src/index.ts +5 -5
- package/src/resources/assets.ts +3 -3
- package/src/tools/consolidated-tool-definitions.ts +156 -14
- package/src/tools/consolidated-tool-handlers.ts +1 -1
- package/src/tools/tool-definitions.ts +141 -25
- package/src/tools/tool-handlers.ts +41 -9
- package/src/unreal-bridge.ts +2 -2
- package/src/utils/response-validator.ts +3 -3
- package/src/utils/safe-json.ts +1 -1
package/.env.production
CHANGED
package/README.md
CHANGED
|
@@ -78,23 +78,6 @@ Then enable Python execution in: Edit > Project Settings > Plugins > Remote Cont
|
|
|
78
78
|
|
|
79
79
|
### Claude Desktop / Cursor
|
|
80
80
|
|
|
81
|
-
#### For NPM Installation (Global)
|
|
82
|
-
|
|
83
|
-
```json
|
|
84
|
-
{
|
|
85
|
-
"mcpServers": {
|
|
86
|
-
"unreal-engine": {
|
|
87
|
-
"command": "unreal-engine-mcp-server",
|
|
88
|
-
"env": {
|
|
89
|
-
"UE_HOST": "127.0.0.1",
|
|
90
|
-
"UE_RC_HTTP_PORT": "30010",
|
|
91
|
-
"UE_RC_WS_PORT": "30020"
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
```
|
|
97
|
-
|
|
98
81
|
#### For NPM Installation (Local)
|
|
99
82
|
|
|
100
83
|
```json
|
package/dist/index.js
CHANGED
|
@@ -53,14 +53,14 @@ const metrics = {
|
|
|
53
53
|
};
|
|
54
54
|
// Configuration
|
|
55
55
|
const CONFIG = {
|
|
56
|
-
// Tool mode: true = consolidated (
|
|
56
|
+
// Tool mode: true = consolidated (13 tools), false = individual (36+ tools)
|
|
57
57
|
USE_CONSOLIDATED_TOOLS: process.env.USE_CONSOLIDATED_TOOLS !== 'false',
|
|
58
58
|
// Connection retry settings
|
|
59
59
|
MAX_RETRY_ATTEMPTS: 3,
|
|
60
60
|
RETRY_DELAY_MS: 2000,
|
|
61
61
|
// Server info
|
|
62
62
|
SERVER_NAME: 'unreal-engine-mcp',
|
|
63
|
-
SERVER_VERSION: '0.
|
|
63
|
+
SERVER_VERSION: '0.3.0',
|
|
64
64
|
// Monitoring
|
|
65
65
|
HEALTH_CHECK_INTERVAL_MS: 30000 // 30 seconds
|
|
66
66
|
};
|
|
@@ -339,14 +339,14 @@ export async function createServer() {
|
|
|
339
339
|
}
|
|
340
340
|
throw new Error(`Unknown resource: ${uri}`);
|
|
341
341
|
});
|
|
342
|
-
// Handle tool listing - switch between consolidated (
|
|
342
|
+
// Handle tool listing - switch between consolidated (13) or individual (36) tools
|
|
343
343
|
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
344
344
|
log.info(`Serving ${CONFIG.USE_CONSOLIDATED_TOOLS ? 'consolidated' : 'individual'} tools`);
|
|
345
345
|
return {
|
|
346
346
|
tools: CONFIG.USE_CONSOLIDATED_TOOLS ? consolidatedToolDefinitions : toolDefinitions
|
|
347
347
|
};
|
|
348
348
|
});
|
|
349
|
-
// Handle tool calls - switch between consolidated (
|
|
349
|
+
// Handle tool calls - switch between consolidated (13) or individual (36) tools
|
|
350
350
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
351
351
|
const { name, arguments: args } = request.params;
|
|
352
352
|
const startTime = Date.now();
|
|
@@ -5,7 +5,7 @@ export declare class AssetResources {
|
|
|
5
5
|
private cache;
|
|
6
6
|
private get ttlMs();
|
|
7
7
|
private makeKey;
|
|
8
|
-
list(dir?: string,
|
|
8
|
+
list(dir?: string, _recursive?: boolean, limit?: number): Promise<any>;
|
|
9
9
|
/**
|
|
10
10
|
* List assets with pagination support
|
|
11
11
|
* @param dir Directory to list assets from
|
package/dist/resources/assets.js
CHANGED
|
@@ -9,10 +9,10 @@ export class AssetResources {
|
|
|
9
9
|
makeKey(dir, recursive, page) {
|
|
10
10
|
return page !== undefined ? `${dir}::${recursive ? 1 : 0}::${page}` : `${dir}::${recursive ? 1 : 0}`;
|
|
11
11
|
}
|
|
12
|
-
async list(dir = '/Game',
|
|
12
|
+
async list(dir = '/Game', _recursive = false, limit = 50) {
|
|
13
13
|
// ALWAYS use non-recursive listing to show only immediate children
|
|
14
14
|
// This prevents timeouts and makes navigation clearer
|
|
15
|
-
|
|
15
|
+
_recursive = false; // Force non-recursive
|
|
16
16
|
// Cache fast-path
|
|
17
17
|
try {
|
|
18
18
|
const key = this.makeKey(dir, false);
|
|
@@ -94,7 +94,7 @@ export class AssetResources {
|
|
|
94
94
|
* Directory-based listing for paths with too many assets
|
|
95
95
|
* Shows only immediate children (folders and files) to avoid timeouts
|
|
96
96
|
*/
|
|
97
|
-
async listDirectoryOnly(dir,
|
|
97
|
+
async listDirectoryOnly(dir, _recursive, limit) {
|
|
98
98
|
// Always return only immediate children to avoid timeout and improve navigation
|
|
99
99
|
try {
|
|
100
100
|
const py = `
|
|
@@ -1,9 +1,28 @@
|
|
|
1
|
-
// Consolidated tool definitions - reduced from 36 to
|
|
1
|
+
// Consolidated tool definitions - reduced from 36 to 13 multi-purpose tools
|
|
2
2
|
export const consolidatedToolDefinitions = [
|
|
3
3
|
// 1. ASSET MANAGER - Combines asset operations
|
|
4
4
|
{
|
|
5
5
|
name: 'manage_asset',
|
|
6
|
-
description:
|
|
6
|
+
description: `Search, browse, import, and create simple material assets.
|
|
7
|
+
|
|
8
|
+
When to use this tool:
|
|
9
|
+
- You want to list assets in the project Content directory (use /Game; /Content is auto-mapped).
|
|
10
|
+
- You want to import files from disk into the project (e.g., FBX, PNG, WAV, EXR).
|
|
11
|
+
- You want to generate a very basic Material asset by name at a path.
|
|
12
|
+
|
|
13
|
+
Supported actions:
|
|
14
|
+
- list: Returns assets in a folder (recursive behavior is auto-enabled for /Game).
|
|
15
|
+
- import: Imports a file into the project at a destination path (e.g., /Game/Folder).
|
|
16
|
+
- create_material: Creates a simple Material asset at a path.
|
|
17
|
+
|
|
18
|
+
Tips:
|
|
19
|
+
- Unreal uses /Game for project content; this server maps /Content → /Game automatically.
|
|
20
|
+
- For large projects, listing /Game returns a sample subset for speed; refine to subfolders.
|
|
21
|
+
|
|
22
|
+
Examples:
|
|
23
|
+
- {"action":"list","directory":"/Game/ThirdPerson"}
|
|
24
|
+
- {"action":"import","sourcePath":"C:/Temp/Tree.fbx","destinationPath":"/Game/Environment/Trees"}
|
|
25
|
+
- {"action":"create_material","name":"M_Mask","path":"/Game/Materials"}`,
|
|
7
26
|
inputSchema: {
|
|
8
27
|
type: 'object',
|
|
9
28
|
properties: {
|
|
@@ -50,7 +69,25 @@ export const consolidatedToolDefinitions = [
|
|
|
50
69
|
// 2. ACTOR CONTROL - Combines actor operations
|
|
51
70
|
{
|
|
52
71
|
name: 'control_actor',
|
|
53
|
-
description:
|
|
72
|
+
description: `Spawn, delete, and apply physics to actors in the level.
|
|
73
|
+
|
|
74
|
+
When to use this tool:
|
|
75
|
+
- You need to place an actor or mesh in the level, remove an actor, or nudge an actor with a physics force.
|
|
76
|
+
|
|
77
|
+
Spawning:
|
|
78
|
+
- classPath can be a class name (e.g., StaticMeshActor, CameraActor) OR an asset path (e.g., /Engine/BasicShapes/Cube, /Game/Meshes/SM_Rock).
|
|
79
|
+
- If an asset path is provided, a StaticMeshActor is auto-spawned with the mesh assigned.
|
|
80
|
+
|
|
81
|
+
Deleting:
|
|
82
|
+
- Finds actors by label/name (case-insensitive). Deletes matching actors.
|
|
83
|
+
|
|
84
|
+
Apply force:
|
|
85
|
+
- Applies a world-space force vector to an actor with physics enabled.
|
|
86
|
+
|
|
87
|
+
Examples:
|
|
88
|
+
- {"action":"spawn","classPath":"/Engine/BasicShapes/Cube","location":{"x":0,"y":0,"z":100}}
|
|
89
|
+
- {"action":"delete","actorName":"Cube_1"}
|
|
90
|
+
- {"action":"apply_force","actorName":"PhysicsBox","force":{"x":0,"y":0,"z":5000}}`,
|
|
54
91
|
inputSchema: {
|
|
55
92
|
type: 'object',
|
|
56
93
|
properties: {
|
|
@@ -109,7 +146,20 @@ export const consolidatedToolDefinitions = [
|
|
|
109
146
|
// 3. EDITOR CONTROL - Combines editor operations
|
|
110
147
|
{
|
|
111
148
|
name: 'control_editor',
|
|
112
|
-
description:
|
|
149
|
+
description: `Play/Stop PIE, position the editor camera, and switch common view modes.
|
|
150
|
+
|
|
151
|
+
When to use this tool:
|
|
152
|
+
- Start/stop a PIE session, move the viewport camera, or change viewmode (Lit/Unlit/Wireframe/etc.).
|
|
153
|
+
|
|
154
|
+
Notes:
|
|
155
|
+
- View modes are validated and unsafe modes are blocked.
|
|
156
|
+
- Camera accepts location and/or rotation (both optional). Values are normalized.
|
|
157
|
+
|
|
158
|
+
Examples:
|
|
159
|
+
- {"action":"play"}
|
|
160
|
+
- {"action":"set_camera","location":{"x":0,"y":-600,"z":250},"rotation":{"pitch":0,"yaw":0,"roll":0}}
|
|
161
|
+
- {"action":"set_view_mode","viewMode":"Wireframe"}
|
|
162
|
+
- {"action":"stop"}`,
|
|
113
163
|
inputSchema: {
|
|
114
164
|
type: 'object',
|
|
115
165
|
properties: {
|
|
@@ -166,7 +216,16 @@ export const consolidatedToolDefinitions = [
|
|
|
166
216
|
// 4. LEVEL MANAGER - Combines level and lighting operations
|
|
167
217
|
{
|
|
168
218
|
name: 'manage_level',
|
|
169
|
-
description:
|
|
219
|
+
description: `Load/save/stream levels, create lights, and trigger lighting builds.
|
|
220
|
+
|
|
221
|
+
When to use this tool:
|
|
222
|
+
- Switch to a level, save the current level, stream sublevels, add a light, or start a lighting build.
|
|
223
|
+
|
|
224
|
+
Examples:
|
|
225
|
+
- {"action":"load","levelPath":"/Game/Maps/Lobby"}
|
|
226
|
+
- {"action":"stream","levelName":"Sublevel_A","shouldBeLoaded":true,"shouldBeVisible":true}
|
|
227
|
+
- {"action":"create_light","lightType":"Directional","name":"KeyLight","intensity":5.0}
|
|
228
|
+
- {"action":"build_lighting","quality":"High"}`,
|
|
170
229
|
inputSchema: {
|
|
171
230
|
type: 'object',
|
|
172
231
|
properties: {
|
|
@@ -221,7 +280,15 @@ export const consolidatedToolDefinitions = [
|
|
|
221
280
|
// 5. ANIMATION SYSTEM - Combines animation and physics setup
|
|
222
281
|
{
|
|
223
282
|
name: 'animation_physics',
|
|
224
|
-
description:
|
|
283
|
+
description: `Create animation blueprints, play montages, and set up simple ragdolls.
|
|
284
|
+
|
|
285
|
+
When to use this tool:
|
|
286
|
+
- Generate an Anim Blueprint for a skeleton, play a Montage/Animation on an actor, or enable ragdoll.
|
|
287
|
+
|
|
288
|
+
Examples:
|
|
289
|
+
- {"action":"create_animation_bp","name":"ABP_Hero","skeletonPath":"/Game/Characters/Hero/SK_Hero_Skeleton","savePath":"/Game/Characters/Hero"}
|
|
290
|
+
- {"action":"play_montage","actorName":"Hero","montagePath":"/Game/Anim/MT_Attack"}
|
|
291
|
+
- {"action":"setup_ragdoll","skeletonPath":"/Game/Characters/Hero/SK_Hero_Skeleton","physicsAssetName":"PHYS_Hero"}`,
|
|
225
292
|
inputSchema: {
|
|
226
293
|
type: 'object',
|
|
227
294
|
properties: {
|
|
@@ -260,7 +327,15 @@ export const consolidatedToolDefinitions = [
|
|
|
260
327
|
// 6. EFFECTS SYSTEM - Combines particles and visual effects
|
|
261
328
|
{
|
|
262
329
|
name: 'create_effect',
|
|
263
|
-
description:
|
|
330
|
+
description: `Create particles/FX and lightweight debug shapes for rapid iteration.
|
|
331
|
+
|
|
332
|
+
When to use this tool:
|
|
333
|
+
- Spawn a Niagara system at a location, create a particle effect by type tag, or draw debug geometry for planning.
|
|
334
|
+
|
|
335
|
+
Examples:
|
|
336
|
+
- {"action":"niagara","systemPath":"/Game/FX/NS_Explosion","location":{"x":0,"y":0,"z":200},"scale":1.0}
|
|
337
|
+
- {"action":"particle","effectType":"Smoke","name":"SMK1","location":{"x":100,"y":0,"z":50}}
|
|
338
|
+
- {"action":"debug_shape","shape":"Sphere","location":{"x":0,"y":0,"z":0},"size":100,"duration":5}`,
|
|
264
339
|
inputSchema: {
|
|
265
340
|
type: 'object',
|
|
266
341
|
properties: {
|
|
@@ -320,7 +395,14 @@ export const consolidatedToolDefinitions = [
|
|
|
320
395
|
// 7. BLUEPRINT MANAGER - Blueprint operations
|
|
321
396
|
{
|
|
322
397
|
name: 'manage_blueprint',
|
|
323
|
-
description:
|
|
398
|
+
description: `Create new Blueprints and add components programmatically.
|
|
399
|
+
|
|
400
|
+
When to use this tool:
|
|
401
|
+
- Quickly scaffold a Blueprint asset or add a component to an existing Blueprint.
|
|
402
|
+
|
|
403
|
+
Examples:
|
|
404
|
+
- {"action":"create","name":"BP_Switch","blueprintType":"Actor","savePath":"/Game/Blueprints"}
|
|
405
|
+
- {"action":"add_component","name":"BP_Switch","componentType":"PointLightComponent","componentName":"KeyLight"}`,
|
|
324
406
|
inputSchema: {
|
|
325
407
|
type: 'object',
|
|
326
408
|
properties: {
|
|
@@ -354,7 +436,19 @@ export const consolidatedToolDefinitions = [
|
|
|
354
436
|
// 8. ENVIRONMENT BUILDER - Landscape and foliage
|
|
355
437
|
{
|
|
356
438
|
name: 'build_environment',
|
|
357
|
-
description:
|
|
439
|
+
description: `Environment authoring helpers (landscape, foliage).
|
|
440
|
+
|
|
441
|
+
When to use this tool:
|
|
442
|
+
- Create a procedural terrain alternative, add/paint foliage, or attempt a landscape workflow.
|
|
443
|
+
|
|
444
|
+
Important:
|
|
445
|
+
- Native Landscape creation via Python is limited and may return a helpful error suggesting Landscape Mode in the editor.
|
|
446
|
+
- Foliage helpers create FoliageType assets and support simple placement.
|
|
447
|
+
|
|
448
|
+
Examples:
|
|
449
|
+
- {"action":"create_landscape","name":"Landscape_Basic","sizeX":1024,"sizeY":1024}
|
|
450
|
+
- {"action":"add_foliage","name":"FT_Grass","meshPath":"/Game/Foliage/SM_Grass","density":300}
|
|
451
|
+
- {"action":"paint_foliage","foliageType":"/Game/Foliage/Types/FT_Grass","position":{"x":0,"y":0,"z":0},"brushSize":300}`,
|
|
358
452
|
inputSchema: {
|
|
359
453
|
type: 'object',
|
|
360
454
|
properties: {
|
|
@@ -404,7 +498,16 @@ export const consolidatedToolDefinitions = [
|
|
|
404
498
|
// 9. PERFORMANCE & AUDIO - System settings
|
|
405
499
|
{
|
|
406
500
|
name: 'system_control',
|
|
407
|
-
description:
|
|
501
|
+
description: `Performance toggles, quality settings, audio playback, simple UI helpers, screenshots, and engine lifecycle.
|
|
502
|
+
|
|
503
|
+
When to use this tool:
|
|
504
|
+
- Toggle profiling and FPS stats, adjust quality (sg.*), play a sound, create/show a basic widget, take a screenshot, or launch/quit the editor.
|
|
505
|
+
|
|
506
|
+
Examples:
|
|
507
|
+
- {"action":"show_fps","enabled":true}
|
|
508
|
+
- {"action":"set_quality","category":"Shadows","level":2}
|
|
509
|
+
- {"action":"play_sound","soundPath":"/Game/Audio/SFX/Click","volume":0.5}
|
|
510
|
+
- {"action":"screenshot","resolution":"1920x1080"}`,
|
|
408
511
|
inputSchema: {
|
|
409
512
|
type: 'object',
|
|
410
513
|
properties: {
|
|
@@ -473,7 +576,19 @@ export const consolidatedToolDefinitions = [
|
|
|
473
576
|
// 10. CONSOLE COMMAND - Universal tool
|
|
474
577
|
{
|
|
475
578
|
name: 'console_command',
|
|
476
|
-
description:
|
|
579
|
+
description: `Execute an Unreal console command with built-in safety.
|
|
580
|
+
|
|
581
|
+
When to use this tool:
|
|
582
|
+
- Fire a specific command (e.g., stat fps, viewmode wireframe, r.ScreenPercentage 75).
|
|
583
|
+
|
|
584
|
+
Safety:
|
|
585
|
+
- Dangerous commands are blocked (quit/exit, GPU crash triggers, unsafe visualizebuffer modes, etc.).
|
|
586
|
+
- Unknown commands will return a warning instead of crashing.
|
|
587
|
+
|
|
588
|
+
Examples:
|
|
589
|
+
- {"command":"stat fps"}
|
|
590
|
+
- {"command":"viewmode wireframe"}
|
|
591
|
+
- {"command":"r.ScreenPercentage 75"}`,
|
|
477
592
|
inputSchema: {
|
|
478
593
|
type: 'object',
|
|
479
594
|
properties: {
|
|
@@ -496,7 +611,17 @@ export const consolidatedToolDefinitions = [
|
|
|
496
611
|
// 11. REMOTE CONTROL PRESETS
|
|
497
612
|
{
|
|
498
613
|
name: 'manage_rc',
|
|
499
|
-
description:
|
|
614
|
+
description: `Create and manage Remote Control presets; expose actors/properties; set/get values.
|
|
615
|
+
|
|
616
|
+
When to use this tool:
|
|
617
|
+
- Automate Remote Control (RC) preset authoring and interaction from the assistant.
|
|
618
|
+
|
|
619
|
+
Examples:
|
|
620
|
+
- {"action":"create_preset","name":"LivePreset","path":"/Game/RCPresets"}
|
|
621
|
+
- {"action":"expose_actor","presetPath":"/Game/RCPresets/LivePreset","actorName":"CameraActor"}
|
|
622
|
+
- {"action":"expose_property","presetPath":"/Game/RCPresets/LivePreset","objectPath":"/Script/Engine.Default__Engine","propertyName":"GameUserSettings"}
|
|
623
|
+
- {"action":"list_fields","presetPath":"/Game/RCPresets/LivePreset"}
|
|
624
|
+
- {"action":"set_property","objectPath":"/Game/MyActor","propertyName":"CustomFloat","value":0.5}`,
|
|
500
625
|
inputSchema: {
|
|
501
626
|
type: 'object',
|
|
502
627
|
properties: {
|
|
@@ -530,7 +655,17 @@ export const consolidatedToolDefinitions = [
|
|
|
530
655
|
// 12. SEQUENCER / CINEMATICS
|
|
531
656
|
{
|
|
532
657
|
name: 'manage_sequence',
|
|
533
|
-
description:
|
|
658
|
+
description: `Create/open Level Sequences, bind actors, add cameras, and control playback.
|
|
659
|
+
|
|
660
|
+
When to use this tool:
|
|
661
|
+
- Build quick cinematics: create/open a sequence, add a camera or actors, tweak properties, and play.
|
|
662
|
+
|
|
663
|
+
Examples:
|
|
664
|
+
- {"action":"create","name":"Intro","path":"/Game/Cinematics"}
|
|
665
|
+
- {"action":"add_camera","spawnable":true}
|
|
666
|
+
- {"action":"add_actor","actorName":"Hero"}
|
|
667
|
+
- {"action":"play","loopMode":"once"}
|
|
668
|
+
- {"action":"set_properties","path":"/Game/Cinematics/Intro","frameRate":24,"lengthInFrames":480}`,
|
|
534
669
|
inputSchema: {
|
|
535
670
|
type: 'object',
|
|
536
671
|
properties: {
|
|
@@ -582,7 +717,14 @@ export const consolidatedToolDefinitions = [
|
|
|
582
717
|
// 13. INTROSPECTION
|
|
583
718
|
{
|
|
584
719
|
name: 'inspect',
|
|
585
|
-
description:
|
|
720
|
+
description: `Read object info and set properties with validation.
|
|
721
|
+
|
|
722
|
+
When to use this tool:
|
|
723
|
+
- Inspect an object by path (class default object or actor/component) and optionally modify properties.
|
|
724
|
+
|
|
725
|
+
Examples:
|
|
726
|
+
- {"action":"inspect_object","objectPath":"/Script/Engine.Default__Engine"}
|
|
727
|
+
- {"action":"set_property","objectPath":"/Game/MyActor","propertyName":"CustomBool","value":true}`,
|
|
586
728
|
inputSchema: {
|
|
587
729
|
type: 'object',
|
|
588
730
|
properties: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Consolidated tool handlers - maps
|
|
1
|
+
// Consolidated tool handlers - maps 13 tools to all 36 operations
|
|
2
2
|
import { handleToolCall } from './tool-handlers.js';
|
|
3
3
|
import { cleanObject } from '../utils/safe-json.js';
|
|
4
4
|
export async function handleConsolidatedToolCall(name, args, tools) {
|