Crossplay Integration Kit
MCP Server

MCP Server

Expose tools to external agents via HTTP

The MCP (Model Context Protocol) Server allows external AI agents to use the plugin's tools via HTTP with Server-Sent Events (SSE).

Overview

The MCP Server:

  • Runs as an HTTP server within Unreal Editor
  • Exposes all registered tools via JSON-RPC 2.0
  • Supports SSE for streaming responses
  • Enables integration with any MCP-compatible agent

Configuration

Project Settings

In Project Settings > Plugins > Agent Integration Kit:

SettingDescriptionDefault
Server PortHTTP port for MCP server9315
Auto StartStart server when editor launchesfalse

Manual Start/Stop

// Start server
FMCPServer::Get().Start(9315);

// Stop server
FMCPServer::Get().Stop();

// Check status
bool bRunning = FMCPServer::Get().IsRunning();

Protocol

Endpoint

http://localhost:9315/mcp

Request Format

JSON-RPC 2.0 requests:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "EditBlueprint",
    "arguments": {
      "action": "add_variable",
      "asset_path": "/Game/BP_Player",
      "variable_name": "Health",
      "variable_type": "float"
    }
  }
}

Response Format

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "success": true,
    "message": "Added variable Health to BP_Player"
  }
}

SSE Streaming

For streaming responses, use SSE connection:

GET /mcp/sse

Events are streamed as:

event: tool_result
data: {"success": true, "partial": "Creating node..."}

event: tool_result
data: {"success": true, "message": "Complete"}

Available Methods

tools/list

List all available tools:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/list"
}

Response:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "tools": [
      {
        "name": "EditBlueprint",
        "description": "Modify Blueprint structure",
        "inputSchema": {...}
      }
    ]
  }
}

tools/call

Execute a tool:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "CreateFile",
    "arguments": {
      "file_type": "Blueprint",
      "asset_path": "/Game/BP_NewActor",
      "blueprint_type": "Actor"
    }
  }
}

Tool Schemas

Each tool provides a JSON Schema for its parameters:

{
  "name": "EditGraph",
  "description": "Edit Blueprint or Material graphs",
  "inputSchema": {
    "type": "object",
    "properties": {
      "asset_path": {
        "type": "string",
        "description": "Path to the asset"
      },
      "action": {
        "type": "string",
        "enum": ["add_node", "set_pin", "connect", "disconnect"]
      }
    },
    "required": ["asset_path", "action"]
  }
}

Integration Examples

Python Client

import requests
import json

def call_tool(name, arguments):
    response = requests.post(
        "http://localhost:9315/mcp",
        json={
            "jsonrpc": "2.0",
            "id": 1,
            "method": "tools/call",
            "params": {
                "name": name,
                "arguments": arguments
            }
        }
    )
    return response.json()

# Create a Blueprint
result = call_tool("CreateFile", {
    "file_type": "Blueprint",
    "asset_path": "/Game/BP_Test",
    "blueprint_type": "Actor"
})
print(result)

Node.js Client

const fetch = require('node-fetch');

async function callTool(name, args) {
  const response = await fetch('http://localhost:9315/mcp', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      jsonrpc: '2.0',
      id: 1,
      method: 'tools/call',
      params: { name, arguments: args }
    })
  });
  return response.json();
}

// List all tools
const tools = await callTool('tools/list', {});
console.log(tools);

Security

The MCP server runs locally and should not be exposed to the network:

  • Binds to localhost only
  • No authentication (trusted local environment)
  • Firewall rules recommended for additional security

Troubleshooting

"Connection refused"

  • Server not started
  • Wrong port
  • Firewall blocking

"Method not found"

  • Tool not registered
  • Typo in tool name
  • Check tools/list for available tools

Timeout

  • Tool execution taking too long
  • Large operation (consider streaming)
  • Editor unresponsive

On this page