# How to connect Gemini to a server

Gemini talks to a server through MCP. You can run your own MCP server on a VPS and add it to the Gemini app as a custom app, or connect a service whose MCP server already exists. Here is what each way takes, and who can use it today.

## Tell your AI

1. Connect BitHut to your AI (Claude, ChatGPT or Codex): add the address `https://api.bithut.app/mcp`. How: https://bithut.app/connect.md
2. Then tell it:

```
Show my BitHut projects
```

## The short answer

Gemini doesn't log in to a server the way a person does. It uses MCP (Model Context Protocol), an open standard: a program called an MCP server offers Gemini a set of tools, such as "list files" or "restart the app", and Gemini calls them during a chat.

There are two places where you can plug an MCP server into Gemini:

- **The Gemini app** (gemini.google.com and the phone app). You add the server's address as a **custom app** in Connected Apps.
- **The terminal.** Gemini CLI reads MCP servers from its settings file. For most personal accounts Google has replaced it with Antigravity CLI, which has its own MCP file. Both are covered below.

And there are two kinds of server to plug in:

1. **Your own MCP server on your VPS.** You install it, give it a public HTTPS address, protect it with a sign-in and add that address to Gemini.
2. **A service that already runs an MCP server.** You add its address and sign in. BitHut works this way: there is nothing to install, and Gemini puts your projects online through it.

Everything below about Gemini's menus, limits and commands comes from Google's own documentation, checked 23 November 2026.

## What a custom app is

