集成
Google Antigravity
两分钟内在 Google Antigravity 中配置 zn-gate:将其添加为 MCP 服务器,以及 zn-gate 在该环境中尚未覆盖的内容。
快速开始(无需编程)
-
检查是否已安装 Node.js。 打开终端(在大多数编辑器中:菜单 Terminal → New Terminal;或使用电脑自带的终端应用),输入
node --version并按 Enter。如果显示版本号(18 或更高),继续下一步。如果显示 "command not found",请从 nodejs.org 安装 LTS 版本,然后重启 Antigravity。 -
在智能体面板顶部,打开 … 菜单 → MCP Servers → Manage MCP Servers → View raw config。(这是文件
~/.gemini/config/mcp_config.json,其中~是你的用户文件夹,例如 Windows 上的C:\Users\you。) -
粘贴以下内容:
{ "mcpServers": { "zn-gate": { "command": "npx", "args": [ "-y", "zn-gate", "mcp" ] } } }如果文件中已经有
"mcpServers"部分,则只需将"zn-gate": {...}部分添加到其中。 -
保存文件并重启 Antigravity。
状态:these steps follow Antigravity's documentation; not yet verified by us in Antigravity.
zn-gate 在 Antigravity 中保护什么,以及不保护什么
在 Antigravity 中,zn-gate 以 MCP 服务器的形式工作:智能体可以请求它检查提示、工具调用或工具结果(analyze_prompt、check_tool_call、check_tool_result)。由智能体决定何时调用这些工具,因此仅靠这一点并不是自动防护。
| 在 Antigravity 中 | |
|---|---|
| 智能体可用的 zn-gate 检查(MCP) | 是 |
| 你的其他 MCP 服务器进行提示注入和机密检查 | 是,如果你按下文进行包装 |
拦截对 .env 和凭据文件的读取 |
否 |
| 从 shell 输出和文件内容中移除机密 | 否 |
| 拦截粘贴到聊天中的机密 | 否 |
Antigravity 提供了钩子(PreToolUse、PostToolUse 等,位于 .agents/hooks.json),可以拒绝或修改工具调用,但 zn-gate 目前尚未为 Antigravity 安装钩子。因此,在 Antigravity 中,zn-gate 不会拦截对 .env 或凭据文件的读取,也不会从 shell 输出或文件内容中移除机密。如果你目前需要这些功能,请将 zn-gate 与 Claude Code、Codex CLI、Cursor 或 OpenCode 一起使用:参见 compat.md。
技术参考
配置文件位置
所有项目:~/.gemini/config/mcp_config.json。单个项目:.agents/mcp_config.json。zn-gate init 尚无法找到此文件,因此请按下文手动包装服务器。
检查其他 MCP 服务器的输出
要检查你在 Antigravity 中使用的其他 MCP 服务器的输出,请通过 zn-gate 启动每个本地服务器:将其命令替换为 npx,并在其原始命令和参数前加上 -y zn-gate shield --。例如,通过 uvx mcp-server-fetch 启动的服务器将变为:
{
"mcpServers": {
"fetch": {
"command": "npx",
"args": [
"-y",
"zn-gate",
"shield",
"--",
"uvx",
"mcp-server-fetch"
]
}
}
}
此后,该服务器的每个结果在智能体看到之前都会经过提示注入检查,并且 zn-gate 能识别的机密会被移除。zn-gate init 会为 Claude Desktop、Claude Code、Cursor、Codex 和 OpenCode 自动执行此操作,但不会修改 Antigravity 的设置。
Antigravity 文档
- Antigravity 中的 MCP:https://antigravity.google/docs/mcp
- Antigravity 中的钩子:https://antigravity.google/docs/hooks