Skip to content

How to add MCP servers to Gemini CLI and Antigravity

Gemini CLI and Antigravity keep MCP servers in JSON files, under the "mcpServers" key: Gemini CLI in ~/.gemini/settings.json (for you) or .gemini/settings.json (for one project) and Antigravity in ~/.gemini/config/mcp_config.json (for you) or .agents/mcp_config.json (for one project). A local server’s entry is a command with args; a remote server’s entry is its URL in httpUrl (Gemini CLI), serverUrl (Antigravity).
Last checked against Google’s docs

Quick facts

Local servers
Yes (stdio)
Remote servers
Streamable HTTP: Yes · SSE: PartlyURL field: httpUrl (Gemini CLI), serverUrl (Antigravity)
Sign-in
OAuth: Yes · Headers: YesGemini CLI discovers OAuth and registers itself with dynamic client registration. Antigravity tries a fixed oauth.clientId, then a client ID metadata document, then dynamic registration.
Resources
Partly
Prompts
Partly
Tool approval
Yes
Plans
Since 18 June 2026, unpaid tier and Google One users get Antigravity CLI instead of Gemini CLI.
Platforms
macOS, Windows and Linux

Step by step

Add a remote server

Example: a hosted server whose latest check on AI-Powered answered, Context7.

Gemini CLI

Add to ~/.gemini/settings.json

{
  "mcpServers": {
    "context7": {
      "httpUrl": "https://mcp.context7.com/mcp"
    }
  }
}

Or run: gemini mcp add -s user --transport http context7 https://mcp.context7.com/mcp

Antigravity

Add to ~/.gemini/config/mcp_config.json

{
  "mcpServers": {
    "context7": {
      "serverUrl": "https://mcp.context7.com/mcp"
    }
  }
}

Use .agents/mcp_config.json to add it to one workspace only.

Add a local server

Example: a popular npm package that needs no keys, Chrome DevTools MCP.

Gemini CLI

Add to ~/.gemini/settings.json

{
  "mcpServers": {
    "chrome-devtools-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "chrome-devtools-mcp"
      ]
    }
  }
}

Or run: gemini mcp add -s user chrome-devtools-mcp npx -- -y chrome-devtools-mcp

Antigravity

Add to ~/.gemini/config/mcp_config.json

{
  "mcpServers": {
    "chrome-devtools-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "chrome-devtools-mcp"
      ]
    }
  }
}

Use .agents/mcp_config.json to add it to one workspace only.

Add a server that needs an API key or header

Local servers read keys from environment variables. Replace each <NAME> placeholder with your own value in the file on your computer; never paste real keys into a website.

Example: Context7.

Gemini CLI

Add to ~/.gemini/settings.json

{
  "mcpServers": {
    "context7": {
      "command": "npx",
      "args": [
        "-y",
        "@upstash/context7-mcp"
      ],
      "env": {
        "CONTEXT7_API_KEY": "<CONTEXT7_API_KEY>"
      }
    }
  }
}

Or run: gemini mcp add -s user -e CONTEXT7_API_KEY='<CONTEXT7_API_KEY>' context7 npx -- -y @upstash/context7-mcp

Antigravity

Add to ~/.gemini/config/mcp_config.json

{
  "mcpServers": {
    "context7": {
      "command": "npx",
      "args": [
        "-y",
        "@upstash/context7-mcp"
      ],
      "env": {
        "CONTEXT7_API_KEY": "<CONTEXT7_API_KEY>"
      }
    }
  }
}

Use .agents/mcp_config.json to add it to one workspace only.

Request headers for remote servers: yes. Gemini CLI discovers OAuth and registers itself with dynamic client registration. Antigravity tries a fixed oauth.clientId, then a client ID metadata document, then dynamic registration.

Add a server that signs in with OAuth

OAuth sign-in: yes. Add the server by its URL as a remote server, then sign in when asked. Gemini CLI discovers OAuth and registers itself with dynamic client registration. Antigravity tries a fixed oauth.clientId, then a client ID metadata document, then dynamic registration.

Config file locations

ProductForSystemPath
Gemini CLIYou (every project)All systems~/.gemini/settings.json
Gemini CLIOne projectAll systems.gemini/settings.json
AntigravityYou (every project)All systems~/.gemini/config/mcp_config.json
AntigravityOne projectAll systems.agents/mcp_config.json

Get the config for any server

Search the MCP servers on AI-Powered and copy the Gemini CLI and Antigravity snippet for one.

Adding several servers? Build one config with the MCP config generator.

Servers that work in Gemini CLI and Antigravity