A custom app is a remote MCP server: a program on the internet that Gemini reaches by its address. You add it once, and Gemini can then call its tools. Google says the server "must follow the standard MCP specifications" ([Gemini Apps Help](https://support.google.com/gemini/answer/17209137)). For a remote server that means the Streamable HTTP transport ([MCP specification](https://modelcontextprotocol.io/specification/2025-11-25/basic/transports)).

Two things to know before you start:

- **You add it on the web only.** Adding a custom app works only at gemini.google.com on a computer. After that the app works in the Gemini phone app too ([Gemini Apps Help](https://support.google.com/gemini/answer/17209137)).
- **Not everyone can add one yet.** The requirements are below, and the country rule rules out most people outside the US.

## Your own MCP server on a VPS

### What you need

- **An MCP server program.** Either one a service publishes, or one you (or your AI) write for your own tasks.
- **A public HTTPS address**, for example `https://mcp.example.com/mcp`. That means a domain, a certificate and a web server or proxy in front of the program. The Gemini app isn't running on your computer, so an address that only opens inside your home or office network won't do.
- **A sign-in.** The Gemini app expects your server to support OAuth with Dynamic Client Registration, where Gemini registers itself on your server automatically. If your server can't do that, you open **Advanced features** → **Show more** when adding the app and enter credentials by hand ([Gemini Apps Help](https://support.google.com/gemini/answer/17209137)). Google doesn't list the exact fields there. OAuth is the part that takes the most work to build.
- **Upkeep.** The program has to run day and night, restart after a crash or a reboot, and get updates. If the VPS is down, Gemini simply loses the tools.
- **A firewall** that leaves HTTPS open and closes everything you don't need.

### Who can add a custom app

According to Google, to connect a custom app you must ([Gemini Apps Help](https://support.google.com/gemini/answer/17209137)):

- be 18 or over and in the US;
- sign in with a personal Google account; work and school accounts can't do it "for now";
- have the **History** setting on, otherwise custom apps are unavailable;
- use Gemini in English: custom apps are available only in English, in the phone app and at gemini.google.com.

### Add it in the Gemini app

1. On a computer, go to [gemini.google.com](https://gemini.google.com).
2. At the bottom, click **Settings** → **Connected Apps**.
3. Under **Custom apps**, click **Add a custom app** (if you have none yet, the field says "Add a custom app link to get started").
4. Enter the server's MCP address.
5. If the server doesn't support Dynamic Client Registration, open **Advanced features** → **Show more** and enter your credentials.
6. Click **Next** and follow the on-screen steps, including the sign-in.

In a chat, type **@** and pick the app to make sure Gemini uses it for that prompt. To switch it off, turn it off under **Custom apps**; to remove it, open **More details** → **Remove app** ([Gemini Apps Help](https://support.google.com/gemini/answer/17209137)).

### Add it in the terminal

**Gemini CLI.** One command adds a remote server ([Gemini CLI docs](https://www.geminicli.com/docs/tools/mcp-server)):

```bash
gemini mcp add --transport http my-server https://mcp.example.com/mcp
```

By default it goes into the project's `.gemini/settings.json`; add `--scope user` to put it in `~/.gemini/settings.json` for all projects. In the file it is an entry under `mcpServers` with `httpUrl`. If the server supports OAuth discovery, the CLI finds the sign-in on its own and can register itself; run `/mcp auth my-server` to sign in, and `/mcp` to see whether the server is connected and which tools it offers.

Two catches from the same page. First, the OAuth sign-in needs a browser on the machine where the CLI runs: it won't work over plain SSH on a VPS or in a container without a browser. Second, a banner there says that for unpaid and Google One users Gemini CLI was replaced by Antigravity CLI on 18 June 2026. Google's announcement says Gemini CLI stays available with paid Gemini API keys and Gemini Code Assist Standard or Enterprise licenses ([Google for Developers blog](https://developers.googleblog.com/an-important-update-transitioning-gemini-cli-to-antigravity-cli)).

**Antigravity CLI.** It keeps MCP support but reads servers from `~/.gemini/config/mcp_config.json` (or `.agents/mcp_config.json` in a project). A remote server is an entry under `mcpServers` with `serverUrl`, and it must use Streamable HTTP. For servers with Dynamic Client Registration, Antigravity handles OAuth itself ([Antigravity docs](https://antigravity.google/docs/mcp)). Moving from Gemini CLI by hand means renaming `httpUrl` to `serverUrl` ([migration guide](https://antigravity.google/docs/cli/gcli-migration)).

**Gemini Enterprise** is a separate path: there an administrator adds a custom MCP server for the whole organization in Google Cloud ([Google Cloud docs](https://docs.cloud.google.com/gemini/enterprise/docs/connectors/custom-mcp-server/set-up-custom-mcp-server)).

### Keep it safe

Google says it does not control, monitor or secure third-party MCP servers, and that you are responsible for supervising them. Gemini asks for your confirmation before any write action, but it can make mistakes, and it may share information from your chat with the server ([Gemini Apps Help](https://support.google.com/gemini/answer/17209137)). For your own VPS, our advice:

- **Never give an AI the root password** or a tool that runs any command as root. Give the MCP server its own user with access only to what it needs.
- **Keep keys apart from the code**, in environment variables or a secret store, not in the repository.
- **Offer only the tools you need.** Every extra tool is one more thing Gemini can get wrong.
- **Read what Gemini is about to do** before you confirm a call that changes or deletes something.

## The BitHut way: nothing to host

If what you want from "Gemini on a server" is to put a site, a bot or a script online, you don't need a VPS of your own. BitHut already runs an MCP server at `https://api.bithut.app/mcp`, with the automatic client registration the Gemini app expects. You add it as a custom app and sign in. The steps are in the [docs](/docs/start/connect-ai#chat-apps-claude-chatgpt-gemini). For Antigravity, see the [Connect page](/connect#antigravity).

Then you just talk to Gemini:

- "Put this project online on BitHut": it uploads the code, BitHut builds and checks it, and Gemini gets the address.
- "Why did my bot stop?": Gemini reads the logs and the error and suggests a fix.
- "Roll back to yesterday's version": Gemini asks you to confirm, then does it.

Keys are stored apart from the code, sites start private behind a password page, and the price is fixed for the account: from $5 a month, see [pricing](/pricing). There is no free plan.

To be clear: we have not yet run BitHut with Gemini end to end ourselves. The Google requirements above apply as well, so outside the US the Gemini app won't let you add BitHut yet. Other AIs and their steps are on the same [Connect page](/connect).

## When something doesn't work

- **There is no Custom apps section.** Check that you are in the US, signed in with a personal account (not work or school), using Gemini in English, and that History is on ([Gemini Apps Help](https://support.google.com/gemini/answer/17209137)).
- **I can't add it on my phone.** Custom apps are added only at gemini.google.com on a computer; after that they work in the phone app.
- **Gemini can't reach my server.** Check that the address opens from outside your network over HTTPS and that the server speaks Streamable HTTP.
- **The sign-in fails.** If your server has no Dynamic Client Registration, enter its credentials under **Advanced features** → **Show more**.
- **Gemini doesn't use the app.** Type **@** in the chat and pick the app, and check it is turned on under **Custom apps**.
- **Gemini CLI sign-in won't open on my VPS.** The OAuth sign-in needs a browser on the same machine; run the CLI on your computer instead ([Gemini CLI docs](https://www.geminicli.com/docs/tools/mcp-server)).
- **Gemini CLI stopped answering.** For unpaid and Google One users it was replaced by Antigravity CLI on 18 June 2026; move your servers to `mcp_config.json`.
- **BitHut is connected but Gemini doesn't answer about projects.** Ask it: "Show my BitHut projects." If it lists them, the connection works.
