Skip to content

Conversation

@jonathanhawkins
Copy link

Summary

  • Fixed critical bug where StaticMeshActors were invisible (no mesh assigned)
  • Enabled WSL2/remote connections by binding to 0.0.0.0 instead of localhost
  • Added screenshot capture functionality to MCP tools

Critical Fixes

1. StaticMeshActor Visibility Bug

Problem: When spawning StaticMeshActors, they were invisible because no mesh was being set.
Solution: Added mesh loading logic in HandleSpawnActor to properly assign static meshes to actors.

2. WSL2 Network Connectivity

Problem: WSL2 couldn't connect to Unreal Engine because the server was binding to 127.0.0.1.
Solution: Changed binding from localhost to 0.0.0.0 to accept connections from all interfaces.

3. Screenshot Tool

Added: New take_screenshot MCP tool that uses Unreal's built-in viewport capture.

Changes Made

C++ Plugin (UnrealMCPBridge.cpp)

  • Changed MCP_SERVER_HOST from "127.0.0.1" to "0.0.0.0"
  • Allows connections from WSL2 and remote machines

Actor Commands (UnrealMCPEditorCommands.cpp)

  • Added mesh loading for StaticMeshActor spawning
  • Defaults to cube mesh if none specified
  • Properly sets the mesh component

Python MCP Server

  • Made host/port configurable via environment variables
  • Added take_screenshot tool with full parameters
  • Added static_mesh parameter to spawn_actor

Documentation

  • Added WSL2 setup instructions
  • Created PowerShell startup script
  • Added example MCP configuration for WSL2
  • Documented screenshot functionality

Test Plan

  • Tested spawning StaticMeshActor - mesh now visible
  • Tested WSL2 connection with 0.0.0.0 binding - connects successfully
  • Tested screenshot capture - saves to project Screenshots folder
  • Verified no hardcoded IPs remain in committed files

Breaking Changes

None - all changes are backward compatible.

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com

CORE FIXES ONLY:
1. StaticMeshActors now have mesh set (were invisible before)
2. Server binds to 0.0.0.0 instead of 127.0.0.1 (enables WSL2)
3. Python host/port configurable via env vars

These are minimal, essential changes that fix broken functionality.
- StartUnrealWithMCP.bat for easy Windows launch with correct flags
- mcp-wsl2-example.json as reference configuration
- Clear documentation on when/why to use -UnrealMCPBind=0.0.0.0
- start_mcp.sh helper for WSL2 users

Documentation only - no code changes.
- Added screenshot capability to Editor Control features list
- Added Example MCP Usage section with natural language examples
- Clarified that actors now appear with meshes (fixing previous bug)
- Documented that screenshots use Unreal's built-in tool
- Use environment variables with defaults instead of hardcoded IP
- Default to localhost (127.0.0.1) if UNREAL_HOST not set
- Add helpful echo messages showing connection target
- Make script more portable by using relative paths
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant