Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions MCPForUnity/Editor/Clients/Configurators/RiderConfigurator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ public class RiderConfigurator : JsonFileMcpConfigurator
public RiderConfigurator() : base(new McpClient
{
name = "Rider GitHub Copilot",
windowsConfigPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "JetBrains", "Rider", "mcp.json"),
macConfigPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Library", "Application Support", "JetBrains", "Rider", "mcp.json"),
linuxConfigPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".config", "JetBrains", "Rider", "mcp.json"),
windowsConfigPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "github-copilot", "intellij", "mcp.json"),
macConfigPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Library", "Application Support", "github-copilot", "intellij", "mcp.json"),
linuxConfigPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".config", "github-copilot", "intellij", "mcp.json"),
IsVsCodeLayout = true
})
{ }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ private void InitializeUI()
{
projectScopedToolsToggle.value = EditorPrefs.GetBool(
EditorPrefKeys.ProjectScopedToolsLocalHttp,
true
false
);
}

Expand Down
13 changes: 7 additions & 6 deletions Server/src/cli/commands/animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ def animation():
)
def play(target: str, state_name: str, layer: int, search_method: Optional[str]):
"""Play an animation state on a target's Animator.

\b
Examples:
unity-mcp animation play "Player" "Walk"
unity-mcp animation play "Enemy" "Attack" --layer 1
"""
config = get_config()

# Set Animator parameter to trigger state
params: dict[str, Any] = {
"action": "set_property",
Expand All @@ -49,10 +49,10 @@ def play(target: str, state_name: str, layer: int, search_method: Optional[str])
"value": state_name,
"layer": layer,
}

if search_method:
params["searchMethod"] = search_method

try:
result = run_command("manage_components", params, config)
click.echo(format_output(result, config.format))
Expand All @@ -74,13 +74,14 @@ def play(target: str, state_name: str, layer: int, search_method: Optional[str])
)
def set_parameter(target: str, param_name: str, value: str, param_type: str):
"""Set an Animator parameter.

\b
Examples:
unity-mcp animation set-parameter "Player" "Speed" 5.0
unity-mcp animation set-parameter "Player" "IsRunning" true --type bool
unity-mcp animation set-parameter "Player" "Jump" "" --type trigger
"""
config = get_config()
print_info("Animation parameter command - requires custom Unity implementation")
print_info(
"Animation parameter command - requires custom Unity implementation")
click.echo(f"Would set {param_name}={value} ({param_type}) on {target}")
65 changes: 34 additions & 31 deletions Server/src/cli/commands/asset.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def asset():
)
def search(pattern: str, path: str, filter_type: Optional[str], limit: int, page: int):
"""Search for assets.

\b
Examples:
unity-mcp asset search "*.prefab"
Expand All @@ -52,18 +52,18 @@ def search(pattern: str, path: str, filter_type: Optional[str], limit: int, page
unity-mcp asset search "t:MonoScript" --path "Assets/Scripts"
"""
config = get_config()

params: dict[str, Any] = {
"action": "search",
"path": path,
"searchPattern": pattern,
"pageSize": limit,
"pageNumber": page,
}

if filter_type:
params["filterType"] = filter_type

try:
result = run_command("manage_asset", params, config)
click.echo(format_output(result, config.format))
Expand All @@ -81,20 +81,20 @@ def search(pattern: str, path: str, filter_type: Optional[str], limit: int, page
)
def info(path: str, preview: bool):
"""Get detailed information about an asset.

\b
Examples:
unity-mcp asset info "Assets/Materials/Red.mat"
unity-mcp asset info "Assets/Prefabs/Player.prefab" --preview
"""
config = get_config()

params: dict[str, Any] = {
"action": "get_info",
"path": path,
"generatePreview": preview,
}

try:
result = run_command("manage_asset", params, config)
click.echo(format_output(result, config.format))
Expand All @@ -113,28 +113,28 @@ def info(path: str, preview: bool):
)
def create(path: str, asset_type: str, properties: Optional[str]):
"""Create a new asset.

\b
Examples:
unity-mcp asset create "Assets/Materials/Blue.mat" Material
unity-mcp asset create "Assets/NewFolder" Folder
unity-mcp asset create "Assets/Materials/Custom.mat" Material --properties '{"color": [0,0,1,1]}'
"""
config = get_config()

params: dict[str, Any] = {
"action": "create",
"path": path,
"assetType": asset_type,
}

if properties:
try:
params["properties"] = json.loads(properties)
except json.JSONDecodeError as e:
print_error(f"Invalid JSON for properties: {e}")
sys.exit(1)

try:
result = run_command("manage_asset", params, config)
click.echo(format_output(result, config.format))
Expand All @@ -154,19 +154,20 @@ def create(path: str, asset_type: str, properties: Optional[str]):
)
def delete(path: str, force: bool):
"""Delete an asset.

\b
Examples:
unity-mcp asset delete "Assets/OldMaterial.mat"
unity-mcp asset delete "Assets/Unused" --force
"""
config = get_config()

if not force:
click.confirm(f"Delete asset '{path}'?", abort=True)

