chore: bump version to 9.6.5#1027
Merged
github-actions[bot] merged 32 commits intomainfrom Apr 3, 2026
Merged
Conversation
Adds a built-in `execute_code` tool that compiles and runs C# code inside the Unity Editor via CSharpCodeProvider. No external dependencies (Roslyn not required), no script files created. ## Actions - `execute` — compile and run C# method body, return result - `get_history` — list past executions with previews - `replay` — re-run a history entry with original settings - `clear_history` — clear execution history ## Safety - `safety_checks` (default: true) blocks known dangerous patterns (File.Delete, Process.Start, AssetDatabase.DeleteAsset, infinite loops) - Clearly documented as pattern-based blocklist, NOT a security sandbox - `destructiveHint=True` annotation for MCP clients ## Features - In-memory compilation with all loaded assembly references - User-friendly error line numbers (wrapper offset subtracted) - Execution history (max 50 entries) with code preview truncation - Replay preserves original safety_checks setting - CLI commands: `code execute`, `code history`, `code replay`, `code clear-history` ## Files - C#: `MCPForUnity/Editor/Tools/ExecuteCode.cs` (329 lines) - Python: `Server/src/services/tools/execute_code.py` (85 lines) - CLI: `Server/src/cli/commands/code.py` (+89 lines) - Tests: `Server/tests/test_execute_code.py` (17 tests, all passing) - Manifest: added `execute_code` entry Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fix off-by-one in WrapperLineOffset (9 → 10) - Cache resolved assembly paths in static field for performance - Add encoding="utf-8" to CLI file read - Add group="scripting_ext" to Python tool decorator Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Address CodeRabbit nitpick — deduplicate result printing logic between execute and replay commands. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
manage_gameobject already serializes isStatic in read output (GameObjectSerializer, GameObjectResource) but the modify action had no parameter to write it. This adds is_static (bool) across all three layers: - C#: GameObjectModify.cs calls GameObjectUtility.SetStaticEditorFlags() - Python MCP tool: manage_gameobject.py with coerce_bool normalization - Python CLI: gameobject.py with --static/--no-static flag When true, all static flags are set; when false, all are cleared. Omitting the parameter is a no-op (fully backwards compatible). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Tests cover: is_static=True, is_static=False, string coercion
("true" → True), and omission (isStatic excluded from params).
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ects targetGo.isStatic returns true when *any* flag is set, so a partially static object (e.g. only Navigation) would skip the update when is_static=true was requested. Compare GetStaticEditorFlags() against the desired flags instead. Also adds a "false" string coercion test per review feedback. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…781673286 chore: sync main (v9.6.4) into beta
…04570893 chore: update Unity package to beta version 9.6.5-beta.2
Prefab stages integration
…31441803 chore: update Unity package to beta version 9.6.5-beta.3
…tatic feat(manage_gameobject): add is_static parameter to modify action
…33079179 chore: update Unity package to beta version 9.6.5-beta.4
feat: add execute_code tool for running arbitrary C# in Unity Editor
…67371489 chore: update Unity package to beta version 9.6.5-beta.5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Automated version bump to 9.6.5.