Skip to content

fix(antigravity): use global config directory for mcp_config.json#918

Open
moferrin wants to merge 2 commits into
Gentleman-Programming:mainfrom
moferrin:fix/antigravity-mcp-config-path
Open

fix(antigravity): use global config directory for mcp_config.json#918
moferrin wants to merge 2 commits into
Gentleman-Programming:mainfrom
moferrin:fix/antigravity-mcp-config-path

Conversation

@moferrin

@moferrin moferrin commented Jun 17, 2026

Copy link
Copy Markdown

🔗 Linked Issue

Closes #917

🏷️ PR Type

  • type:bug — Bug fix (non-breaking change that fixes an issue)
  • type:feature — New feature (non-breaking change that adds functionality)
  • type:docs — Documentation only
  • type:refactor — Code refactoring (no functional changes)
  • type:chore — Build, CI, or tooling changes
  • type:breaking-change — Breaking change

📝 Summary

Updates the Antigravity MCPConfigPath to point to the global config directory (~/.gemini/config/mcp_config.json) instead of the variant-specific path (~/.gemini/antigravity-cli/mcp_config.json).

Problem Context:
Antigravity enforces a configuration hierarchy where the global configuration file (~/.gemini/config/mcp_config.json) takes absolute priority. This global config file is automatically created by Antigravity when it is installed.

Because this global file exists (even if it is empty), Antigravity reads it, assumes its state, and completely ignores the CLI-specific file (~/.gemini/antigravity-cli/mcp_config.json) that Gentle AI just finished configuring.

As a result, Engram MCP tools are never injected into the session (tools like mem_save, mem_context, etc., do not appear as callable actions in the agent's toolset), forcing users to investigate why the MCP is unavailable even though the Engram CLI works perfectly.

By making this change and writing the configuration directly to the shared global directory, we ensure that:

  1. MCP servers are injected correctly for all users right out of the box.
  2. Engram becomes available across the entire ecosystem, including the CLI, Antigravity Desktop, and the IDE extension.

📂 Changes

File / Area What Changed
internal/agents/antigravity/adapter.go Modified MCPConfigPath
internal/agents/antigravity/adapter_test.go Updated tests to expect the global config path
internal/components/engram/inject_test.go Updated MCP injection expectations to the global path
internal/components/golden_test.go Updated MCP config location checks

🧪 Test Plan

Unit Tests

go test ./...

E2E Tests (Docker required)

cd e2e && ./docker-test.sh
  • Unit tests pass (go test ./...)
  • E2E tests pass (cd e2e && ./docker-test.sh)
  • Manually tested locally

✅ Contributor Checklist

  • PR is linked to an issue with status:approved
  • PR stays within 400 changed lines, or I have requested/obtained maintainer-applied size:exception with rationale documented
  • I have added the appropriate type:* label to this PR
  • Unit tests pass (go test ./...)
  • E2E tests pass (cd e2e && ./docker-test.sh)
  • I have updated documentation if necessary
  • My commits follow Conventional Commits format
  • My commits do not include Co-Authored-By trailers

Copilot AI review requested due to automatic review settings June 17, 2026 14:35
@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Adapter.MCPConfigPath is updated to return ~/.gemini/config/mcp_config.json (a shared global location) instead of the variant-specific antigravity-cli or antigravity-desktop subdirectory path. Four test files are updated to assert the new path.

Changes

Antigravity MCP Config Global Path

Layer / File(s) Summary
MCPConfigPath implementation and all test assertions
internal/agents/antigravity/adapter.go, internal/agents/antigravity/adapter_test.go, internal/components/engram/inject_test.go, internal/components/golden_test.go
MCPConfigPath builds the path from homeDir/.gemini/config/mcp_config.json; adapter unit tests for CLI and Desktop variants update wantMCP to the shared path; the Engram injection test is renamed to TestInjectAntigravityWritesMCPToGlobalConfig and reads from the new location; the golden test switches its MCP config input path from antigravity-cli/ to config/.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related issues

  • #917 fix(antigravity): Antigravity MCP config should use global directory — This PR directly implements the fix: Antigravity reads mcp_config.json from ~/.gemini/config/ so Gentle-AI now injects the config there instead of in the CLI variant subdirectory.
  • #779 — The path stabilization described in this issue is partially addressed by consolidating the MCP config path to a single shared location across all Antigravity variants.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: updating the Antigravity MCP configuration path to use the global config directory instead of variant-specific paths.
Linked Issues check ✅ Passed The code changes directly address issue #917 by updating MCPConfigPath references across four files to use the global config directory (~/.gemini/config/mcp_config.json) instead of variant-specific paths.
Out of Scope Changes check ✅ Passed All changes are scoped to fixing the MCP configuration path for Antigravity; no unrelated modifications or out-of-scope changes were introduced.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates Antigravity MCP config handling to use a single shared global config file location, and aligns tests/golden assertions with the new path.

Changes:

  • Switch Antigravity MCPConfigPath from variant-specific directories to ~/.gemini/config/mcp_config.json.
  • Update golden test and injection tests to read/verify MCP config in the new global location.
  • Adjust adapter path tests to expect the shared MCP config path for both CLI-only and Desktop-only setups.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
internal/components/golden_test.go Updates golden test to read MCP config from the new shared global config directory.
internal/components/engram/inject_test.go Renames test and updates expected MCP config output path to the shared global location.
internal/agents/antigravity/adapter_test.go Updates adapter path tests to expect the global MCP config path.
internal/agents/antigravity/adapter.go Changes MCPConfigPath implementation to always point at the shared global config file.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 571 to 574
cliMCPPath := filepath.Join(home, ".gemini", "config", "mcp_config.json")
content, err := os.ReadFile(cliMCPPath)
if err != nil {
t.Fatalf("ReadFile(%q) error = %v", cliMCPPath, err)
Comment on lines +899 to +900
// MCP config written to ~/.gemini/config/mcp_config.json.
mcpJSON := readTestFile(t, filepath.Join(home, ".gemini", "config", "mcp_config.json"))
Comment on lines +108 to +109
// Antigravity uses a shared global config for MCP across CLI, Desktop, and IDE.
return filepath.Join(homeDir, ".gemini", "config", "mcp_config.json")

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/components/engram/inject_test.go`:
- Line 571: The variable name cliMCPPath is misleading since the MCP config is
now stored in a global/shared location rather than a CLI-specific directory.
Rename the cliMCPPath variable to globalMCPPath (or mcpConfigPath) to accurately
reflect its purpose, and update all references to this variable throughout the
test file to maintain consistency.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: b39ab65d-ac1d-4de8-ae2c-2ed325d12f61

📥 Commits

Reviewing files that changed from the base of the PR and between c9e2ad6 and 6364fbf.

📒 Files selected for processing (4)
  • internal/agents/antigravity/adapter.go
  • internal/agents/antigravity/adapter_test.go
  • internal/components/engram/inject_test.go
  • internal/components/golden_test.go

Comment thread internal/components/engram/inject_test.go Outdated
@moferrin

Copy link
Copy Markdown
Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(antigravity): Antigravity MCP config should use global directory

2 participants