Skip to content

Commit 3ea327e

Browse files
committed
fix(clients): write Antigravity config to ~/.gemini/config/ (post-2.x migration)
Antigravity 2.x moved its MCP config from ~/.gemini/antigravity/mcp_config.json to a dedicated ~/.gemini/config/mcp_config.json. The migration drops a `.migrated` marker in the new location and renames the prior folder to `antigravity-backup`; the old path keeps Antigravity's runtime state (conversations/, scratch/, brain/, etc.) but is no longer read for MCP. Confirmed empirically on a real machine: ~/.gemini/config/mcp_config.json shows `mcpServers: {}` (Antigravity reads from here) while our writes have been landing in the legacy ~/.gemini/antigravity/mcp_config.json that Antigravity now ignores. Community report matches this exactly: "in .gemini there are two folders, antigravity and config; antigravity is not where mcp.json is supposed to be, there is another config folder." Also override IsInstalled. The inherited ParentDirectoryExists check points at ~/.gemini/config/, which is only created on Antigravity's first launch — on a fresh machine that has the app installed but never opened, detection false-negatives and ConfigureAllDetectedClients skips Antigravity entirely. Check ~/.antigravity/ (installer-created), the new config dir, the legacy config dir, or /Applications/Antigravity.app on macOS; any one of those is conclusive.
1 parent da5de7a commit 3ea327e

1 file changed

Lines changed: 30 additions & 3 deletions

File tree

MCPForUnity/Editor/Clients/Configurators/AntigravityConfigurator.cs

Lines changed: 30 additions & 3 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,18 +10,44 @@ 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
{
1421
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"),
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
{
2653
"Open Antigravity",

0 commit comments

Comments
 (0)