feat(antigravity): support mcp_config.json generation under .agents/#2049
Open
okamiconcept wants to merge 1 commit into
Open
feat(antigravity): support mcp_config.json generation under .agents/#2049okamiconcept wants to merge 1 commit into
okamiconcept wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR completes MCP configuration support for the antigravity target by (1) ensuring the runtime is properly discovered/gated at install time and (2) emitting Antigravity-compatible remote server configuration using serverUrl, with tests covering both behaviors.
Changes:
- Add
antigravityruntime discovery signals (project scope via.agents/, user scope viaagyon PATH) to MCP install gating. - Override Antigravity MCP remote formatting to emit
serverUrl(instead ofurl/httpUrl). - Add unit + integration coverage for Antigravity MCP config writing and gating, and record the feature in the changelog.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/apm_cli/integration/mcp_integrator_install.py |
Adds antigravity to runtime discovery and implements scope-aware presence detection (.agents/ vs agy). |
src/apm_cli/integration/targets.py |
Maps antigravity runtime name to canonical target name. |
src/apm_cli/adapters/client/antigravity.py |
Overrides server config formatting to rename remote URL keys to serverUrl per Antigravity schema. |
tests/unit/integration/test_antigravity_target.py |
Adds unit tests for serverUrl formatting and Antigravity runtime presence detection. |
tests/integration/test_mcp_targets_gating_e2e.py |
Adds E2E test asserting .agents/mcp_config.json is written for targets: [antigravity] and remote formatting uses serverUrl. |
CHANGELOG.md |
Adds an Unreleased entry for the new Antigravity MCP config generation feature. |
c8213dd to
7629789
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat(antigravity): support mcp_config.json generation under .agents/
TL;DR
apm installnow correctly supports generating and updating workspace-local.agents/mcp_config.json(project scope) and~/.gemini/config/mcp_config.json(user scope) configurations for theantigravitytarget. Remote connections are automatically formatted using theserverUrlfield as required by the Google Antigravity connection schema.Note
This completes the integration of the Antigravity target's configuration surface, complementing the rule and skill features added in PR #1984.
Problem (WHY)
mcp_integrator_install.pydid not recognizeantigravityin the installed runtimes lookup list, silently skipping MCP configuration even whenantigravitywas explicitly whitelisted inapm.ymlor via the--targetCLI flag.urlorhttpUrlfor remote servers, which Google Antigravity rejects in favor ofserverUrlper the official Antigravity MCP Connection Schema.Why these matter:
Grounding configurations in target-native schemas is essential for compatibility. As defined in target-detection guidelines:
Without proper gating and formatting support, the MCP servers are completely dropped for this target, violating the multi-harness portability contract.
Approach (WHAT)
Additive changes to the integration and client adapter layers to support runtime detection and correct formatting for the Antigravity target.
antigravityruntime discovery at both project scope (folder check) and user scope (binary check).antigravityto itself inRUNTIME_TO_CANONICAL_TARGETmapping.AntigravityClientAdapterto outputserverUrlinstead ofurl/httpUrl.Implementation (HOW)
src/apm_cli/adapters/client/antigravity.py-- Overrode_format_server_configto convert remote server URL configuration keys (urlorhttpUrl) to"serverUrl".src/apm_cli/integration/mcp_integrator_install.py-- Added"antigravity"to the runtime discovery check. Updated_runtime_is_presentand fallback logic to check for the.agents/project folder (project scope) or theagybinary on PATH (user scope).src/apm_cli/integration/targets.py-- Mapped"antigravity": "antigravity"inRUNTIME_TO_CANONICAL_TARGET.CHANGELOG.md-- Documented the new feature under theUnreleasedsection.tests/integration/test_mcp_targets_gating_e2e.py-- Added E2E/integration tests verifying that targetingantigravitycompiles a validmcp_config.jsoncontaining stdio and remote configs.tests/unit/integration/test_antigravity_target.py-- Added unit tests covering the scope-aware presence checks and correct conversion of remote connection schemas.Diagrams
Legend: This diagram shows the pipeline of target detection and gating mapping to formatting and final output writing.
flowchart LR subgraph Detect["Target Detection & Gating"] T1["--target antigravity"] --> V1["resolve_targets()"] V1 --> V2["Gate runtimes in _discover_installed_runtimes()"] end subgraph Formatting["Config Formatting"] V2 --> F1["AntigravityClientAdapter"] F1 --> F2["_format_server_config()"]:::new F2 -->|"serverUrl"| F3["update_config()"] end subgraph Output["Output config"] F3 --> O1[".agents/mcp_config.json"] end classDef new stroke-dasharray: 5 5; class F2 new;Trade-offs
.agents/directory presence check at project scope, meaning APM won't generatemcp_config.jsonin a project that has not initialized.agents/yet. This aligns with existing target signals conventions.GeminiClientAdapterallows reusing command/args formatting logic while surgically mapping remote endpoints keys.Benefits
apm.ymlfor Google Antigravity CLI and IDE.Validation
All tests were successfully run and verified locally.
Full pytest output (25 tests)
Scenario Evidence
apm installwrites the dedicated MCP configuration file to.agents/mcp_config.jsoninside project root whenantigravityis active.tests/integration/test_mcp_targets_gating_e2e.py::TestMCPTargetsGatingE2E::test_targets_whitelist_antigravity_allows_listed_runtimesapm install --global(user scope) writes MCP config to~/.gemini/config/mcp_config.jsonwhenantigravityis active.tests/unit/integration/test_antigravity_target.py::test_antigravity_mcp_user_path_is_gemini_config_mcp_configserverUrlfield instead ofurlorhttpUrlin.agents/mcp_config.json.tests/unit/integration/test_antigravity_target.py::test_antigravity_mcp_remote_server_uses_server_url.agents/exists, and at user scope when theagybinary is on PATH.tests/unit/integration/test_antigravity_target.py::test_antigravity_mcp_runtime_is_detected_when_agents_dir_existstests/unit/integration/test_antigravity_target.py::test_antigravity_mcp_runtime_is_detected_at_user_scope_when_agy_binary_existsHow to test
.agents/folder and dependencies declaration:apm installand verify.agents/mcp_config.jsonis generated correctly.serverUrlis used undertest-remoteconfigurations in the generated file.Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com