Skip to content

Commit cb59b08

Browse files
committed
Add Claude Code support with register/unregister toggle
- Added Claude Code as new MCP client type - One-click registration via 'claude mcp add' command - Toggle button to unregister when already configured - Cross-platform support (Windows/macOS/Linux) - Auto-detects configuration in ~/.claude.json
1 parent a3b1319 commit cb59b08

File tree

4 files changed

+371
-47
lines changed

4 files changed

+371
-47
lines changed

UnityMcpBridge/Editor/Data/McpClients.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,20 @@ public class McpClients
6363
mcpType = McpTypes.VSCode,
6464
configStatus = "Not Configured",
6565
},
66+
new()
67+
{
68+
name = "Claude Code",
69+
windowsConfigPath = Path.Combine(
70+
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
71+
".claude.json"
72+
),
73+
linuxConfigPath = Path.Combine(
74+
Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
75+
".claude.json"
76+
),
77+
mcpType = McpTypes.ClaudeCode,
78+
configStatus = "Not Configured",
79+
},
6680
};
6781

6882
// Initialize status enums after construction

UnityMcpBridge/Editor/Models/McpTypes.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ public enum McpTypes
55
ClaudeDesktop,
66
Cursor,
77
VSCode,
8+
ClaudeCode,
89
}
910
}
1011

UnityMcpBridge/Editor/Windows/ManualConfigEditorWindow.cs

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ protected virtual void OnGUI()
3939
);
4040
GUI.Label(
4141
new Rect(titleRect.x + 10, titleRect.y + 6, titleRect.width - 20, titleRect.height),
42-
mcpClient.name + " Manual Configuration",
42+
(mcpClient?.name ?? "Unknown") + " Manual Configuration",
4343
EditorStyles.boldLabel
4444
);
4545
EditorGUILayout.Space(10);
@@ -70,17 +70,17 @@ protected virtual void OnGUI()
7070
};
7171

7272
EditorGUILayout.LabelField(
73-
"1. Open " + mcpClient.name + " config file by either:",
73+
"1. Open " + (mcpClient?.name ?? "Unknown") + " config file by either:",
7474
instructionStyle
7575
);
76-
if (mcpClient.mcpType == McpTypes.ClaudeDesktop)
76+
if (mcpClient?.mcpType == McpTypes.ClaudeDesktop)
7777
{
7878
EditorGUILayout.LabelField(
7979
" a) Going to Settings > Developer > Edit Config",
8080
instructionStyle
8181
);
8282
}
83-
else if (mcpClient.mcpType == McpTypes.Cursor)
83+
else if (mcpClient?.mcpType == McpTypes.Cursor)
8484
{
8585
EditorGUILayout.LabelField(
8686
" a) Going to File > Preferences > Cursor Settings > MCP > Add new global MCP server",
@@ -96,16 +96,23 @@ protected virtual void OnGUI()
9696
// Path section with improved styling
9797
EditorGUILayout.BeginVertical(EditorStyles.helpBox);
9898
string displayPath;
99-
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
99+
if (mcpClient != null)
100100
{
101-
displayPath = mcpClient.windowsConfigPath;
102-
}
103-
else if (
104-
RuntimeInformation.IsOSPlatform(OSPlatform.OSX)
105-
|| RuntimeInformation.IsOSPlatform(OSPlatform.Linux)
106-
)
107-
{
108-
displayPath = mcpClient.linuxConfigPath;
101+
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
102+
{
103+
displayPath = mcpClient.windowsConfigPath;
104+
}
105+
else if (
106+
RuntimeInformation.IsOSPlatform(OSPlatform.OSX)
107+
|| RuntimeInformation.IsOSPlatform(OSPlatform.Linux)
108+
)
109+
{
110+
displayPath = mcpClient.linuxConfigPath;
111+
}
112+
else
113+
{
114+
displayPath = configPath;
115+
}
109116
}
110117
else
111118
{
@@ -224,7 +231,7 @@ protected virtual void OnGUI()
224231

225232
EditorGUILayout.Space(10);
226233
EditorGUILayout.LabelField(
227-
"3. Save the file and restart " + mcpClient.name,
234+
"3. Save the file and restart " + (mcpClient?.name ?? "Unknown"),
228235
instructionStyle
229236
);
230237

0 commit comments

Comments
 (0)