← All connections

Connect to Gemini

Gemini CLI connected via MCP. In the Gemini app, support varies by account.

Before you start, create your free account.Create account

Which MCP will you connect? The commands below change according to your choice.

  1. 1

    Gemini CLI: add the server

    The confirmed path is the Gemini CLI. Generate the key (next step) and register the server with a command, replacing YOUR_API_KEY with the key you generated:

    gemini mcp add --transport http --header "Authorization: Bearer YOUR_API_KEY" NewAlgorithm-TOTVS https://totvs.mcp.newalgorithm.io/mcp
  2. 2

    Generate your API key

    Sign in to app.newalgorithm.io with your account, open Keys & apps and generate a key. It is shown only once: copy it and store it somewhere safe.

    Key format
    na_live_xxxxxxxxxxxxxxxxx
  3. 3

    Or write the configuration directly

    The user file is at ~/.gemini/settings.json. For Streamable HTTP, the field is httpUrl — url is reserved for SSE servers:

    ~/.gemini/settings.json
    {
      "mcpServers": {
        "NewAlgorithm-TOTVS": {
          "httpUrl": "https://totvs.mcp.newalgorithm.io/mcp",
          "headers": {
            "Authorization": "Bearer YOUR_API_KEY"
          }
        }
      }
    }
  4. 4

    No key: OAuth sign-in

    If you register the server without the header, the CLI detects that NewAlgorithm requires sign-in and starts the OAuth flow in the browser. Inside the session, authenticate with:

    /mcp auth NewAlgorithm-TOTVS

    Expected: OAuth needs a local browser; in a headless environment, use the API Key.

  5. 5

    Confirm

    Inside the CLI session, list the servers and the loaded tools:

    /mcp

    Expected: NewAlgorithm-TOTVS — Connected na_prepare, na_search, na_route, na_specialists, na_version

  6. 6

    What about the Gemini app?

    Support for custom MCP apps in the Gemini app depends on account type and region. The Tax Specialist is also published as a Gem, a separate path from MCP, opened from the Specialist's page.

Never store the real key in versioned files. Prefer the user-level settings.json, outside the repository.

Authentication and tool details in the Docs.