try:
result = run_command("manage_asset", {"action": "delete", "path": path}, config)
result = run_command(
"manage_asset", {"action": "delete", "path": path}, config)
click.echo(format_output(result, config.format))
if result.get("success"):
print_success(f"Deleted: {path}")
Expand All @@ -180,19 +181,19 @@ def delete(path: str, force: bool):
@click.argument("destination")
def duplicate(source: str, destination: str):
"""Duplicate an asset.

\b
Examples:
unity-mcp asset duplicate "Assets/Materials/Red.mat" "Assets/Materials/RedCopy.mat"
"""
config = get_config()

params: dict[str, Any] = {
"action": "duplicate",
"path": source,
"destination": destination,
}

try:
result = run_command("manage_asset", params, config)
click.echo(format_output(result, config.format))
Expand All @@ -208,19 +209,19 @@ def duplicate(source: str, destination: str):
@click.argument("destination")
def move(source: str, destination: str):
"""Move an asset to a new location.

\b
Examples:
unity-mcp asset move "Assets/Old/Material.mat" "Assets/New/Material.mat"
"""
config = get_config()

params: dict[str, Any] = {
"action": "move",
"path": source,
"destination": destination,
}

try:
result = run_command("manage_asset", params, config)
click.echo(format_output(result, config.format))
Expand All @@ -236,24 +237,24 @@ def move(source: str, destination: str):
@click.argument("new_name")
def rename(path: str, new_name: str):
"""Rename an asset.

\b
Examples:
unity-mcp asset rename "Assets/Materials/Old.mat" "New.mat"
"""
config = get_config()

# Construct destination path
import os
dir_path = os.path.dirname(path)
destination = os.path.join(dir_path, new_name).replace("\\", "/")

params: dict[str, Any] = {
"action": "rename",
"path": path,
"destination": destination,
}

try:
result = run_command("manage_asset", params, config)
click.echo(format_output(result, config.format))
Expand All @@ -268,15 +269,16 @@ def rename(path: str, new_name: str):
@click.argument("path")
def import_asset(path: str):
"""Import/reimport an asset.

\b
Examples:
unity-mcp asset import "Assets/Textures/NewTexture.png"
"""
config = get_config()

try:
result = run_command("manage_asset", {"action": "import", "path": path}, config)
result = run_command(
"manage_asset", {"action": "import", "path": path}, config)
click.echo(format_output(result, config.format))
if result.get("success"):
print_success(f"Imported: {path}")
Expand All @@ -289,16 +291,17 @@ def import_asset(path: str):
@click.argument("path")
def mkdir(path: str):
"""Create a folder.

\b
Examples:
unity-mcp asset mkdir "Assets/NewFolder"
unity-mcp asset mkdir "Assets/Levels/Chapter1"
"""
config = get_config()

try:
result = run_command("manage_asset", {"action": "create_folder", "path": path}, config)
result = run_command(
"manage_asset", {"action": "create_folder", "path": path}, config)
click.echo(format_output(result, config.format))
if result.get("success"):
print_success(f"Created folder: {path}")
Expand Down
24 changes: 12 additions & 12 deletions Server/src/cli/commands/audio.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ def audio():
)
def play(target: str, clip: Optional[str], search_method: Optional[str]):
"""Play audio on a target's AudioSource.

\b
Examples:
unity-mcp audio play "MusicPlayer"
unity-mcp audio play "SFXSource" --clip "Assets/Audio/explosion.wav"
"""
config = get_config()

params: dict[str, Any] = {
"action": "set_property",
"target": target,
Expand All @@ -48,10 +48,10 @@ def play(target: str, clip: Optional[str], search_method: Optional[str]):

if clip:
params["clip"] = clip

if search_method:
params["searchMethod"] = search_method

try:
result = run_command("manage_components", params, config)
click.echo(format_output(result, config.format))
Expand All @@ -70,24 +70,24 @@ def play(target: str, clip: Optional[str], search_method: Optional[str]):
)
def stop(target: str, search_method: Optional[str]):
"""Stop audio on a target's AudioSource.

\b
Examples:
unity-mcp audio stop "MusicPlayer"
"""
config = get_config()

params: dict[str, Any] = {
"action": "set_property",
"target": target,
"componentType": "AudioSource",
"property": "Stop",
"value": True,
}

if search_method:
params["searchMethod"] = search_method

try:
result = run_command("manage_components", params, config)
click.echo(format_output(result, config.format))
Expand All @@ -107,24 +107,24 @@ def stop(target: str, search_method: Optional[str]):
)
def volume(target: str, level: float, search_method: Optional[str]):
"""Set audio volume on a target's AudioSource.

\b
Examples:
unity-mcp audio volume "MusicPlayer" 0.5
"""
config = get_config()

params: dict[str, Any] = {
"action": "set_property",
"target": target,
"componentType": "AudioSource",
"property": "volume",
"value": level,
}

if search_method:
params["searchMethod"] = search_method

try:
result = run_command("manage_components", params, config)
click.echo(format_output(result, config.format))
Expand Down
Loading