Direct mail API for developers and growth teams. Read the docs →

Gemini MCP: add a custom server to the Gemini app, Gemini CLI and Antigravity, with a direct mail API as the example

Gemini MCP support now lives in three places, and a custom server such as a direct mail API that prices, proofs and sends postcards can go in any of them. The Gemini app takes a server’s URL under Settings, Connected Apps; Gemini CLI reads servers from settings.json; and Antigravity CLI, which replaced Gemini CLI for free and Google AI Pro and Ultra users on June 18, 2026, reads mcp_config.json. Below: each setup, how sign-in works, what asks before a tool runs, and Mailr’s server as the worked example.

On this page
  1. Where Gemini takes MCP servers now
  2. Add a custom MCP server to the Gemini app
  3. Add an MCP server to Gemini CLI
  4. Sign in to a remote MCP server from Gemini CLI
  5. Approvals in Gemini CLI
  6. Antigravity CLI: the same server in mcp_config.json
  7. Example: a direct mail API from Gemini
  8. Building on the Gemini API: call the direct mail API with a key
  9. Gemini MCP questions

Where Gemini takes MCP servers now

Gemini appWheregemini.google.com: Settings, Connected Apps, Add a custom appSign-inOAuth; the server needs dynamic client registrationWhoPersonal Google Accounts, 18 or over, in the US, in EnglishAntigravity CLIWhere~/.gemini/config/mcp_config.json, with serverUrlSign-inOAuth; client metadata document first, then dynamic registrationWhoFree and Google AI Pro and Ultra users, since June 18, 2026Gemini CLIWhere~/.gemini/settings.json, with url and type httpSign-inOAuth with dynamic registration; /mcp auth to sign in againWhoGemini Code Assist Standard and Enterprise, API keys, Vertex AI
Three places, one server URL. The same remote MCP server works in each; what changes is where you add it and who can. Gemini CLI stopped serving free and Google AI Pro and Ultra accounts on June 18, 2026, when Google moved them to Antigravity CLI.

Until June 2026, “Gemini MCP” mostly meant Gemini CLI. On June 18, Google stopped serving Gemini CLI to free and Google AI Pro and Ultra accounts and moved them to Antigravity CLI, which keeps its MCP servers in a different file. Gemini CLI still runs for Gemini Code Assist Standard and Enterprise seats, paid API keys and Vertex AI. Meanwhile the Gemini app itself started taking custom MCP servers, which Google calls custom connected apps.

Add a custom MCP server to the Gemini app

  • On a computer, open gemini.google.com, then Settings, Connected Apps. If it isn’t there, look under Personal Intelligence.
  • Under Custom apps, choose Add a custom app and enter the server’s URL: https://mailr.dev/mcp for Mailr.
  • Choose Next and follow the sign-in. Servers that support dynamic client registration, as Mailr’s does, need no credentials.
  • In a chat, type @ and pick the app to make Gemini use it.

It’s for personal Google Accounts, 18 or over, in the US, in English, with History on; work and school accounts can’t add one yet. You add it on the web, and it then works in the mobile app too. Gemini asks you to confirm write actions, and Google’s developer docs say it reads a tool’s readOnlyHint and destructiveHint to decide when.

Add an MCP server to Gemini CLI

One command adds a remote server. The default scope is the current project, so --scope user makes it available everywhere:

# Adds it for every project (the default scope is the current project)
gemini mcp add --scope user --transport http mailr https://mailr.dev/mcp

# Check it, then sign in from inside a session
gemini mcp list
# > /mcp auth mailr

Servers live under mcpServers in ~/.gemini/settings.json, or .gemini/settings.json in a project, where an entry with the same name wins. Gemini CLI’s docs still show httpUrl for Streamable HTTP, but the current code marks it deprecated in favor of url with "type": "http", which is what the command writes. Keep underscores out of server names: Gemini CLI’s tool names and policies split on them.

Sign in to a remote MCP server from Gemini CLI

When a server answers with a 401, Gemini CLI reads its protected-resource metadata, finds the sign-in, registers itself with dynamic client registration and opens your browser, with PKCE. For Mailr, that’s Sign in with Mailr: you pick the account and allow it, and the connection gets its own access, never your API keys. /mcp auth mailr signs in again later. The browser has to reach a localhost callback on the machine running the CLI, so over SSH without forwarding the sign-in won’t finish. Gemini CLI doesn’t support client metadata documents, so a server you build for it needs dynamic registration; more in building a remote MCP server.

