Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public override void Configure()

public override string GetManualSnippet()
{
bool useHttp = EditorConfigurationCache.Instance.UseHttpTransport;
bool useHttp = UseHttpTransport;

if (useHttp)
{
Expand Down
24 changes: 12 additions & 12 deletions MCPForUnity/Editor/Clients/Configurators/OpenClawConfigurator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public override void Configure()

McpConfigurationHelper.WriteAtomicFile(path, root.ToString(Formatting.Indented));
client.SetStatus(McpStatus.Configured);
client.configuredTransport = HttpEndpointUtility.GetCurrentServerTransport();
client.configuredTransport = CurrentTransport;
}

public override string GetManualSnippet()
Expand Down Expand Up @@ -269,23 +269,23 @@ private static JObject NormalizeServers(JToken serversToken)
return normalized;
}

private static JObject BuildUnityServerEntry()
private JObject BuildUnityServerEntry()
{
ConfiguredTransport transport = HttpEndpointUtility.GetCurrentServerTransport();
ConfiguredTransport transport = CurrentTransport;
if (transport == ConfiguredTransport.Stdio)
{
var (uvxPath, _, packageName) = AssetPathUtility.GetUvxCommandParts();
var (uvxPath, _, packageName) = UvxCommandParts;
if (string.IsNullOrWhiteSpace(uvxPath))
{
throw new InvalidOperationException("uvx not found. Install uv/uvx or set the override in Advanced Settings.");
}

var args = new JArray();
foreach (string value in AssetPathUtility.GetUvxDevFlagsList())
foreach (string value in UvxDevFlagList)
{
args.Add(value);
}
foreach (string value in AssetPathUtility.GetBetaServerFromArgsList())
foreach (string value in UvxFromArgs)
{
args.Add(value);
}
Expand All @@ -309,7 +309,7 @@ private static JObject BuildUnityServerEntry()
return new JObject
{
["enabled"] = true,
["url"] = HttpEndpointUtility.GetMcpRpcUrl(),
["url"] = RpcUrl,
["transport"] = HttpTransportName,
["toolPrefix"] = ServerName,
["requestTimeoutMs"] = 30000
Expand All @@ -323,7 +323,7 @@ private bool ServerMatchesCurrentEndpoint(JObject server)
return false;
}

ConfiguredTransport expectedTransport = HttpEndpointUtility.GetCurrentServerTransport();
ConfiguredTransport expectedTransport = CurrentTransport;
ConfiguredTransport configuredTransport = ResolveTransport(server);
if (configuredTransport != expectedTransport)
{
Expand Down Expand Up @@ -353,8 +353,8 @@ private bool ServerMatchesCurrentEndpoint(JObject server)
{
string configuredUrl = server["url"]?.ToString();
if (string.IsNullOrWhiteSpace(configuredUrl) ||
(!UrlsEqual(configuredUrl, HttpEndpointUtility.GetLocalMcpRpcUrl()) &&
!UrlsEqual(configuredUrl, HttpEndpointUtility.GetRemoteMcpRpcUrl())))
(!UrlsEqual(configuredUrl, LocalRpcUrl) &&
!UrlsEqual(configuredUrl, RemoteRpcUrl)))
{
return false;
}
Expand Down Expand Up @@ -382,12 +382,12 @@ private ConfiguredTransport ResolveTransport(JObject server)
return ConfiguredTransport.Stdio;
}

if (UrlsEqual(configuredUrl, HttpEndpointUtility.GetRemoteMcpRpcUrl()))
if (UrlsEqual(configuredUrl, RemoteRpcUrl))
{
return ConfiguredTransport.HttpRemote;
}

if (UrlsEqual(configuredUrl, HttpEndpointUtility.GetLocalMcpRpcUrl()))
if (UrlsEqual(configuredUrl, LocalRpcUrl))
{
return ConfiguredTransport.Http;
}
Expand Down
16 changes: 8 additions & 8 deletions MCPForUnity/Editor/Clients/Configurators/OpenCodeConfigurator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,22 +167,22 @@ public override string GetManualSnippet()
"The Unity MCP server should be detected automatically"
};

private static JObject BuildServerEntry()
private JObject BuildServerEntry()
{
if (HttpEndpointUtility.GetCurrentServerTransport() == ConfiguredTransport.Stdio)
if (CurrentTransport == ConfiguredTransport.Stdio)
{
var (uvxPath, _, packageName) = AssetPathUtility.GetUvxCommandParts();
var (uvxPath, _, packageName) = UvxCommandParts;
if (string.IsNullOrWhiteSpace(uvxPath))
{
throw new InvalidOperationException("uvx not found. Install uv/uvx or set the override in Advanced Settings.");
}

var command = new JArray { uvxPath };
foreach (string value in AssetPathUtility.GetUvxDevFlagsList())
foreach (string value in UvxDevFlagList)
{
command.Add(value);
}
foreach (string value in AssetPathUtility.GetBetaServerFromArgsList())
foreach (string value in UvxFromArgs)
{
command.Add(value);
}
Expand All @@ -201,15 +201,15 @@ private static JObject BuildServerEntry()
return new JObject
{
["type"] = RemoteType,
["url"] = HttpEndpointUtility.GetMcpRpcUrl(),
["url"] = RpcUrl,
["enabled"] = true
};
}

private bool EntryMatchesCurrentTransport(JObject entry)
{
string entryType = entry["type"]?.ToString();
ConfiguredTransport expected = HttpEndpointUtility.GetCurrentServerTransport();
ConfiguredTransport expected = CurrentTransport;

if (expected == ConfiguredTransport.Stdio)
{
Expand All @@ -218,7 +218,7 @@ private bool EntryMatchesCurrentTransport(JObject entry)
}

return string.Equals(entryType, RemoteType, StringComparison.OrdinalIgnoreCase)
&& UrlsEqual(entry["url"]?.ToString(), HttpEndpointUtility.GetMcpRpcUrl());
&& UrlsEqual(entry["url"]?.ToString(), RpcUrl);
}
}
}
Loading