Gemini CLI MCP Setup: Add a Remote Server and Sign In
Add a remote MCP server to Gemini CLI with gemini mcp add, avoid the folder-trust and include-tools traps, sign in with /mcp auth and check a real call.
Tarun Khatri
Published · Updated · 6 min read
Gemini CLI MCP setup for a remote server takes one gemini mcp add command, a trusted folder and /mcp auth to sign in.
This guide adds Weir, so Gemini CLI can search X (Twitter) and read posts, threads and profiles. Weir only reads, so it never posts as you. We run Weir.
gemini mcp add --transport http -s user weir https://api.weirapp.io/mcp
Gemini CLI MCP setup: add Weir and sign in
Gemini CLI has its own MCP client, so you install nothing beyond a free Weir account.
- Add WeirRun the command above. -s user loads it in every project.
- Trust the folderStart gemini in your project and choose Trust folder.
- Sign inType /mcp auth weir, then approve Weir in your browser.
- Check itType /mcp. Weir should show as CONNECTED.
- Ask the free question"What's my Weir usage?" calls get_usage, which is free.
We ran it with Gemini CLI 0.65.0 on 22 October 2026, with no Google login. It wrote:
{
"mcpServers": {
"weir": { "url": "https://api.weirapp.io/mcp", "type": "http" }
}
}
Then gemini mcp list, first in an untrusted folder and then with trust set:
Warning: MCP servers are configured but disabled because this folder is untrusted.
○ weir: https://api.weirapp.io/mcp (http) - Disabled
✗ weir: https://api.weirapp.io/mcp (http) - Disconnected
Disconnected is normal before sign-in. Weir answers 401 until you sign in, and gemini mcp list never starts a sign-in. Gemini CLI's source tells you to run /mcp auth weir instead.
httpUrl or url? Gemini CLI MCP configuration keys
Use url with "type": "http", as the command writes it.
Gemini CLI's docs still say url means SSE and httpUrl means streamable HTTP. But its 0.65.0 source calls httpUrl deprecated, and both reach Weir.
Other keys, as Gemini CLI's docs spell them:
headerssends a key with each request, as the next section shows.timeoutis in milliseconds. The default is 10 minutes.trust: trueskips every confirmation. Leave it off: the prompt shows thelimit, which sets the cost.includeToolsandexcludeToolsfilter tools, andexcludeToolswins when a name is in both.
Gemini CLI MCP config with an API key
Use a key when no browser can open. Gemini CLI's docs say sign-in fails over SSH, in containers and in headless setups.
Create a key under API keys in your Weir dashboard, export it as WEIR_API_KEY, then:
gemini mcp add --transport http -s user -H 'Authorization: Bearer $WEIR_API_KEY' weir https://api.weirapp.io/mcp
Keep the single quotes. In our test, Gemini CLI saved Bearer $WEIR_API_KEY exactly as typed. Its docs say it fills in $VAR values when it loads settings, so the key never sits in the file. Double quotes let your shell paste the key itself.
In CI, trust the folder too. Gemini CLI's docs say a headless run in an untrusted folder exits with an error. Set GEMINI_CLI_TRUST_WORKSPACE=true or pass --skip-trust.
How do you limit Gemini CLI MCP tools?
Use includeTools with Weir's own tool names. Weir lists 44 tools on a default sign-in, Reddit included, and a shorter list leaves the model less to read.
gemini mcp add --transport http -s user weir https://api.weirapp.io/mcp --include-tools search_x get_x_thread get_usage
Gemini CLI shows the tools as mcp_weir_search_x and so on, but the filter takes the plain names. When a call needs approval, you can allow it once, allow that tool always, or allow the whole server.
Can Gemini CLI read X (Twitter)? A worked task
Yes. With Weir connected, Gemini picks the tool and its arguments itself.
Use Weir to find @GoogleDevs posts about Gemini from the last 30 days.
Skip reposts. Save them with likes and links to notes/gemini-news.md.
The tool it needs is mcp_weir_search_x, with fromUsers, query and since. X search returns reposts by default, so the agent should add -filter:nativeretweets to query.
Before a loop, check your ceiling. We ran the free get_limits call through Weir's MCP server on 22 October 2026:
→ get_limits {}
← 0 credits
tier: free · rateLimitPerMinute: 30 · maxMonitors: 1 · hourlySchedules: false
Thirty requests a minute is the free tier's cap. A faster loop gets 429, which is safe to retry after the stated wait. Weir's billing docs say a $5 purchase raises it to 120.
Weir bills 1 credit per call plus 1 per X post, and failed calls are free. Packs start at $5 for 25,000 credits and never expire, as of October 2026. See every rate on our pricing page.
Can you still use Gemini CLI?
Only on some plans. Google's developer blog says Gemini CLI stopped serving Google AI Pro, Ultra and free Code Assist users on 18 June 2026.
Enterprise Code Assist licenses keep it, and so do paid Gemini API keys. If your plan lost it, Google points you to Antigravity CLI, so follow our Antigravity MCP guide.
If it doesn't work
- Weir shows as Disabled. The folder isn't trusted. Run
/permissionsto change that. - "requires authentication using: /mcp auth weir". Run that command, then approve in your browser.
- The browser can't reach
localhost. The sign-in callback runs on your machine, so use the key setup over SSH. - Weir shows no tools. Check
includeToolsfor commas or themcp_weir_prefix. - Sign-in fails. We haven't tested Weir's sign-in inside Gemini CLI, since we didn't log in to Google. Use the key setup instead.
- A tool returns
402. Your Weir credits ran out, and retrying won't help. Add credits or wait for next month's grant.
When not to use Weir
- Gemini has to post or DM on X. Weir is read-only, so pick a tool with write access to your account.
- You want your private data. Weir reads public posts, not your bookmarks, DMs or home timeline.
- Price per post matters most. TwitterAPI.io lists $0.15 per 1,000 tweets as of October 2026, less than our $5 pack.
- You need a guarantee. Weir isn't licensed by X or affiliated with it, so access can change.
FAQ
How do I add an MCP server to Gemini CLI?
Run gemini mcp add --transport http <name> <url> for a remote server, or gemini mcp add <name> <command> for a local one. Add -s user to save it in ~/.gemini/settings.json. Without it, Gemini CLI writes .gemini/settings.json in the current project.
Where is the Gemini CLI MCP configuration?
Under mcpServers in settings.json. The user file is ~/.gemini/settings.json, and a project file at .gemini/settings.json overrides it. On managed machines, a system settings file overrides both.
How do I list MCP servers in Gemini CLI?
Run gemini mcp list in your shell, or /mcp inside a session, which lists tools too. gemini mcp remove <name> deletes an entry.
Can Gemini CLI post to X through Weir?
No. Weir only reads public X data, so nothing can post, like or follow through it. To post, you need a tool that holds your own X account's access.
Sources
- Gemini CLI v0.65.0 release (checked 22 October 2026): https://github.com/google-gemini/gemini-cli/releases/tag/v0.65.0
- Gemini CLI docs, MCP servers (checked 22 October 2026): https://github.com/google-gemini/gemini-cli/blob/v0.65.0/docs/tools/mcp-server.md
- Gemini CLI docs, configuration (checked 22 October 2026): https://github.com/google-gemini/gemini-cli/blob/v0.65.0/docs/reference/configuration.md
- Gemini CLI docs, trusted folders (checked 22 October 2026): https://github.com/google-gemini/gemini-cli/blob/v0.65.0/docs/cli/trusted-folders.md
- Gemini CLI source,
gemini mcp add(checked 22 October 2026): https://github.com/google-gemini/gemini-cli/blob/v0.65.0/packages/cli/src/commands/mcp/add.ts - Gemini CLI source, MCP client (checked 22 October 2026): https://github.com/google-gemini/gemini-cli/blob/v0.65.0/packages/core/src/tools/mcp-client.ts
- Google Developers Blog, "Transitioning Gemini CLI to Antigravity CLI", 19 May 2026 (checked 22 October 2026): https://developers.googleblog.com/an-important-update-transitioning-gemini-cli-to-antigravity-cli
- TwitterAPI.io pricing (checked 22 October 2026): https://twitterapi.io/pricing
- Weir docs, MCP: https://docs.weirapp.io/mcp
- Weir docs, errors and rate limits: https://docs.weirapp.io/errors
- Weir billing: https://docs.weirapp.io/billing
- Weir get_limits call, run 22 October 2026 (request 2391c62f-732e-49da-b998-30e007267a7e)