Skip to content
AI assistants

Connect Gemini

Gemini on the web has no custom connectors, so you connect it to Otto through the free Gemini CLI in the terminal. Step by step for Mac and Windows.

On this page

Gemini on the web and on mobile has no custom connectors yet. That is why you connect it to Otto through Gemini CLI, the free official Google program that runs in the terminal. You set it up once, it takes about 10 minutes.

What you need

  • Node.js 20 or newer. Check it in the terminal with node -v. If you don’t have it, download it from nodejs.org.
  • A Google account for a free Gemini API key. You don’t need a paid Gemini plan.
  • A terminal: Terminal on a Mac, PowerShell on Windows.
  • Otto on the Business or Custom plan and an Otto account of the company owner or a colleague with the settings permission.

Steps

  1. Install Gemini CLI. In the terminal run:
    Terminal
    npm install -g @google/gemini-cli
  2. Create a Gemini API key. Open aistudio.google.com/apikey, sign in with your Google account and click Create API key. Copy the key.
  3. Save the key. Replace YOUR_KEY with your key.
    Mac and Linux
    mkdir -p ~/.gemini && echo 'GEMINI_API_KEY=YOUR_KEY' >> ~/.gemini/.env
    Windows (PowerShell)
    New-Item -ItemType Directory -Force "$HOME\.gemini" | Out-Null
    Add-Content "$HOME\.gemini\.env" "GEMINI_API_KEY=YOUR_KEY"
  4. Add Otto to the Gemini settings. Open ~/.gemini/settings.json in a text editor, on Windows for example with notepad "$HOME\.gemini\settings.json". If the file doesn’t exist, create it and paste:
    settings.json
    {
      "mcpServers": {
        "otto": {
          "httpUrl": "https://mcp.ottoai.eu",
          "timeout": 30000
        }
      },
      "security": {
        "auth": { "selectedType": "gemini-api-key" }
      }
    }
    If the file already has content, add only the otto block to mcpServers.
  5. Start Gemini. In the terminal type gemini. When Gemini asks how to sign in, choose Use Gemini API Key.
  6. Sign in to Otto. In Gemini type /mcp auth otto. The Otto sign-in opens in the browser: sign in, pick the company, tick Also change if needed and click Allow. Otto warns you that the sign-in returns to a program on this computer, with Gemini CLI that is fine.
  7. Check the connection. Type /mcp. Next to otto you should see Ready and the number of tools. Then write: “List the colleagues on my Otto team.” When Gemini replies with your team, the connection works.
Start Gemini CLI from your home folder, for example right after opening the terminal. That is where it finds the key and the settings.

When something doesn’t work

  • Error 401 on the first request. Gemini CLI also reads the .env file in the folder you start it from. If that folder has another .env without the key, it doesn’t find the key. Start gemini from your home folder or add the key to that file too.
  • otto shows Disconnected. Type /mcp auth otto and sign in again. If that doesn’t help, quit Gemini, delete ~/.gemini/mcp-oauth-tokens.json and try again.
  • The sign-in doesn’t open. During sign-in Gemini CLI waits on port 7777 on this computer. Close the program using it and try again.
  • The installation fails with EACCES. Run Gemini without installing it: npx @google/gemini-cli.
  • Another company got connected. Disconnect the assistant in the Otto panel (Settings, Connections, MCP card) and type /mcp auth otto in Gemini again.

What to ask and what the assistant may do is in AI assistants via MCP.