-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix: Rider + Github Copilot use MCP cannot works #599 #601
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 28 commits
204e95a
25e5d05
cc22320
8d5fa2f
84cee8c
510e631
bf41479
f39857c
c4be11c
1832715
554ddd0
fb5909d
254125a
f9ae5d5
84cb9c6
ee33077
2c3ebcd
66fe194
79bce47
1877cc2
f9b0563
c86eb78
a05d1c7
396f248
a0c07ec
4916b12
a3c2f30
2d3dd3e
293db3b
e0bfd96
9e83f83
88deaf0
cde5795
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,9 +10,10 @@ 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"), | ||
| // Rider GitHub Copilot uses github-copilot/intellij path under LocalApplicationData | ||
| windowsConfigPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "github-copilot", "intellij", "mcp.json"), | ||
| macConfigPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "github-copilot", "intellij", "mcp.json"), | ||
| linuxConfigPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "github-copilot", "intellij", "mcp.json"), | ||
| IsVsCodeLayout = true | ||
| }) | ||
| { } | ||
|
Comment on lines
10
to
19
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query:
💡 Result: Put the mcp.json in Rider’s IDE configuration directory. Default locations:
Rider also exposes the same mcp.json via the Copilot/MCP UI (Open Chat → Agent mode → Configure/Add MCP Tools) which opens the client JSON in the editor. [3] Sources: JetBrains directories & Rider MCP docs, GitHub Copilot MCP docs. [1] [2] [3] 🏁 Script executed: # Search for any documentation or comments about Rider configuration paths in the repository
rg -i "rider|intellij" --type md --type cs | head -30Repository: CoplayDev/unity-mcp Length of output: 1451 🏁 Script executed: # Search for any existing Rider or JetBrains related paths in the codebase
rg "Rider|JetBrains" -i --type csRepository: CoplayDev/unity-mcp Length of output: 782 🏁 Script executed: # Check if there's any documentation or comments about the old ApplicationData path
rg "ApplicationData" -i --type cs -B2 -A2 | head -50Repository: CoplayDev/unity-mcp Length of output: 5704 🏁 Script executed: # Check the retrieved learnings and ServerInstaller reference to understand path conventions
rg "ServerInstaller|AppSupport" --type csRepository: CoplayDev/unity-mcp Length of output: 45 Correct the Rider MCP configuration paths to match JetBrains standards. The configuration paths must use the JetBrains IDE config directories, not the
🤖 Prompt for AI Agents
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The configuration requires the github copilot's mcp server settings, not the rider's mcp server
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query: 💡 Result: Place depends on scope:
You can also open/edit the mcp.json from the Copilot/Agent UI in JetBrains (Configure MCP/Add MCP Tools) which launches the same file editor. [2] Sources: [1] JetBrains Junie MCP docs; [2] GitHub Copilot MCP docs. 🌐 Web query: 💡 Result: On Windows:
Sources:
GitHub Copilot, as a plugin within JetBrains IDEs like Rider, maintains its own configuration separate from the IDE's native settings. The The paths in your PR correctly target GitHub Copilot's plugin configuration, not Rider's native MCP server settings. This distinction is important, and your implementation is correct. ✏️ Learnings added
🧠 Learnings used |
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -540,9 +540,8 @@ private void RegisterWithCapturedValues( | |||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||
| // Note: --reinstall is not supported by uvx, use --no-cache --refresh instead | ||||||||||||||||||||||||||||||||
| string devFlags = shouldForceRefresh ? "--no-cache --refresh " : string.Empty; | ||||||||||||||||||||||||||||||||
| args = $"mcp add --transport stdio UnityMCP -- \"{uvxPath}\" {devFlags}--from \"{gitUrl}\" {packageName}"; | ||||||||||||||||||||||||||||||||
| string packageArgs = BuildClaudeUvxArgs(uvxPath, gitUrl, packageName, shouldForceRefresh); | ||||||||||||||||||||||||||||||||
| args = $"mcp add --transport stdio UnityMCP -- {packageArgs}"; | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| // Remove any existing registrations - handle both "UnityMCP" and "unityMCP" (legacy) | ||||||||||||||||||||||||||||||||
|
|
@@ -599,10 +598,9 @@ private void Register() | |||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||
| var (uvxPath, gitUrl, packageName) = AssetPathUtility.GetUvxCommandParts(); | ||||||||||||||||||||||||||||||||
| // Use central helper that checks both DevModeForceServerRefresh AND local path detection. | ||||||||||||||||||||||||||||||||
| // Note: --reinstall is not supported by uvx, use --no-cache --refresh instead | ||||||||||||||||||||||||||||||||
| string devFlags = AssetPathUtility.ShouldForceUvxRefresh() ? "--no-cache --refresh " : string.Empty; | ||||||||||||||||||||||||||||||||
| args = $"mcp add --transport stdio UnityMCP -- \"{uvxPath}\" {devFlags}--from \"{gitUrl}\" {packageName}"; | ||||||||||||||||||||||||||||||||
| bool shouldForceRefresh = AssetPathUtility.ShouldForceUvxRefresh(); | ||||||||||||||||||||||||||||||||
| string packageArgs = BuildClaudeUvxArgs(uvxPath, gitUrl, packageName, shouldForceRefresh); | ||||||||||||||||||||||||||||||||
| args = $"mcp add --transport stdio UnityMCP -- {packageArgs}"; | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| string projectDir = Path.GetDirectoryName(Application.dataPath); | ||||||||||||||||||||||||||||||||
|
|
@@ -698,13 +696,12 @@ public override string GetManualSnippet() | |||||||||||||||||||||||||||||||
| return "# Error: Configuration not available - check paths in Advanced Settings"; | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| string packageSource = AssetPathUtility.GetMcpServerPackageSource(); | ||||||||||||||||||||||||||||||||
| // Use central helper that checks both DevModeForceServerRefresh AND local path detection. | ||||||||||||||||||||||||||||||||
| // Note: --reinstall is not supported by uvx, use --no-cache --refresh instead | ||||||||||||||||||||||||||||||||
| string devFlags = AssetPathUtility.ShouldForceUvxRefresh() ? "--no-cache --refresh " : string.Empty; | ||||||||||||||||||||||||||||||||
| var (_, gitUrl, packageName) = AssetPathUtility.GetUvxCommandParts(); | ||||||||||||||||||||||||||||||||
| bool shouldForceRefresh = AssetPathUtility.ShouldForceUvxRefresh(); | ||||||||||||||||||||||||||||||||
| string packageArgs = BuildClaudeUvxArgs(uvxPath, gitUrl, packageName, shouldForceRefresh); | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| return "# Register the MCP server with Claude Code:\n" + | ||||||||||||||||||||||||||||||||
| $"claude mcp add --transport stdio UnityMCP -- \"{uvxPath}\" {devFlags}--from \"{packageSource}\" mcp-for-unity\n\n" + | ||||||||||||||||||||||||||||||||
| $"claude mcp add --transport stdio UnityMCP -- {packageArgs}\n\n" + | ||||||||||||||||||||||||||||||||
| "# Unregister the MCP server:\n" + | ||||||||||||||||||||||||||||||||
| "claude mcp remove UnityMCP\n\n" + | ||||||||||||||||||||||||||||||||
| "# List registered servers:\n" + | ||||||||||||||||||||||||||||||||
|
|
@@ -763,5 +760,33 @@ private static string ExtractPackageSourceFromCliOutput(string cliOutput) | |||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| return null; | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| /// <summary> | ||||||||||||||||||||||||||||||||
| /// Builds the correct uvx package arguments for Claude CLI mcp add command. | ||||||||||||||||||||||||||||||||
| /// IMPORTANT: We always need --from because the PyPI package name (mcpforunityserver) | ||||||||||||||||||||||||||||||||
| /// differs from the executable name (mcp-for-unity). The uvx command format is: | ||||||||||||||||||||||||||||||||
| /// uvx --from PACKAGE_SOURCE EXECUTABLE_NAME --transport stdio | ||||||||||||||||||||||||||||||||
| /// Example: uvx --from mcpforunityserver==9.0.8 mcp-for-unity --transport stdio | ||||||||||||||||||||||||||||||||
| /// </summary> | ||||||||||||||||||||||||||||||||
| private static string BuildClaudeUvxArgs(string uvxPath, string fromUrl, string packageName, bool shouldForceRefresh) | ||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||
| // Dev flags | ||||||||||||||||||||||||||||||||
| string devFlags = shouldForceRefresh ? "--no-cache --refresh " : string.Empty; | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| string packageArgs; | ||||||||||||||||||||||||||||||||
| if (!string.IsNullOrEmpty(fromUrl)) | ||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||
| // Always use --from because package name != executable name | ||||||||||||||||||||||||||||||||
| // Example: uvx --from mcpforunityserver==9.0.8 mcp-for-unity | ||||||||||||||||||||||||||||||||
| packageArgs = $"\"{uvxPath}\" {devFlags}--from \"{fromUrl}\" {packageName}"; | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||
| // Fallback: packageName only (should not happen in normal use) | ||||||||||||||||||||||||||||||||
| packageArgs = $"\"{uvxPath}\" {devFlags}{packageName}"; | ||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||
|
whatevertogo marked this conversation as resolved.
Outdated
|
||||||||||||||||||||||||||||||||
| string packageArgs; | |
| if (!string.IsNullOrEmpty(fromUrl)) | |
| { | |
| // Always use --from because package name != executable name | |
| // Example: uvx --from mcpforunityserver==9.0.8 mcp-for-unity | |
| packageArgs = $"\"{uvxPath}\" {devFlags}--from \"{fromUrl}\" {packageName}"; | |
| } | |
| else | |
| { | |
| // Fallback: packageName only (should not happen in normal use) | |
| packageArgs = $"\"{uvxPath}\" {devFlags}{packageName}"; | |
| } | |
| string packageArgs = !string.IsNullOrEmpty(fromUrl) | |
| ? $"\"{uvxPath}\" {devFlags}--from \"{fromUrl}\" {packageName}" | |
| : $"\"{uvxPath}\" {devFlags}{packageName}"; |
Uh oh!
There was an error while loading. Please reload this page.