Approvals in Gemini CLI

Allow onceThe one to pick for send_prepared, every timeAllow tool for this sessionFine for read tools like get_pricesAllow all server tools for this sessionCovers send_prepared too, so it stops asking before a live sendAllow tool for all future sessionsShown only when permanent approvals are turned onNo, suggest changesStops the call and lets you redirect it
Approve sends one at a time. The choices Gemini CLI shows before an MCP tool runs, in a trusted folder. Setting trust: true on the server, or starting with --yolo, skips the question for every tool, sends included.

Every MCP tool asks before it runs unless you’ve allowed it. To let a server’s read-only tools run on their own and keep asking for the rest, add a policy file. Gemini CLI’s policy engine can match a tool’s readOnlyHint:

# ~/.gemini/policies/mailr.toml
# Mailr's read-only tools (prices, templates, mail status) run without asking.
# Everything else, sends included, still asks.
[[rule]]
mcpName = "mailr"
toolAnnotations = { readOnlyHint = true }
decision = "allow"
priority = 200

With that rule, Gemini reads Mailr’s prices, templates and mail status on its own, and asks before it prepares a mailing, checks addresses or sends one.

Antigravity CLI: the same server in mcp_config.json

Antigravity CLI reads ~/.gemini/config/mcp_config.json, or .agents/mcp_config.json in a workspace, and calls the field serverUrl. Remote servers have to use Streamable HTTP; httpUrl and the older SSE transport aren’t supported.

{
  "mcpServers": {
    "mailr": {
      "serverUrl": "https://mailr.dev/mcp"
    }
  }
}

Antigravity signs in with OAuth on its own, trying a client metadata document first and dynamic registration second; Mailr supports both. The resource in the server’s metadata has to match the URL exactly, so use https://mailr.dev/mcp with no trailing slash. /mcp opens its server manager.

Example: a direct mail API from Gemini

  • “What would 1,000 6x9 postcards cost?” Answered from your Mailr plan.
  • “Prepare the thank-you card for the customers in this CSV.” A draft with the total and a proof link; nothing sent.
  • “Send it as a test, then live.” Test mail is free and never prints. The live send asks, and Mailr sends only the exact draft and total you approved.

The same server works in Claude, ChatGPT, Claude Code, Codex, Cursor and VS Code.

Building on the Gemini API: call the direct mail API with a key

The Gemini API can also call a remote MCP server as a tool, with headers you set. Mailr’s server only accepts Sign in with Mailr, though, so for your own app on the Gemini API, give the model a function that calls Mailr’s REST API with a key from your environment; sending mail programmatically has the requests.

Gemini MCP questions

Does the Gemini app support MCP?

Yes. In the Gemini web app, go to Settings, Connected Apps and Add a custom app, then enter the server's URL. It's for personal Google Accounts in the US, 18 or over, in English, with History on, and once added it works in the mobile app too.

Where is the MCP config in Gemini CLI?

In ~/.gemini/settings.json for every project, or .gemini/settings.json in a project, under mcpServers. A project entry replaces a user entry with the same name.

Should I use url or httpUrl in Gemini CLI?

url with "type": "http". The docs still show httpUrl for Streamable HTTP, but the current code marks it deprecated, and gemini mcp add --transport http writes url and type.

Is Gemini CLI still free?

Not for personal accounts. On June 18, 2026, Google moved free and Google AI Pro and Ultra users to Antigravity CLI. Gemini CLI still runs with Gemini Code Assist Standard or Enterprise, an API key or Vertex AI.

Can Gemini send mail without asking?

Only if you let it. Gemini CLI asks before each MCP tool unless you allow it for the session, set trust: true or start in YOLO mode, and the Gemini app confirms write actions. Mailr's own send step also needs the exact total the person approved.

START SENDING

Put your first postcard in the mail

Create a key, send a test to yourself, and check the proof before anything prints.

Start sending
  • Postcards, flats and folded mailers
  • A proof before anything prints
  • Free test mode: nothing prints, nothing charges
  • A status for every piece

Free price sheet

Get the price sheet by email

Every postcard, letter, mailer and print product on every plan, with postage included.

We’ll email you the price sheet. By continuing you agree to the Terms and Privacy Policy.

Download the template kit?

mailr-kit.zip · about 310 KB · 59 text files

Only HTML, JSON and Markdown files. No programs, scripts or macros, nothing that installs or runs.