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)μμ νμΈνμΈμ.**