Gemini CLI
Add Thirdfy MCP to Gemini CLI with one command and sign in with /mcp auth, or use an agent key header.
Add Thirdfy to Gemini CLI so it can read markets and act for your agent from your terminal. Gemini CLI connects to Thirdfy as a remote streamable HTTP MCP server. See Gemini CLI's MCP servers docs.
1. Add the server
The quickest way is to add the server and sign in with your Thirdfy account:
--scope user saves it in ~/.gemini/settings.json for every project. Without it, Gemini CLI saves it in the project's .gemini/settings.json.
- Start Gemini CLI and run
/mcp auth thirdfy. Your browser opens the Thirdfy sign-in page. - Sign in with the same method you use on thirdfy.com (email, Google or wallet).
- Pick the agent Gemini acts for, or click + Create a new agent.
- Choose access: Read (always), Trade within your agent's limits, and Stay connected (up to 30 days). Click Approve.
/mcp then shows thirdfy as connected, with its tools. You're done: skip to Try it. Manage or revoke the connection at auth.thirdfy.com/connections. For what a signed-in app can do, see Connect.
Using an agent key instead? Sections 2 and 3 are for a setup that runs as the agent with its API key, such as CI or a headless machine.
To look around first with no account, add the public connection: gemini mcp add --transport http thirdfy-public https://mcp.thirdfy.com/mcp/public.
2. Create an agent key
Open thirdfy.com/connect, go to Agent key, pick the agent and click Create a key. The key (agent-...) is shown once, so store it right away.
3. Add your key as a header
Keep the key in an environment variable and reference it from settings.json. Gemini CLI expands $VAR and ${VAR} when it loads the file:
Use httpUrl, not url: url is for the older SSE transport. Export AGENT_API_KEY before you start Gemini CLI. Don't paste the key into prompts.
To limit the tools Gemini sees, add "includeTools": ["getProviderActions", "getVenueReadiness", "agentRun"] to the server. Leave trust off, so Gemini asks before each tool call.
4. Try it
Before a write:
getVenueReadinesslists anything that blocks the venue.- Preview the action with
previewOrder. - Run it with
walletExecute.
Thirdfy refuses any write that fails its checks (allowlist, daily limit, venue readiness, credits).
Troubleshooting
| Issue | Fix |
|---|---|
gemini mcp list shows Disconnected | Check the URL is https://mcp.thirdfy.com/mcp and the key is httpUrl |
401 Authentication required | Run /mcp auth thirdfy again, or add the Authorization: Bearer agent-... header (step 3) |
| Sign-in ended | Sign-ins last up to 30 days with Stay connected. Run /mcp auth thirdfy again |
Writes return insufficient_scope | You granted Read only. Run /mcp auth thirdfy and tick Trade |
Empty Bearer header | AGENT_API_KEY is not set. Export it and restart Gemini CLI |
AGENT_IDENTITY_MISMATCH | The model passed a different key in arguments. The header key is used |