Skip to main content
Glama

UnrealBlueprintMCP

by BestDev
API_REFERENCE.mdβ€’18.9 kB
# UnrealBlueprintMCP API Reference > **Version**: 1.0.0 > **Protocol**: JSON-RPC 2.0 via WebSocket > **Standard**: Model Context Protocol (MCP) ## πŸ“‹ λͺ©μ°¨ 1. [κ°œμš”](#κ°œμš”) 2. [μ—°κ²° 및 인증](#μ—°κ²°-및-인증) 3. [MCP 도ꡬ λͺ©λ‘](#mcp-도ꡬ-λͺ©λ‘) 4. [μš”μ²­/응닡 ν˜•μ‹](#μš”μ²­μ‘λ‹΅-ν˜•μ‹) 5. [였λ₯˜ 처리](#였λ₯˜-처리) 6. [데이터 νƒ€μž…](#데이터-νƒ€μž…) 7. [μ‚¬μš© 예제](#μ‚¬μš©-예제) --- ## πŸ” κ°œμš” UnrealBlueprintMCPλŠ” Model Context Protocol을 톡해 6개의 핡심 도ꡬλ₯Ό μ œκ³΅ν•˜λŠ” μ™„μ „νžˆ μž‘λ™ν•˜λŠ” ν”„λ‘œλ•μ…˜ μ‹œμŠ€ν…œμž…λ‹ˆλ‹€. λͺ¨λ“  톡신은 JSON-RPC 2.0 ν”„λ‘œν† μ½œμ„ μ‚¬μš©ν•˜λ©°, WebSocket을 톡해 Unreal Engineκ³Ό μ‹€μ‹œκ°„ μ–‘λ°©ν–₯ 톡신을 μˆ˜ν–‰ν•©λ‹ˆλ‹€. ### κΈ°λ³Έ 정보 - **MCP ν”„λ‘μ‹œ μ„œλ²„**: `ws://localhost:6277` - **Unreal WebSocket μ„œλ²„**: `ws://localhost:8080` - **ν”„λ‘œν† μ½œ**: WebSocket + JSON-RPC 2.0 - **인증**: μ„Έμ…˜ 토큰 기반 (MCP Inspector) - **문자 인코딩**: UTF-8 --- ## πŸ” μ—°κ²° 및 인증 ### WebSocket μ—°κ²° ```javascript // JavaScript μ˜ˆμ‹œ const ws = new WebSocket('ws://localhost:6277'); // 인증이 ν•„μš”ν•œ 경우 const ws = new WebSocket('ws://localhost:6277', { headers: { 'Authorization': 'Bearer YOUR_SESSION_TOKEN' } }); ``` ### μ„Έμ…˜ 토큰 MCP μ„œλ²„ μ‹œμž‘ μ‹œ μƒμ„±λ˜λŠ” 토큰을 μ‚¬μš©ν•©λ‹ˆλ‹€: ```bash # μ„œλ²„ μ‹œμž‘ μ‹œ 좜λ ₯λ˜λŠ” 토큰 πŸ”‘ Session token: 98378ccaa878e45b8c80b02f6ffb1e3277cef595707a0464d54a79fd04c90d41 ``` --- ## πŸ› οΈ MCP 도ꡬ λͺ©λ‘ ### 1. create_blueprint μƒˆλ‘œμš΄ λΈ”λ£¨ν”„λ¦°νŠΈ 에셋을 μƒμ„±ν•©λ‹ˆλ‹€. #### μš”μ²­ ν˜•μ‹ ```json { "jsonrpc": "2.0", "id": "req_001", "method": "tools/call", "params": { "name": "create_blueprint", "arguments": { "blueprint_name": "string", "parent_class": "string", "asset_path": "string" } } } ``` #### λ§€κ°œλ³€μˆ˜ | λ§€κ°œλ³€μˆ˜ | νƒ€μž… | ν•„μˆ˜ | κΈ°λ³Έκ°’ | μ„€λͺ… | |---------|------|------|--------|------| | `blueprint_name` | string | βœ… | - | 생성할 λΈ”λ£¨ν”„λ¦°νŠΈμ˜ 이름 | | `parent_class` | string | ❌ | "Actor" | λΆ€λͺ¨ 클래슀 (Actor, Pawn, Character λ“±) | | `asset_path` | string | ❌ | "/Game/Blueprints/" | λΈ”λ£¨ν”„λ¦°νŠΈλ₯Ό 생성할 경둜 | #### μ§€μ›λ˜λŠ” λΆ€λͺ¨ 클래슀 - `Actor` - κΈ°λ³Έ κ²Œμž„ 였브젝트 - `Pawn` - μ œμ–΄ κ°€λŠ₯ν•œ μ—”ν‹°ν‹° - `Character` - ν”Œλ ˆμ΄μ–΄/NPC 캐릭터 - `ActorComponent` - μž¬μ‚¬μš© κ°€λŠ₯ν•œ μ»΄ν¬λ„ŒνŠΈ - `SceneComponent` - λ³€ν™˜ 기반 μ»΄ν¬λ„ŒνŠΈ - `UserWidget` - UI μœ„μ ― 클래슀 - `Object` - κΈ°λ³Έ UObject 클래슀 #### 응닡 ν˜•μ‹ ```json { "jsonrpc": "2.0", "id": "req_001", "result": { "success": true, "message": "Blueprint 'TestActor' creation requested", "blueprint_path": "/Game/Blueprints/TestActor", "parent_class": "Actor", "unreal_response": { "success": true, "message": "Command 'create_blueprint' executed successfully", "timestamp": "2025-09-17T03:45:00.000Z" } } } ``` #### 였λ₯˜ 응닡 ```json { "jsonrpc": "2.0", "id": "req_001", "result": { "success": false, "error": "Invalid parent class: NonExistentClass", "message": "Failed to create blueprint 'TestActor'" } } ``` --- ### 2. set_blueprint_property κΈ°μ‘΄ λΈ”λ£¨ν”„λ¦°νŠΈμ˜ CDO(Class Default Object) 속성을 μˆ˜μ •ν•©λ‹ˆλ‹€. #### μš”μ²­ ν˜•μ‹ ```json { "jsonrpc": "2.0", "id": "req_002", "method": "tools/call", "params": { "name": "set_blueprint_property", "arguments": { "blueprint_path": "string", "property_name": "string", "property_value": "string", "property_type": "string" } } } ``` #### λ§€κ°œλ³€μˆ˜ | λ§€κ°œλ³€μˆ˜ | νƒ€μž… | ν•„μˆ˜ | μ„€λͺ… | |---------|------|------|------| | `blueprint_path` | string | βœ… | λΈ”λ£¨ν”„λ¦°νŠΈμ˜ 전체 에셋 경둜 | | `property_name` | string | βœ… | μˆ˜μ •ν•  μ†μ„±μ˜ 이름 | | `property_value` | string | βœ… | μƒˆλ‘œμš΄ 속성 κ°’ (λ¬Έμžμ—΄λ‘œ ν‘œν˜„) | | `property_type` | string | ❌ | 속성 νƒ€μž… 힌트 (μžλ™ 감지 μ‹œ μƒλž΅ κ°€λŠ₯) | #### μ§€μ›λ˜λŠ” 속성 νƒ€μž… | νƒ€μž… | ν˜•μ‹ μ˜ˆμ‹œ | μ„€λͺ… | |------|----------|------| | `int` | `"100"` | 32λΉ„νŠΈ μ •μˆ˜ | | `float` | `"3.14"` | 단정밀도 μ‹€μˆ˜ | | `bool` | `"true"` or `"false"` | 뢈린 κ°’ | | `string` | `"Hello World"` | λ¬Έμžμ—΄ | | `Vector` | `"100.0,200.0,300.0"` | 3D 벑터 (X,Y,Z) | | `Rotator` | `"0.0,90.0,0.0"` | 3D νšŒμ „ (Pitch,Yaw,Roll) | #### 응닡 ν˜•μ‹ ```json { "jsonrpc": "2.0", "id": "req_002", "result": { "success": true, "message": "Property 'Health' modification requested", "blueprint_path": "/Game/Blueprints/TestActor", "property_name": "Health", "property_value": "100", "property_type": "int", "unreal_response": { "success": true, "message": "Command 'set_property' executed successfully" } } } ``` --- ### 3. get_server_status MCP μ„œλ²„μ˜ ν˜„μž¬ μƒνƒœμ™€ μ—°κ²° 정보λ₯Ό μ‘°νšŒν•©λ‹ˆλ‹€. #### μš”μ²­ ν˜•μ‹ ```json { "jsonrpc": "2.0", "id": "req_003", "method": "tools/call", "params": { "name": "get_server_status", "arguments": {} } } ``` #### 응닡 ν˜•μ‹ ```json { "jsonrpc": "2.0", "id": "req_003", "result": { "server_name": "UnrealBlueprintMCPServer", "version": "1.0.0", "connection_status": "connected", "unreal_websocket_url": "ws://localhost:8080", "last_connection_attempt": "2025-01-07T12:00:00.000Z", "last_successful_ping": "2025-01-07T12:00:15.000Z", "timestamp": "2025-01-07T12:00:30.000Z", "available_tools": [ "create_blueprint", "set_blueprint_property", "list_supported_blueprint_classes", "create_test_actor_blueprint" ] } } ``` --- ### 4. list_supported_blueprint_classes μ§€μ›λ˜λŠ” λΈ”λ£¨ν”„λ¦°νŠΈ λΆ€λͺ¨ 클래슀 λͺ©λ‘μ„ λ°˜ν™˜ν•©λ‹ˆλ‹€. #### μš”μ²­ ν˜•μ‹ ```json { "jsonrpc": "2.0", "id": "req_004", "method": "tools/call", "params": { "name": "list_supported_blueprint_classes", "arguments": {} } } ``` #### 응닡 ν˜•μ‹ ```json { "jsonrpc": "2.0", "id": "req_004", "result": [ "Actor", "Pawn", "Character", "ActorComponent", "SceneComponent", "UserWidget", "Object" ] } ``` --- ### 5. create_test_actor_blueprint ν…ŒμŠ€νŠΈμš© Actor λΈ”λ£¨ν”„λ¦°νŠΈλ₯Ό λΉ λ₯΄κ²Œ μƒμ„±ν•˜κ³  초기 μœ„μΉ˜λ₯Ό μ„€μ •ν•©λ‹ˆλ‹€. #### μš”μ²­ ν˜•μ‹ ```json { "jsonrpc": "2.0", "id": "req_005", "method": "tools/call", "params": { "name": "create_test_actor_blueprint", "arguments": { "blueprint_name": "string", "location": { "x": 0.0, "y": 0.0, "z": 100.0 } } } } ``` #### λ§€κ°œλ³€μˆ˜ | λ§€κ°œλ³€μˆ˜ | νƒ€μž… | ν•„μˆ˜ | κΈ°λ³Έκ°’ | μ„€λͺ… | |---------|------|------|--------|------| | `blueprint_name` | string | ❌ | "TestActor" | ν…ŒμŠ€νŠΈ λΈ”λ£¨ν”„λ¦°νŠΈ 이름 | | `location` | Vector3D | ❌ | `{x:0, y:0, z:100}` | 초기 μ›”λ“œ μœ„μΉ˜ | #### 응닡 ν˜•μ‹ ```json { "jsonrpc": "2.0", "id": "req_005", "result": { "success": true, "message": "Test actor blueprint 'MyTestActor' created successfully with location {100.0, 200.0, 300.0}", "blueprint_creation": { "success": true, "blueprint_path": "/Game/Blueprints/MyTestActor" }, "property_setting": { "success": true, "property_name": "RootComponent" }, "final_blueprint_path": "/Game/Blueprints/MyTestActor", "location": { "x": 100.0, "y": 200.0, "z": 300.0 } } } ``` --- ### 6. test_unreal_connection Unreal Engine과의 WebSocket μ—°κ²° μƒνƒœλ₯Ό ν…ŒμŠ€νŠΈν•©λ‹ˆλ‹€. #### μš”μ²­ ν˜•μ‹ ```json { "jsonrpc": "2.0", "id": "req_006", "method": "tools/call", "params": { "name": "test_unreal_connection", "arguments": {} } } ``` #### 응닡 ν˜•μ‹ (성곡) ```json { "jsonrpc": "2.0", "id": "req_006", "result": { "success": true, "message": "Connection test completed", "response_time_seconds": 0.123, "unreal_response": { "success": true, "message": "Command 'ping' executed successfully" }, "connection_status": "connected" } } ``` #### 응닡 ν˜•μ‹ (μ‹€νŒ¨) ```json { "jsonrpc": "2.0", "id": "req_006", "result": { "success": false, "error": "Connection timeout", "message": "Failed to connect to Unreal Engine" } } ``` --- ## πŸ“¨ μš”μ²­/응닡 ν˜•μ‹ ### κΈ°λ³Έ μš”μ²­ ꡬ쑰 λͺ¨λ“  MCP 도ꡬ ν˜ΈμΆœμ€ λ‹€μŒ ν˜•μ‹μ„ λ”°λ¦…λ‹ˆλ‹€: ```json { "jsonrpc": "2.0", "id": "unique_request_id", "method": "tools/call", "params": { "name": "tool_name", "arguments": { "param1": "value1", "param2": "value2" } } } ``` ### κΈ°λ³Έ 응닡 ꡬ쑰 ```json { "jsonrpc": "2.0", "id": "unique_request_id", "result": { // 도ꡬ별 응닡 데이터 } } ``` ### 였λ₯˜ 응닡 ꡬ쑰 ```json { "jsonrpc": "2.0", "id": "unique_request_id", "error": { "code": -32000, "message": "Tool execution failed", "data": { "tool_name": "create_blueprint", "error_details": "Invalid blueprint name" } } } ``` --- ## ❌ 였λ₯˜ 처리 ### ν‘œμ€€ JSON-RPC 였λ₯˜ μ½”λ“œ | μ½”λ“œ | 이름 | μ„€λͺ… | |------|------|------| | -32700 | Parse error | JSON νŒŒμ‹± 였λ₯˜ | | -32600 | Invalid Request | 잘λͺ»λœ μš”μ²­ ν˜•μ‹ | | -32601 | Method not found | μ‘΄μž¬ν•˜μ§€ μ•ŠλŠ” λ©”μ„œλ“œ | | -32602 | Invalid params | 잘λͺ»λœ λ§€κ°œλ³€μˆ˜ | | -32603 | Internal error | λ‚΄λΆ€ μ„œλ²„ 였λ₯˜ | ### UnrealBlueprintMCP νŠΉμ • 였λ₯˜ | μ½”λ“œ | μ„€λͺ… | ν•΄κ²° 방법 | |------|------|----------| | -32000 | Tool execution failed | 도ꡬ μ‹€ν–‰ 쀑 였λ₯˜ λ°œμƒ | | -32001 | Blueprint creation failed | λΈ”λ£¨ν”„λ¦°νŠΈ 생성 μ‹€νŒ¨ | | -32002 | Property setting failed | 속성 μ„€μ • μ‹€νŒ¨ | | -32003 | Unreal connection failed | Unreal Engine μ—°κ²° μ‹€νŒ¨ | | -32004 | Invalid blueprint path | 잘λͺ»λœ λΈ”λ£¨ν”„λ¦°νŠΈ 경둜 | | -32005 | Unsupported property type | μ§€μ›λ˜μ§€ μ•ŠλŠ” 속성 νƒ€μž… | ### 였λ₯˜ 응닡 μ˜ˆμ‹œ ```json { "jsonrpc": "2.0", "id": "req_001", "error": { "code": -32001, "message": "Blueprint creation failed", "data": { "tool_name": "create_blueprint", "blueprint_name": "Invalid@Name", "error_details": "Blueprint name contains invalid characters" } } } ``` --- ## πŸ”’ 데이터 νƒ€μž… ### Vector3D 3차원 벑터λ₯Ό λ‚˜νƒ€λ‚΄λŠ” ꡬ쑰체: ```json { "x": 100.0, "y": 200.0, "z": 300.0 } ``` **λ¬Έμžμ—΄ ν˜•μ‹**: `"100.0,200.0,300.0"` ### BlueprintCreateParams λΈ”λ£¨ν”„λ¦°νŠΈ 생성을 μœ„ν•œ λ§€κ°œλ³€μˆ˜: ```json { "blueprint_name": "MyActor", "parent_class": "Actor", "asset_path": "/Game/Blueprints/" } ``` ### BlueprintPropertyParams λΈ”λ£¨ν”„λ¦°νŠΈ 속성 섀정을 μœ„ν•œ λ§€κ°œλ³€μˆ˜: ```json { "blueprint_path": "/Game/Blueprints/MyActor", "property_name": "Health", "property_value": "100", "property_type": "int" } ``` --- ## πŸ’‘ μ‚¬μš© 예제 ### 예제 1: κΈ°λ³Έ λΈ”λ£¨ν”„λ¦°νŠΈ 생성 ```javascript // WebSocket μ—°κ²° const ws = new WebSocket('ws://localhost:6277'); // λΈ”λ£¨ν”„λ¦°νŠΈ 생성 μš”μ²­ const createRequest = { "jsonrpc": "2.0", "id": "bp_create_001", "method": "tools/call", "params": { "name": "create_blueprint", "arguments": { "blueprint_name": "PlayerCharacter", "parent_class": "Character", "asset_path": "/Game/Characters/" } } }; ws.send(JSON.stringify(createRequest)); // 응닡 처리 ws.onmessage = function(event) { const response = JSON.parse(event.data); if (response.id === "bp_create_001") { if (response.result.success) { console.log("λΈ”λ£¨ν”„λ¦°νŠΈ 생성 성곡:", response.result.blueprint_path); } else { console.error("λΈ”λ£¨ν”„λ¦°νŠΈ 생성 μ‹€νŒ¨:", response.result.error); } } }; ``` ### 예제 2: 속성 μ„€μ • 체인 ```python import asyncio import websockets import json async def setup_character(): uri = "ws://localhost:6277" async with websockets.connect(uri) as websocket: # 1. 캐릭터 λΈ”λ£¨ν”„λ¦°νŠΈ 생성 create_msg = { "jsonrpc": "2.0", "id": "create_char", "method": "tools/call", "params": { "name": "create_blueprint", "arguments": { "blueprint_name": "GameCharacter", "parent_class": "Character" } } } await websocket.send(json.dumps(create_msg)) response = await websocket.recv() result = json.loads(response) if result["result"]["success"]: blueprint_path = result["result"]["blueprint_path"] # 2. 체λ ₯ μ„€μ • health_msg = { "jsonrpc": "2.0", "id": "set_health", "method": "tools/call", "params": { "name": "set_blueprint_property", "arguments": { "blueprint_path": blueprint_path, "property_name": "Health", "property_value": "100", "property_type": "int" } } } await websocket.send(json.dumps(health_msg)) health_response = await websocket.recv() # 3. 이동 속도 μ„€μ • speed_msg = { "jsonrpc": "2.0", "id": "set_speed", "method": "tools/call", "params": { "name": "set_blueprint_property", "arguments": { "blueprint_path": blueprint_path, "property_name": "MovementSpeed", "property_value": "600.0", "property_type": "float" } } } await websocket.send(json.dumps(speed_msg)) speed_response = await websocket.recv() print("캐릭터 μ„€μ • μ™„λ£Œ!") # μ‹€ν–‰ asyncio.run(setup_character()) ``` ### 예제 3: 배치 생성 ```python async def create_game_objects(): """κ²Œμž„ μ˜€λΈŒμ νŠΈλ“€μ„ 배치둜 생성""" objects_to_create = [ {"name": "Player", "class": "Character", "path": "/Game/Characters/"}, {"name": "Enemy", "class": "Pawn", "path": "/Game/Enemies/"}, {"name": "Weapon", "class": "Actor", "path": "/Game/Weapons/"}, {"name": "PowerUp", "class": "Actor", "path": "/Game/Items/"}, {"name": "MainMenu", "class": "UserWidget", "path": "/Game/UI/"} ] uri = "ws://localhost:6277" async with websockets.connect(uri) as websocket: for i, obj in enumerate(objects_to_create): request = { "jsonrpc": "2.0", "id": f"batch_create_{i}", "method": "tools/call", "params": { "name": "create_blueprint", "arguments": { "blueprint_name": obj["name"], "parent_class": obj["class"], "asset_path": obj["path"] } } } await websocket.send(json.dumps(request)) response = await websocket.recv() result = json.loads(response) if result["result"]["success"]: print(f"βœ… {obj['name']} 생성 μ™„λ£Œ") else: print(f"❌ {obj['name']} 생성 μ‹€νŒ¨: {result['result'].get('error')}") asyncio.run(create_game_objects()) ``` --- ## πŸ”„ 비동기 처리 ### μ—¬λŸ¬ μš”μ²­ λ™μ‹œ 처리 ```python import asyncio import websockets import json async def concurrent_operations(): """μ—¬λŸ¬ μž‘μ—…μ„ λ™μ‹œμ— μ‹€ν–‰""" uri = "ws://localhost:6277" async def create_blueprint(name, parent_class): async with websockets.connect(uri) as ws: request = { "jsonrpc": "2.0", "id": f"create_{name}", "method": "tools/call", "params": { "name": "create_blueprint", "arguments": { "blueprint_name": name, "parent_class": parent_class } } } await ws.send(json.dumps(request)) response = await ws.recv() return json.loads(response) # λ™μ‹œ μ‹€ν–‰ tasks = [ create_blueprint("Actor1", "Actor"), create_blueprint("Actor2", "Actor"), create_blueprint("Player", "Character"), create_blueprint("Enemy", "Pawn") ] results = await asyncio.gather(*tasks) for result in results: blueprint_name = result["result"].get("blueprint_path", "Unknown") success = result["result"].get("success", False) print(f"{'βœ…' if success else '❌'} {blueprint_name}") asyncio.run(concurrent_operations()) ``` --- ## πŸ“š SDK 및 래퍼 ### Python SDK ```python # SDKλ₯Ό ν†΅ν•œ κ°„νŽΈν•œ μ‚¬μš© from unreal_blueprint_sdk import UnrealBlueprintClient client = UnrealBlueprintClient() # λΈ”λ£¨ν”„λ¦°νŠΈ 생성 await client.create_blueprint("MyActor", "Actor") # 속성 μ„€μ • await client.set_property("MyActor", "Health", 100) ``` ### TypeScript/JavaScript SDK ```typescript import { UnrealBlueprintClient } from 'unreal-blueprint-mcp-client'; const client = new UnrealBlueprintClient('ws://localhost:6277'); // λΈ”λ£¨ν”„λ¦°νŠΈ 생성 const result = await client.createBlueprint({ blueprintName: 'MyActor', parentClass: 'Actor' }); // 속성 μ„€μ • await client.setProperty({ blueprintPath: result.blueprintPath, propertyName: 'Health', propertyValue: '100', propertyType: 'int' }); ``` --- **πŸ“š 이 API λ ˆνΌλŸ°μŠ€λŠ” UnrealBlueprintMCP v1.0.0 κΈ°μ€€μœΌλ‘œ μž‘μ„±λ˜μ—ˆμŠ΅λ‹ˆλ‹€. (ν”„λ‘œλ•μ…˜ λ ˆλ”” 버전)** **πŸ”„ μ΅œμ‹  μ •λ³΄λŠ” [GitHub Repository](https://github.com/yourusername/unreal-blueprint-mcp)μ—μ„œ ν™•μΈν•˜μ„Έμš”.**

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/BestDev/unreal_bp_mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server