Skip to content

Commit 2479c61

Browse files
authored
Merge pull request #1151 from Scriptwonder/fix/antigravity-config-path-migrated
fix(clients): point Antigravity at ~/.gemini/config/ after the 2.x migration
2 parents da5de7a + 4036c3d commit 2479c61

6 files changed

Lines changed: 102 additions & 12 deletions

File tree

MCPForUnity/Editor/Clients/Configurators/AntigravityConfigurator.cs

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using System.IO;
4+
using System.Runtime.InteropServices;
45
using MCPForUnity.Editor.Constants;
56
using MCPForUnity.Editor.Models;
67
using UnityEditor;
@@ -9,21 +10,47 @@ namespace MCPForUnity.Editor.Clients.Configurators
910
{
1011
public class AntigravityConfigurator : JsonFileMcpConfigurator
1112
{
13+
// Antigravity 2.x migrated its MCP config from ~/.gemini/antigravity/mcp_config.json
14+
// (where Antigravity also stores its own runtime state — conversations, scratch, etc.)
15+
// to a dedicated ~/.gemini/config/mcp_config.json. The migration drops a `.migrated`
16+
// marker in the new location and renames the previous folder to `antigravity-backup`.
17+
// The old path is no longer read by Antigravity at all, so writing there silently
18+
// fails to register UnityMCP on every modern install.
1219
public AntigravityConfigurator() : base(new McpClient
1320
{
14-
name = "Antigravity",
15-
windowsConfigPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".gemini", "antigravity", "mcp_config.json"),
16-
macConfigPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".gemini", "antigravity", "mcp_config.json"),
17-
linuxConfigPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".gemini", "antigravity", "mcp_config.json"),
21+
name = "Antigravity 2.0",
22+
windowsConfigPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".gemini", "config", "mcp_config.json"),
23+
macConfigPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".gemini", "config", "mcp_config.json"),
24+
linuxConfigPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".gemini", "config", "mcp_config.json"),
1825
HttpUrlProperty = "serverUrl",
1926
DefaultUnityFields = { { "disabled", false } },
2027
StripEnvWhenNotRequired = true
2128
})
2229
{ }
2330

31+
// Detect Antigravity itself, not just its config dir. ~/.gemini/config/ is created on
32+
// first launch of Antigravity 2.x, so the inherited ParentDirectoryExists check
33+
// false-negatives on a fresh install where the user hasn't opened Antigravity yet.
34+
// ~/.antigravity/ is created by the installer (VS-Code-style support dir) and the
35+
// macOS app bundle is dropped by the installer; either is conclusive evidence that
36+
// Antigravity is installed, regardless of whether it has been launched.
37+
public override bool IsInstalled
38+
{
39+
get
40+
{
41+
string home = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
42+
if (Directory.Exists(Path.Combine(home, ".antigravity"))) return true;
43+
if (Directory.Exists(Path.Combine(home, ".gemini", "config"))) return true;
44+
if (Directory.Exists(Path.Combine(home, ".gemini", "antigravity"))) return true;
45+
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
46+
return Directory.Exists("/Applications/Antigravity.app");
47+
return false;
48+
}
49+
}
50+
2451
public override IList<string> GetInstallationSteps() => new List<string>
2552
{
26-
"Open Antigravity",
53+
"Open Antigravity 2.0",
2754
"Click the more_horiz menu in the Agent pane > MCP Servers",
2855
"Select 'Install' for Unity MCP or use the Configure button above",
2956
"Restart Antigravity if necessary"
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using MCPForUnity.Editor.Constants;
5+
using MCPForUnity.Editor.Models;
6+
using UnityEditor;
7+
8+
namespace MCPForUnity.Editor.Clients.Configurators
9+
{
10+
/// <summary>
11+
/// Antigravity IDE — the separate IDE build that ships its own ~/.gemini/antigravity-ide/
12+
/// runtime dir and reads its MCP config from that same folder. It did NOT migrate to
13+
/// ~/.gemini/config/ the way Antigravity 2.0 did, so it still uses the legacy in-folder
14+
/// mcp_config.json layout. The two apps coexist on the same machine, so we expose them
15+
/// as separate clients rather than trying to autodetect which one to write to.
16+
/// </summary>
17+
public class AntigravityIdeConfigurator : JsonFileMcpConfigurator
18+
{
19+
public AntigravityIdeConfigurator() : base(new McpClient
20+
{
21+
name = "Antigravity IDE",
22+
windowsConfigPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".gemini", "antigravity-ide", "mcp_config.json"),
23+
macConfigPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".gemini", "antigravity-ide", "mcp_config.json"),
24+
linuxConfigPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".gemini", "antigravity-ide", "mcp_config.json"),
25+
HttpUrlProperty = "serverUrl",
26+
DefaultUnityFields = { { "disabled", false } },
27+
StripEnvWhenNotRequired = true
28+
})
29+
{ }
30+
31+
// ~/.gemini/antigravity-ide/ is created by the IDE on first launch and holds both
32+
// its runtime state (annotations/, brain/, conversations/, ...) and its mcp_config.json
33+
// — presence of the dir is the canonical "Antigravity IDE has been installed and
34+
// launched at least once" signal.
35+
public override bool IsInstalled
36+
{
37+
get
38+
{
39+
string home = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
40+
return Directory.Exists(Path.Combine(home, ".gemini", "antigravity-ide"));
41+
}
42+
}
43+
44+
public override IList<string> GetInstallationSteps() => new List<string>
45+
{
46+
"Open Antigravity IDE",
47+
"Click the more_horiz menu in the Agent pane > MCP Servers",
48+
"Select 'Install' for Unity MCP or use the Configure button above",
49+
"Restart Antigravity IDE if necessary"
50+
};
51+
}
52+
}

