Skip to content

Context7 Platform -- Up-to-date docs for AI agents

fix(cli): wire --antigravity and remove broken --universal in setup (#2700)

Fahreddin Özcan2affada9f92d
diff --git a/.changeset/cli-antigravity-setup.md b/.changeset/cli-antigravity-setup.md
new file mode 100644
index 00000000..8ca71b4b
--- /dev/null
+++ b/.changeset/cli-antigravity-setup.md
@@ -0,0 +1,5 @@
+---
+"ctx7": patch
+---
+
+`ctx7 setup` now properly supports `--antigravity`, installing skills to `.agent/skills`, a `GEMINI.md` rule section (Antigravity reads Gemini-family config), and MCP config to Antigravity 2.0's documented global path `~/.gemini/config/mcp_config.json` (with `httpUrl` for HTTP, matching the Gemini convention). Antigravity has no documented project-level MCP file, so `setup --antigravity --project --mcp` writes to the global location. Also removes the `--universal` flag from `setup`, which was advertised but silently ignored — it never propagated through agent selection, so passing it (e.g. `setup --cli --universal --project`) caused setup to fall back to auto-detection and write to the wrong directory.
diff --git a/packages/cli/src/__tests__/setup.test.ts b/packages/cli/src/__tests__/setup.test.ts
index 6b5c4bd9..dd77ea11 100644
--- a/packages/cli/src/__tests__/setup.test.ts
+++ b/packages/cli/src/__tests__/setup.test.ts
@@ -47,7 +47,7 @@ describe("getRuleContent", () => {
expect(cursor).toContain("---\nalwaysApply: true\n---");
expect(cursor).toContain(MOCK_MCP_RULE);
- for (const agent of ["claude", "codex", "opencode", "gemini"]) {
+ for (const agent of ["claude", "antigravity", "codex", "opencode", "gemini"]) {
const content = await getRuleContent("mcp", agent);
expect(content).not.toContain("alwaysApply");
}
@@ -1022,7 +1022,14 @@ describe("agent config integration", () => {
describe("all agents have consistent config", () => {
test("all agents are covered", () => {
- expect(ALL_AGENT_NAMES).toEqual(["claude", "cursor", "opencode", "codex", "gemini"]);
+ expect(ALL_AGENT_NAMES).toEqual([
+ "claude",
+ "cursor",
+ "opencode",
+ "codex",
+ "antigravity",
+ "gemini",
+ ]);
});
test.each(ALL_AGENT_NAMES)("%s buildEntry returns url for both auth modes", (name) => {
@@ -1030,7 +1037,7 @@ describe("agent config integration", () => {
const apiEntry = agent.mcp.buildEntry(apiKeyAuth, "http");
const oauthEntry = agent.mcp.buildEntry(oauthAuth, "http");
- const urlKey = name === "gemini" ? "httpUrl" : "url";
+ const urlKey = name === "gemini" ? "httpUrl" : name === "antigravity" ? "serverUrl" : "url";
expect(apiEntry[urlKey]).toBe("https://mcp.context7.com/mcp");
expect(oauthEntry[urlKey]).toBe("https://mcp.context7.com/mcp/oauth");
});
diff --git a/packages/cli/src/commands/remove.ts b/packages/cli/src/commands/remove.ts
index 190cfcb8..4d923ee1 100644
--- a/packages/cli/src/commands/remove.ts
+++ b/packages/cli/src/commands/remove.ts
@@ -24,6 +24,7 @@ interface UninstallOptions {
cursor?: boolean;
opencode?: boolean;
codex?: boolean;
+ antigravity?: boolean;
gemini?: boolean;
project?: boolean;
yes?: boolean;
@@ -75,6 +76,7 @@ export function registerRemoveCommand(program: Command): void {
.option("--cursor", "Remove from Cursor")
.option("--opencode", "Remove from OpenCode")
.option("--codex", "Remove from Codex")
+ .option("--antigravity", "Remove from Antigravity")
.option("--gemini", "Remove from Gemini CLI")
.option("--all", "Remove both MCP setup and CLI + Skills setup")
.option("--mcp", "Remove MCP setup")
@@ -92,6 +94,7 @@ function getSelectedAgents(options: UninstallOptions): SetupAgent[] {
if (options.cursor) agents.push("cursor");
if (options.opencode) agents.push("opencode");
if (options.codex) agents.push("codex");
+ if (options.antigravity) agents.push("antigravity");
if (options.gemini) agents.push("gemini");
return agents;
}
@@ -151,7 +154,7 @@ async function resolveAgents(options: UninstallOptions, scope: Scope): Promise<S
if (detected.length === 0) {
log.warn(
- "No Context7 setup detected. Pass --claude, --cursor, --opencode, --codex, or --gemini."
+ "No Context7 setup detected. Pass --claude, --cursor, --opencode, --codex, --antigravity, or --gemini."
);
return [];
}
@@ -188,6 +191,9 @@ async function pathExists(path: string): Promise<boolean> {
async function hasMcpConfig(agentName: SetupAgent, scope: Scope): Promise<boolean> {
const agent = getAgent(agentName);
+ // Agents with no project-level MCP (e.g. Antigravity) only have a global
+ // config — there's nothing to detect at project scope.
+ if (scope === "project" && agent.mcp.projectPaths.length === 0) return false;
const candidates =
scope === "global"
? agent.mcp.globalPaths
@@ -319,6 +325,9 @@ async function resolveModes(
async function uninstallMcp(agentName: SetupAgent, scope: Scope): Promise<CleanupStatus> {
const agent = getAgent(agentName);
+ if (scope === "project" && agent.mcp.projectPaths.length === 0) {
+ return { status: "not found", path: "" };
+ }
const mcpCandidates =
scope === "global"
? agent.mcp.globalPaths
diff --git a/packages/cli/src/commands/setup.ts b/packages/cli/src/commands/setup.ts
index b2037985..a2c27078 100644
--- a/packages/cli/src/commands/setup.ts
+++ b/packages/cli/src/commands/setup.ts
@@ -42,7 +42,6 @@ type SetupMode = "mcp" | "cli";
interface SetupOptions {
claude?: boolean;
cursor?: boolean;
- universal?: boolean;
antigravity?: boolean;
opencode?: boolean;
codex?: boolean;
@@ -73,6 +72,7 @@ function getSelectedAgents(options: SetupOptions): SetupAgent[] {
if (options.cursor) agents.push("cursor");
if (options.opencode) agents.push("opencode");
if (options.codex) agents.push("codex");
+ if (options.antigravity) agents.push("antigravity");
if (options.gemini) agents.push("gemini");
return agents;
}
@@ -83,7 +83,6 @@ export function registerSetupCommand(program: Command): void {
.description("Set up Context7 for your AI coding agent")
.option("--claude", "Set up for Claude Code")
.option("--cursor", "Set up for Cursor")
- .option("--universal", "Set up for Universal (.agents/skills)")
.option("--antigravity", "Set up for Antigravity (.agent/skills)")
.option("--opencode", "Set up for OpenCode")
.option("--codex", "Set up for Codex")
@@ -308,7 +307,7 @@ async function setupAgent(
const agent = getAgent(agentName);
const mcpCandidates =
- scope === "global"
+ scope === "global" || agent.mcp.projectPaths.length === 0
? agent.mcp.globalPaths
: agent.mcp.projectPaths.map((p) => join(process.cwd(), p));
const mcpPath = await resolveMcpPath(mcpCandidates);
diff --git a/packages/cli/src/setup/agents.ts b/packages/cli/src/setup/agents.ts
index de60b869..e5cd1bc5 100644
--- a/packages/cli/src/setup/agents.ts
+++ b/packages/cli/src/setup/agents.ts
@@ -2,7 +2,7 @@ import { access } from "fs/promises";
import { join } from "path";
import { homedir } from "os";
-export type SetupAgent = "claude" | "cursor" | "opencode" | "codex" | "gemini";
+export type SetupAgent = "claude" | "cursor" | "opencode" | "codex" | "antigravity" | "gemini";
export type AuthMode = "oauth" | "api-key";
export type Transport = "http" | "stdio";
@@ -16,6 +16,7 @@ export const SETUP_AGENT_NAMES: Record<SetupAgent, string> = {
cursor: "Cursor",
opencode: "OpenCode",
codex: "Codex",
+ antigravity: "Antigravity",
gemini: "Gemini CLI",
};
@@ -212,6 +213,36 @@ const agents: Record<SetupAgent, AgentConfig> = {
},
},
+ // Antigravity is built on Gemini infrastructure and shares ~/.gemini/. Per
+ // the official Codelabs guide, Antigravity 2.0/IDE/CLI read MCP servers from
+ // ~/.gemini/config/mcp_config.json globally; there is no project-level MCP
+ // config, so projectPaths is empty and setupAgent falls back to global.
+ antigravity: {
+ name: "antigravity",
+ displayName: "Antigravity",
+ mcp: {
+ projectPaths: [],
+ globalPaths: [join(homedir(), ".gemini", "config", "mcp_config.json")],
+ configKey: "mcpServers",
+ buildEntry: (auth, transport) =>
+ transport === "stdio" ? stdioEntry(auth) : withHeaders({ serverUrl: mcpUrl(auth) }, auth),
+ },
+ rule: {
+ kind: "append",
+ file: (scope) => (scope === "global" ? join(homedir(), ".gemini", "GEMINI.md") : "GEMINI.md"),
+ sectionMarker: "<!-- context7 -->",
+ },
+ skill: {
+ name: "context7-mcp",
+ dir: (scope) =>
+ scope === "global" ? join(homedir(), ".agent", "skills") : join(".agent", "skills"),
+ },
+ detect: {
+ projectPaths: [".agent"],
+ globalPaths: [join(homedir(), ".gemini", "antigravity"), join(homedir(), ".agent")],
+ },
+ },
+
gemini: {
name: "gemini",
displayName: "Gemini CLI",