Skip to main content
Use Gemini CLI with Plainrouter over Streamable HTTP. This guide is for the terminal client, not the Gemini web app. Install and sign in to Gemini CLI first.

1. Try the sandbox

Run:
Start Gemini CLI and use /mcp to inspect the connection. The sandbox needs no Plainrouter account or key, returns synthetic data, and never contacts Meta. Ask:
Both calls should succeed and include sandbox: true. This checks the connection, not production data or ad execution.

2. Create a workspace key

In Plainrouter, select your workspace and open Settings → Workspace keys. Create a Read key for analysis; use Write for Actions, including Actions record reads. Copy it once into your protected credential configuration. Each key covers one workspace. Never put keys in prompts or source control. Key permissions and replacement.

3. Add Plainrouter to the client

Merge this entry into ~/.gemini/settings.json, preserving other settings:
Provide PLAINROUTER_WORKSPACE_KEY through your local secret manager in the environment that starts Gemini CLI. Leave the variable reference in the file. Restart the client, check /mcp, and select plainrouter for production reads.

4. Verify the connection

Start with this read-only request:
Check the tool result, not just the assistant’s summary: the workspace must be yours and the call must succeed. This workspace-only read works before connecting Meta. For account diagnostics, connect Meta and verify the selected account. Agent replies can vary. In Ask, changes wait for approval; in Full, policy-allowed changes run automatically. Rule violations are blocked in either mode. A client’s tool confirmation is separate from Plainrouter’s execution controls.

5. Troubleshooting

  • Disconnected: use httpUrl or --transport http; url configures the older SSE transport.
  • Tools appear but calls return 401: discovery can be public. Confirm the key variable is available to the client and has not expired or been revoked.
  • Wrong server is used: keep distinct plainrouter-test and plainrouter names and name the intended one in your request.
References: Gemini CLI MCP configuration and settings variable expansion. Choose another client.