-
Notifications
You must be signed in to change notification settings - Fork 116
feat: add remote host configuration support for Unity WebSocket connection #59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ction Add configurable host property to McpUnity class with support for UNITY_HOST environment variable and Host configuration in Unity's McpUnitySettings.json. Maintains full backward compatibility with original Unity workflow while enabling remote Unity Editor connections across network.
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing Touches🧪 Generate Unit Tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good suggestion
please add to README documentation in all languages the information for the UNITY_HOST option
Add it into the option section as is structured in the UNITY_PORT description
- Add AllowRemoteConnections setting to McpUnitySettings - Update WebSocket server to bind to 0.0.0.0 when remote connections enabled - Add UI checkbox in Unity Editor window for remote connection toggle - Server automatically restarts when binding setting changes - Defaults to localhost-only connections for security
Add documentation for UNITY_HOST environment variable and Unity Editor remote connection settings to all language READMEs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great addition to add option in the settings
Thank you
Looking at the existing description, I can see it contains substantial content with clear sections including Summary, Changes, Usage Example, and Testing. This is not empty or a template, so I need to enhance it with additional analysis while preserving the existing structure.
Summary
Enables remote Unity Editor connections across network. Useful for development setups where Unity runs on different machine.
Changes
UNITY_HOST
environment variable as first priorityHost
configuration in Unity's McpUnitySettings.json as fallbackTechnical Implementation Details
The implementation adds a new
host
property to theMcpUnity
class, initialized to'localhost'
by default. The configuration resolution follows a clear priority order:UNITY_HOST
environment variable (highest priority)Host
field in configuration file'localhost'
(maintains existing behavior)The WebSocket connection URL construction in the
connect()
method is updated from the hardcodedws://localhost:${this.port}/McpUnity
to use the configurablews://${this.host}:${this.port}/McpUnity
format.Usage Example
Remote Unity setup:
# Unity running on 192.168.1.100, launch MCP bridge on different machine UNITY_HOST=192.168.1.100 node server.js
Or via Unity settings file:
Default behavior (unchanged):
# Still connects to localhost:8090 if no host specified node server.js
Testing
Tested with Unity Editor on Windows PC and MCP bridge on remote Ubuntu server. Verified GameObject creation, selection, etc work remotely.
Changes that Break Backward Compatibility
N/A - The implementation maintains full backward compatibility by defaulting to
'localhost'
when no host configuration is provided.Documentation
N/A - No documentation files were modified in this PR, though the usage examples in the description provide clear guidance for the new functionality.
Created with Palmier