Connect Clam to Gemini CLI
Gemini CLI connects to Clam with one command that carries your Shell's address and a key. There is no sign-in window. From then on, Gemini CLI's email requests follow your Shell's rules.
Before you start
You need a Clam account with a Shell; the Quickstart sets up both. Everything here starts on your Shell's Install tab in the Clam console, under Gemini CLI.
Gemini CLI talks to Clam over MCP, the standard way an AI agent plugs into an outside tool: each Shell is an MCP server, and its email tools go through your rules before they reach Gmail.
Connect Gemini CLI
Two ways in. Start with the first; the other is for when it doesn't fit.
The simplest path: Gemini CLI uses a key, so there is no sign-in window.
-
Paste this in your terminal
Click Copy command on the Install tab. Copying is the step that matters: it creates a key for Gemini CLI and fills it in, and you see that key only once. Paste the command into your terminal and press Enter.
Terminalgemini mcp add <server name> <your Shell's address> --transport http --header "Authorization: Bearer <your key>" -
Open Gemini CLI and run /mcp
Run
/mcp. You should see your server in the list.
Try a prompt below, then click Check connection on the Install tab.
The key works for Gemini CLI only. Regenerate key makes a new one, and the old one stops working at once.
For when you keep ~/.gemini/settings.json by hand, say in dotfiles. Same key, same result; the Install tab shows the block and where it goes.
-
Add this block to ~/.gemini/settings.json
Under
mcpServers. Create it if it isn't there.JSON{ "mcpServers": { "<server name>": { "httpUrl": "<your Shell's address>", "headers": { "Authorization": "Bearer <your key>" } } } } -
Restart Gemini CLI, then run /mcp
Run
/mcp. You should see your server in the list.
Try a prompt below, then click Check connection on the Install tab.
Try it
With the starter policy from the Quickstart, ask Gemini CLI:
If Gemini CLI has other mail tools, start with "Use <your Shell's name>". Change what's allowed in How rules work.
Remove access
In Gemini CLI, run gemini mcp remove <server name>.
The removal that counts is Clam's: on the Shell's Install tab, under Connected agents, choose Remove access next to Gemini CLI. The key stops working at once, whether or not Gemini CLI still has it. Remove access
If it doesn't work
More in Common issues & solutions.
/mcp doesn't list your Shell
gemini mcp list shows what was saved. If you edited settings.json, check the block sits inside mcpServers and restart Gemini CLI.
The server is unauthorized
The key is wrong or was removed. Regenerate it and add Clam again.
Connected? Write your own rules.