◉ANTIGRAVITY LABJP
Articles/Integrations
⬡ Integrations/2026-10-19Beginner

Connecting GitHub MCP to Antigravity CLI: The Fix Was One Word, url to serverUrl

To use GitHub MCP from Antigravity CLI, the url key in your config has to become serverUrl. Based on the official MCP docs, here are the remote and Docker setups, a small script that checks the file before you load it, where to keep the token, and the order to debug in.

MCP28GitHubAntigravity CLI39Setup6Troubleshooting11

I wanted an agent to draft release notes for my wallpaper apps straight from GitHub issues. As an indie developer, that is the kind of chore I would happily hand off. So one evening I opened the GitHub MCP setup instructions, and everything in them was written for the IDE.

The CLI is not covered in GitHub's own install guide yet. There is an open request in the GitHub MCP Server repository asking for exactly that. If you are moving over from Gemini CLI, this is the point where it is easy to stall: you cannot tell where the config file belongs.

What I would like to say first is that most of the trouble comes down to the name of the key that holds the remote URL. Antigravity's MCP config requires serverUrl. The older url and httpUrl are not supported. The rest of this post fixes that one word and then walks through confirming the connection.

There are two config files

According to the official MCP documentation, the CLI reads from two places:

  • Global: ~/.gemini/config/mcp_config.json
  • Workspace: .agents/mcp_config.json in the project root

One caveat. The GitHub issue I mentioned lists the global path as ~/.gemini/antigravity-cli/mcp_config.json, which does not match the docs. I cannot say from here which one your install honors.

So before you trust either path, type /mcp at the CLI prompt. It opens the MCP manager, where each server shows a status ring. If the server you wrote never appears, the file is in the wrong place. If you would rather not touch the file at all, Adding MCP Servers Without Opening the Config File: The agy mcp Subcommand is the safer route.

Remote connection: serverUrl and headers

This is the config for GitHub's hosted MCP endpoint:

{
  "mcpServers": {
    "github": {
      "serverUrl": "https://api.githubcopilot.com/mcp/",
      "headers": {
        "Authorization": "Bearer YOUR_GITHUB_PAT"
      }
    }
  }
}

This solves one thing: reaching a remote MCP server while passing a token. The documented schema says each server needs either command (for stdio) or serverUrl (for remote). For a remote server you write serverUrl, plus headers if needed.

Why serverUrl and not url? Because the docs say so plainly: legacy fields like url and httpUrl are not supported. If you copied a Gemini CLI config, only the key name stops working.

Docker connection: run the server locally

If you would rather keep traffic on your own machine, use a stdio connection. This is the form proposed in the issue:

{
  "mcpServers": {
    "github": {
      "command": "docker",
      "args": [
        "run", "-i", "--rm",
        "-e", "GITHUB_PERSONAL_ACCESS_TOKEN",
        "ghcr.io/github/github-mcp-server"
      ],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "YOUR_GITHUB_PAT"
      }
    }
  }
}

I did not run the Docker version for this post. What I checked is that the issue's proposal matches the documented schema (command, args, env), nothing more.

AspectRemote (serverUrl)Local (Docker)
Required keyserverUrlcommand
PrerequisiteNetwork access and a tokenDocker running
Length of configShortLonger, so typos are easier
Good forSeeing it work quicklyKeeping traffic local

For a first connection, I would start with the short remote one.

Check the file before the CLI loads it

The config is plain JSON, so one stray comma can make the whole file unreadable. After editing, I run this script before launching anything:

#!/usr/bin/env python3
"""mcp_check.py — catch config shapes that cannot connect, before loading."""
import json, sys, pathlib
 
LEGACY = {"url": "serverUrl", "httpUrl": "serverUrl"}
 
