升级XR插件版本
This commit is contained in:
21
Packages/MCPForUnity/Editor/Models/Command.cs
Normal file
21
Packages/MCPForUnity/Editor/Models/Command.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace MCPForUnity.Editor.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a command received from the MCP client
|
||||
/// </summary>
|
||||
public class Command
|
||||
{
|
||||
/// <summary>
|
||||
/// The type of command to execute
|
||||
/// </summary>
|
||||
public string type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The parameters for the command
|
||||
/// </summary>
|
||||
public JObject @params { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
11
Packages/MCPForUnity/Editor/Models/Command.cs.meta
Normal file
11
Packages/MCPForUnity/Editor/Models/Command.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6754c84e5deb74749bc3a19e0c9aa280
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
23
Packages/MCPForUnity/Editor/Models/MCPConfigServer.cs
Normal file
23
Packages/MCPForUnity/Editor/Models/MCPConfigServer.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace MCPForUnity.Editor.Models
|
||||
{
|
||||
[Serializable]
|
||||
public class McpConfigServer
|
||||
{
|
||||
[JsonProperty("command")]
|
||||
public string command;
|
||||
|
||||
[JsonProperty("args")]
|
||||
public string[] args;
|
||||
|
||||
// VSCode expects a transport type; include only when explicitly set
|
||||
[JsonProperty("type", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string type;
|
||||
|
||||
// URL for HTTP transport mode
|
||||
[JsonProperty("url", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string url;
|
||||
}
|
||||
}
|
||||
11
Packages/MCPForUnity/Editor/Models/MCPConfigServer.cs.meta
Normal file
11
Packages/MCPForUnity/Editor/Models/MCPConfigServer.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5fae9d995f514e9498e9613e2cdbeca9
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
12
Packages/MCPForUnity/Editor/Models/MCPConfigServers.cs
Normal file
12
Packages/MCPForUnity/Editor/Models/MCPConfigServers.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace MCPForUnity.Editor.Models
|
||||
{
|
||||
[Serializable]
|
||||
public class McpConfigServers
|
||||
{
|
||||
[JsonProperty("unityMCP")]
|
||||
public McpConfigServer unityMCP;
|
||||
}
|
||||
}
|
||||
11
Packages/MCPForUnity/Editor/Models/MCPConfigServers.cs.meta
Normal file
11
Packages/MCPForUnity/Editor/Models/MCPConfigServers.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bcb583553e8173b49be71a5c43bd9502
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
57
Packages/MCPForUnity/Editor/Models/McpClient.cs
Normal file
57
Packages/MCPForUnity/Editor/Models/McpClient.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MCPForUnity.Editor.Models
|
||||
{
|
||||
public class McpClient
|
||||
{
|
||||
public string name;
|
||||
public string windowsConfigPath;
|
||||
public string macConfigPath;
|
||||
public string linuxConfigPath;
|
||||
public string configStatus;
|
||||
public McpStatus status = McpStatus.NotConfigured;
|
||||
public ConfiguredTransport configuredTransport = ConfiguredTransport.Unknown;
|
||||
|
||||
// Capability flags/config for JSON-based configurators
|
||||
public bool IsVsCodeLayout; // Whether the config file follows VS Code layout (env object at root)
|
||||
public bool SupportsHttpTransport = true; // Whether the MCP server supports HTTP transport
|
||||
public bool EnsureEnvObject; // Whether to ensure the env object is present in the config
|
||||
public bool StripEnvWhenNotRequired; // Whether to strip the env object when not required
|
||||
public string HttpUrlProperty = "url"; // The property name for the HTTP URL in the config
|
||||
public Dictionary<string, object> DefaultUnityFields = new();
|
||||
|
||||
// Helper method to convert the enum to a display string
|
||||
public string GetStatusDisplayString()
|
||||
{
|
||||
return status switch
|
||||
{
|
||||
McpStatus.NotConfigured => "Not Configured",
|
||||
McpStatus.Configured => "Configured",
|
||||
McpStatus.Running => "Running",
|
||||
McpStatus.Connected => "Connected",
|
||||
McpStatus.IncorrectPath => "Incorrect Path",
|
||||
McpStatus.CommunicationError => "Communication Error",
|
||||
McpStatus.NoResponse => "No Response",
|
||||
McpStatus.UnsupportedOS => "Unsupported OS",
|
||||
McpStatus.MissingConfig => "Missing MCPForUnity Config",
|
||||
McpStatus.Error => configStatus?.StartsWith("Error:") == true ? configStatus : "Error",
|
||||
_ => "Unknown",
|
||||
};
|
||||
}
|
||||
|
||||
// Helper method to set both status enum and string for backward compatibility
|
||||
public void SetStatus(McpStatus newStatus, string errorDetails = null)
|
||||
{
|
||||
status = newStatus;
|
||||
|
||||
if (newStatus == McpStatus.Error && !string.IsNullOrEmpty(errorDetails))
|
||||
{
|
||||
configStatus = $"Error: {errorDetails}";
|
||||
}
|
||||
else
|
||||
{
|
||||
configStatus = GetStatusDisplayString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Packages/MCPForUnity/Editor/Models/McpClient.cs.meta
Normal file
11
Packages/MCPForUnity/Editor/Models/McpClient.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b1afa56984aec0d41808edcebf805e6a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
12
Packages/MCPForUnity/Editor/Models/McpConfig.cs
Normal file
12
Packages/MCPForUnity/Editor/Models/McpConfig.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace MCPForUnity.Editor.Models
|
||||
{
|
||||
[Serializable]
|
||||
public class McpConfig
|
||||
{
|
||||
[JsonProperty("mcpServers")]
|
||||
public McpConfigServers mcpServers;
|
||||
}
|
||||
}
|
||||
11
Packages/MCPForUnity/Editor/Models/McpConfig.cs.meta
Normal file
11
Packages/MCPForUnity/Editor/Models/McpConfig.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c17c09908f0c1524daa8b6957ce1f7f5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
30
Packages/MCPForUnity/Editor/Models/McpStatus.cs
Normal file
30
Packages/MCPForUnity/Editor/Models/McpStatus.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
namespace MCPForUnity.Editor.Models
|
||||
{
|
||||
// Enum representing the various status states for MCP clients
|
||||
public enum McpStatus
|
||||
{
|
||||
NotConfigured, // Not set up yet
|
||||
Configured, // Successfully configured
|
||||
Running, // Service is running
|
||||
Connected, // Successfully connected
|
||||
IncorrectPath, // Configuration has incorrect paths
|
||||
CommunicationError, // Connected but communication issues
|
||||
NoResponse, // Connected but not responding
|
||||
MissingConfig, // Config file exists but missing required elements
|
||||
UnsupportedOS, // OS is not supported
|
||||
Error, // General error state
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents the transport type a client is configured to use.
|
||||
/// Used to detect mismatches between server and client transport settings.
|
||||
/// </summary>
|
||||
public enum ConfiguredTransport
|
||||
{
|
||||
Unknown, // Could not determine transport type
|
||||
Stdio, // Client configured for stdio transport
|
||||
Http, // Client configured for HTTP local transport
|
||||
HttpRemote // Client configured for HTTP remote-hosted transport
|
||||
}
|
||||
}
|
||||
|
||||
11
Packages/MCPForUnity/Editor/Models/McpStatus.cs.meta
Normal file
11
Packages/MCPForUnity/Editor/Models/McpStatus.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aa63057c9e5282d4887352578bf49971
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user