MCPForUnity/Editor/Clients/Configurators/AntigravityIdeConfigurator.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ openupm add com.coplaydev.unity-mcp
8787
- In the **Clients** tab, click **Configure All Detected Clients** to set up every client found on your machine in one shot, or pick a single client from the dropdown and click **Configure**.
8888
- Look for 🟢 "Connected ✓".
8989

90-
**Per-client gotchas:** Some clients (Cursor, Antigravity, OpenClaw) still require enabling an MCP toggle or plugin in their own settings. OpenClaw also needs the `openclaw-mcp-bridge` plugin enabled and follows the currently selected MCP for Unity transport (`HTTP` or `stdio`). Claude Desktop only supports stdio — MCP for Unity will silently configure it that way even if you've selected HTTP elsewhere. Claude Code, VS Code, Windsurf, Cline, and the various CLI clients auto-connect after configuration.
90+
**Per-client gotchas:** Some clients (Cursor, Antigravity 2.0, Antigravity IDE, OpenClaw) still require enabling an MCP toggle or plugin in their own settings. The two Antigravity clients are listed separately because Antigravity 2.0 migrated its MCP config into `~/.gemini/config/` while Antigravity IDE still uses `~/.gemini/antigravity-ide/`; if you run both, configure each one. OpenClaw also needs the `openclaw-mcp-bridge` plugin enabled and follows the currently selected MCP for Unity transport (`HTTP` or `stdio`). Claude Desktop only supports stdio — MCP for Unity will silently configure it that way even if you've selected HTTP elsewhere. Claude Code, VS Code, Windsurf, Cline, and the various CLI clients auto-connect after configuration.
9191

9292
**Updates handle themselves.** When you update the package, MCP for Unity rewrites the configs of every detected client on the next Editor open — no need to repeat the Configure step.
9393

@@ -118,7 +118,7 @@ openupm add com.coplaydev.unity-mcp
118118

119119
If auto-setup doesn't work, add this to your MCP client's config file:
120120