def check(path):
    problems = []
    try:
        cfg = json.loads(pathlib.Path(path).read_text(encoding="utf-8"))
    except (OSError, json.JSONDecodeError) as e:
        return [f"{path}: not valid JSON ({e})"]
    servers = cfg.get("mcpServers")
    if not isinstance(servers, dict):
        return [f"{path}: no mcpServers object"]
    for name, spec in servers.items():
        if spec.get("disabled"):
            continue
        for old, new in LEGACY.items():
            if old in spec:
                problems.append(f"{name}: '{old}' is not supported; use '{new}'")
        if "command" not in spec and "serverUrl" not in spec:
            problems.append(f"{name}: needs either command or serverUrl")
        auth = spec.get("headers", {}).get("Authorization", "")
        if "YOUR_" in auth:
            problems.append(f"{name}: Authorization is still a placeholder")
    return problems
 
if __name__ == "__main__":
    bad = 0
    for p in sys.argv[1:]:
        issues = check(p)
        print(("NG  " if issues else "OK  ") + p)
        for i in issues:
            print("    - " + i)
        bad += bool(issues)
    sys.exit(1 if bad else 0)

I ran it against three files: a config copied in the old shape, one fixed to serverUrl, and one with a trailing comma. Here is the output (message text translated from the Japanese original):

NG  before.json
    - github: 'url' is not supported; use 'serverUrl'
    - github: needs either command or serverUrl
    - github: Authorization is still a placeholder
OK  after.json
NG  broken.json
    - broken.json: not valid JSON (Expecting property name enclosed in double quotes: line 1 column 78 (char 77))

With the old shape you do not only get the url warning. You also get "no command or serverUrl", because from the agent's side there is no destination written at all. That second line is, I think, what hides behind a vague "it won't connect" on screen.

Where the token lives, and what to allow first

Writing a token into headers has one trap. The workspace file, .agents/mcp_config.json, sits inside your project, so an accidental commit takes the key with it.

My own line is this:

  • Keep configs that contain tokens in the global file, outside any repository
  • Keep only key-free stdio servers in the workspace file
  • Use a fine-grained token with only the scopes you need, and start read-only

On permissions, the docs say MCP tools you have not configured run in Ask mode, so you are prompted before each execution. You can allow things per server, like mcp(github/*), or per tool, like mcp(github/tool-name). I like to allow nothing at first and open up only what I actually see in the approval prompts. I wrote about narrowing the list in Scope the MCP Tools You Hand an Agent: A Least-Privilege Allowlist Design.

When it still does not connect

SymptomLook here first
github missing from /mcpFile location (global vs workspace) and JSON syntax
Listed but cannot connectA leftover url or httpUrl
Connected but tools do not runThe approval prompt (Ask mode) and the token's scopes
Red squiggles in the editorThe editor's schema check may be ahead of the CLI; see the red-squiggle post

If the file itself seems suspect, the pre-launch validator article is where this script's idea came from.

What to do next

Create one read-only token, write the remote config above, and run it through mcp_check.py. Once /mcp shows github as connected, ask for one small thing, such as listing the issues in your own repository.

Keep the key on your side, and check the file before you load it. I try to hold to that order every time I add a server.

Share

Thank You for Reading

Antigravity Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $10 for lifetime access
View Membership →

If you found this article helpful, a small tip ($1.50) would mean a lot to us. Your support helps keep this site ad-free and covers server and hosting costs.

Related Articles

⬡ Integrations2026-08-22
Adding MCP Servers Without Opening the Config File: The agy mcp Subcommand
Antigravity CLI 1.1.16, released on August 20, adds an mcp subcommand so you can register and toggle MCP servers without hand-editing JSON. Here is how to add stdio and HTTP servers, isolate a misbehaving one, and script your whole setup so it travels to a new machine.
⬡ Integrations2026-10-10
Figma MCP or Stitch MCP: Choosing by Whether the Screen Already Exists
When you turn a screen into code, which MCP should Antigravity talk to: Figma or Stitch? One question settles it: does the correct screen already exist? Here is the rule I use, a switching routine, and a small script for the days I can't decide.
⬡ Integrations2026-08-20
Find the one broken MCP entry before Antigravity starts, with a Node script under 60 lines
A single typo in your MCP settings can take every server down with it. Here is a small preflight script that catches the mistakes statically, the real output from a deliberately broken config, and the duplicate-key trap that JSON hides from you.