Popular servers with an install config for Gemini CLI and Antigravity and no failing latest check.
  1. REA

    MCP server

    CLI and MCP server that lets coding agents reverse engineer apps and binaries

    Runs locally
    • Open source
    • 476K GitHub stars
    • Developer tools
  2. Browser Use

    MCP server

    Browser agents and cloud browsers for AI, with an MCP server for web tasks

    • 7 tools
    • Remote
    • Freemium
    • 122K GitHub stars
    • Browser automation
  3. MCP server for AI clients to scrape sites with HTTP and stealth browser sessions

    Runs locally
    • 17 tools
    • Open source
    • 105K GitHub stars
    • Web search and scraping
  4. Hosted MCP connector for creating and rendering videos from HTML through AI chat

    • Remote
    • Freemium
    • 89K GitHub stars
    • Design and media
  5. Context7

    MCP server

    Version-specific library docs and code examples piped into coding agents via MCP

    • 2 tools
    • Remote
    • Freemium
    • 65.4K GitHub stars
    • Developer tools
  6. MCP server and CLI that let coding agents drive and inspect a live Chrome browser

    Runs locally
    • Open source
    • 59.1K GitHub stars
    • Browser automation
  7. Codebase Memory

    MCP server

    Local MCP server that builds a code knowledge graph for AI coding agents

    Runs locally
    • Open source
    • 49.1K GitHub stars
    • Knowledge and memory
  8. GitHub

    MCP server

    Official MCP server connecting AI assistants to GitHub repos, issues and workflows

    • Remote
    • Open source
    • 34.7K GitHub stars
    • Developer tools
  9. MCP toolkit giving coding agents symbol-level code retrieval and editing

    Runs locally
    • Open source
    • 31.7K GitHub stars
    • Developer tools
  10. ffmpeg-skill

    MCP server

    Local FFmpeg video and audio editing tools for coding agents over MCP

    Runs locally
    • Open source
    • 10.3K GitHub stars
    • Design and media
  11. Ha MCP

    MCP server

    MCP server for managing and automating Home Assistant from AI assistants

    Runs locally
    • 8 tools
    • Open source
    • 8.1K GitHub stars
    • Productivity
  12. Open-source analytics app where an AI agent builds charts and dashboards from your data

    • Remote
    • Open source
    • 7.8K GitHub stars
    • Analytics and data

Troubleshooting

A remote server fails in Gemini CLI
Gemini CLI reads httpUrl as Streamable HTTP and url as the older SSE connection. Most current servers need httpUrl.
A remote server fails in Antigravity
Antigravity reads serverUrl (or url) and only speaks Streamable HTTP. It doesn’t accept httpUrl or SSE-only servers.
Tool rules for a server don’t apply
Gemini CLI splits tool names on underscores, so a server named my_server can break allow and deny rules. Use a name like my-server.
A server fails without an error message
Gemini CLI hides background server errors. Run /mcp list or gemini mcp list to see them.
A tool call times out in Antigravity
Antigravity allows 300 seconds to connect and 180 seconds per tool call. Set timeoutSeconds on the server to change both.
A local server fails with “npx” (or uvx, docker) not found
Apps started from a dock or menu may not see your terminal’s PATH. Use the full path of the command (run which npx in a terminal to find it), then restart Gemini CLI and Antigravity.
You can’t tell whether the server or Gemini CLI and Antigravity is at fault
Test the server on its own with the MCP Inspector (npx @modelcontextprotocol/inspector). If it lists tools there, check the Gemini CLI and Antigravity setup.

Where to find logs

  • Gemini CLI: run /mcp to see each server’s status, or start gemini with --debug.
  • Antigravity CLI: type /mcp to open the MCP manager and its connection logs.

Safety notes

  • Gemini CLI asks before running MCP tools. Setting trust: true on a server skips every confirmation, so keep it for servers you wrote or fully trust.
  • Antigravity runs unconfigured MCP tools in Ask mode. Allow tools one by one rather than with mcp(*).
  • Use $VAR or ${VAR} in Gemini CLI settings for secrets instead of writing tokens into a project file.
  • A local server runs on your computer with your access to files and the network. Add only servers whose source you trust.

Questions about MCP in Gemini CLI and Antigravity

Where do Gemini CLI MCP servers go?

Under mcpServers in ~/.gemini/settings.json for every project, or .gemini/settings.json in a project.

Where does Antigravity keep MCP servers?

In ~/.gemini/config/mcp_config.json for all projects, or .agents/mcp_config.json in a workspace.

Why does the same server need different fields in Gemini CLI and Antigravity?

Gemini CLI uses httpUrl for Streamable HTTP and url for SSE. Antigravity uses serverUrl (or url) and has no SSE. Copy the snippet for the product you use.

Can I still use Gemini CLI on the free tier?

No. Since 18 June 2026, people on the unpaid tier or a Google One plan use Antigravity CLI instead, so follow the Antigravity snippet.

How do I add a server to Gemini CLI from the terminal?

Run gemini mcp add with a name and a command or URL. Add -s user to save it for every project and --transport http for a remote server; the default is the current project and stdio.

Can I use local MCP servers in Gemini CLI and Antigravity?

Yes. Gemini CLI and Antigravity start a local server as a command on your computer (stdio).

Do Gemini CLI and Antigravity support remote MCP servers?

Yes. Gemini CLI and Antigravity connect over Streamable HTTP. The URL goes in httpUrl (Gemini CLI), serverUrl (Antigravity).

Can Gemini CLI and Antigravity sign in to MCP servers with OAuth?

Yes. Gemini CLI discovers OAuth and registers itself with dynamic client registration. Antigravity tries a fixed oauth.clientId, then a client ID metadata document, then dynamic registration.

Other MCP clients