121-
**HTTP (default — works with Cursor, Windsurf, Antigravity, VS Code, Cline; Claude Desktop is stdio-only, see below):**
121+
**HTTP (default — works with Cursor, Windsurf, Antigravity 2.0, Antigravity IDE, VS Code, Cline; Claude Desktop is stdio-only, see below):**
122122
```json
123123
{
124124
"mcpServers": {

docs/guides/MCP_CLIENT_CONFIGURATORS.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This guide explains how MCP client configurators work in this repo and how to ad
44

55
It covers:
66

7-
- **Typical JSON-file clients** (Cursor, VSCode GitHub Copilot, VSCode Insiders, GitHub Copilot CLI, Windsurf, Kiro, Trae, Antigravity, etc.).
7+
- **Typical JSON-file clients** (Cursor, VSCode GitHub Copilot, VSCode Insiders, GitHub Copilot CLI, Windsurf, Kiro, Trae, Antigravity 2.0, Antigravity IDE, etc.).
88
- **Special clients** like **Claude CLI**, **Codex**, and **OpenClaw** that require custom logic.
99
- **How to add a new configurator class** so it shows up automatically in the MCP for Unity window.
1010

@@ -93,7 +93,7 @@ Most MCP clients use a JSON config file that defines one or more MCP servers. Ex
9393
- **VSCode Insiders GitHub Copilot**`JsonFileMcpConfigurator` with `IsVsCodeLayout = true` and Insider-specific `Code - Insiders/User/mcp.json` paths.
9494
- **GitHub Copilot CLI**`JsonFileMcpConfigurator` with standard HTTP transport.
9595
- **Windsurf**`JsonFileMcpConfigurator` with Windsurf-specific flags (`HttpUrlProperty = "serverUrl"`, `DefaultUnityFields["disabled"] = false`, etc.).
96-
- **Kiro**, **Trae**, **Antigravity (Gemini)** – JSON configs with project-specific paths and flags.
96+
- **Kiro**, **Trae**, **Antigravity 2.0** (`~/.gemini/config/mcp_config.json` after the 2.x migration), **Antigravity IDE** (separate `~/.gemini/antigravity-ide/mcp_config.json` — the IDE build did not migrate) – JSON configs with project-specific paths and flags.
9797

9898
All of these follow the same pattern:
9999

@@ -118,7 +118,7 @@ All of these follow the same pattern:
118118
- `command` + `args` (stdio with `uvx`).
119119
- **URL property name**
120120
- `HttpUrlProperty` (default `"url"`) selects which JSON property to use for HTTP urls.
121-
- Example: Windsurf and Antigravity use `"serverUrl"`.
121+
- Example: Windsurf and the two Antigravity clients use `"serverUrl"`.
122122
- **VS Code layout**
123123
- `IsVsCodeLayout = true` switches config structure to a VS Code compatible layout.
124124
- **Env object and default fields**
@@ -228,7 +228,7 @@ Override `GetInstallationSteps` to tell users how to configure the client:
228228
- Which menu path opens the MCP settings.
229229
- Whether they should rely on the **Configure** button or copy-paste the manual JSON.
230230

231-
Look at `CursorConfigurator`, `VSCodeConfigurator`, `VSCodeInsidersConfigurator`, `KiroConfigurator`, `TraeConfigurator`, or `AntigravityConfigurator` for phrasing.
231+
Look at `CursorConfigurator`, `VSCodeConfigurator`, `VSCodeInsidersConfigurator`, `KiroConfigurator`, `TraeConfigurator`, `AntigravityConfigurator`, or `AntigravityIdeConfigurator` for phrasing.
232232

233233
### 4. Rely on the base JSON logic
234234

docs/i18n/README-zh.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ openupm add com.coplaydev.unity-mcp
8181
2. 点击 **Start Server**(会在 `localhost:8080` 启动 HTTP 服务器)
8282
3. 从下拉菜单选择你的 MCP Client,然后点击 **Configure**
8383
4. 查找 🟢 "Connected ✓"
84-
5. **连接你的客户端:** 一些客户端(Cursor、AntigravityOpenClaw)需要在设置里启用 MCP 开关或插件。OpenClaw 还需要启用 `openclaw-mcp-bridge` 插件,并会跟随 MCP for Unity 当前选择的传输方式(HTTP 或 stdio);另一些(Claude Desktop、Claude Code)在配置后会自动连接。
84+
5. **连接你的客户端:** 一些客户端(Cursor、Antigravity 2.0、Antigravity IDE、OpenClaw)需要在设置里启用 MCP 开关或插件。Antigravity 2.0 与 Antigravity IDE 是分开列出的:Antigravity 2.0 已迁移到 `~/.gemini/config/`,而 Antigravity IDE 仍使用 `~/.gemini/antigravity-ide/`;如果两者都在使用,请分别配置。OpenClaw 还需要启用 `openclaw-mcp-bridge` 插件,并会跟随 MCP for Unity 当前选择的传输方式(HTTP 或 stdio);另一些(Claude Desktop、Claude Code)在配置后会自动连接。
8585

8686
**就这些!** 试试这样的提示词:*"Create a red, blue and yellow cube"**"Build a simple player controller"*
8787

0 commit comments

Comments
 (0)