Gemini CLI

Connect Gemini CLI to Ternary by adding Ternary as a remote MCP server. Gemini CLI requires an OAuth client ID for this connection.

Before you start

You need:

  • An existing Ternary account
  • Access to at least one Ternary tenant
  • Gemini CLI installed and configured

Step 1: Add Ternary

Open the Gemini CLI settings file in a text editor:

~/.gemini/settings.json

That file lives in your home folder. If the file or .gemini folder does not exist yet, create them.

If it already has other MCP servers, add the "ternary" block inside "mcpServers" instead of replacing the whole file.

{
  "mcpServers": {
    "ternary": {
      "httpUrl": "https://core-api.ternary.app/mcp",
      "oauth": {
        "enabled": true,
        "clientId": "https://core-api.ternary.app/oauth/client-metadata.json"
      }
    }
  }
}

Save the file. The client ID stays the same for US and EU. Do not add a client secret.

Step 2: Authenticate

Open Gemini CLI.

Gemini CLI may start browser authentication automatically. If it does not, run:

/mcp auth ternary

Sign in with your existing Ternary account and approve access.

Step 3: Ask a question

Try:

Using Ternary, show last month's spend by provider.

Which budgets are currently at risk?

Show recent cost alerts.

Troubleshooting

Authentication does not start

Run:

/mcp auth ternary
Unknown client

Check the MCP URL and client ID exactly as documented, and remove any trailing slash from the server URL.

Sign-in fails

Confirm that your Ternary user exists in the same region as the server URL.

No tenants appear

Ask your Ternary administrator to grant an explicit tenant role.

See Troubleshooting Ternary MCP for shared issues.


Did this page help you?