Gemini CLI MCP Setup
Connect MCPBundles MCP servers to Gemini CLI to use Google's AI assistant from the command line.
Requirements
- Gemini CLI installed (
npm install -g @google/gemini-clior similar) - An MCP server enabled in your MCPBundles dashboard
- Credentials connected for the providers on that MCP server
Time to complete: 2-3 minutes
Option A: CLI Setup (Recommended)
If you have terminal access, the fastest way to connect is via the MCPBundles CLI:
pip install mcpbundles
mcpbundles init
This automatically discovers your MCP servers, writes the Gemini CLI config, and handles authentication. No manual JSON editing needed.
After running mcpbundles init, restart Gemini CLI and your tools will be available.
Want more control? Use mcpbundles tools to browse available tools, or mcpbundles call <tool-name> to test a tool directly from your terminal.
Option B: Manual Setup
Step-by-Step Setup
1. Get your MCP server URL
- Log in to MCPBundles Dashboard
- Open the MCP server you want to connect
- Scroll to the "Quick Setup" section (only visible when the MCP server is operational)
- Copy the MCP Server URL
2. Configure Gemini CLI
Gemini CLI may auto-discover MCP servers or require manual configuration.
Check if Gemini CLI has an MCP configuration file (similar to Gemini Code).
If configuration file exists:
Edit it to add your MCP server (see Gemini Code Integration for format).
If auto-discovery:
Gemini CLI might discover MCP servers automatically if they're configured system-wide.
3. List Available MCP Servers
In Gemini CLI, run:
/mcp list
Your MCP server should appear in the list.
4. Authenticate When Prompted
The first time a tool is called that needs credentials:
- Gemini CLI will prompt for authentication
- Follow the OAuth flow or provide API key
- Credentials are stored for future use
5. Verify Tools Are Available
Ask Gemini:
What tools do you have access to?
Expected response: List of tools from your MCP server(s).
Using Tools in Gemini CLI
Once connected, Gemini can use your tools in command-line interactions.
Example Prompts
Data retrieval:
"Check my Smartlead campaigns and show the top 3 by reply rate"
GitHub operations:
"List my GitHub repos and tell me which ones have the most stars"
CRM tasks:
"Add John Doe (john@example.com) to HubSpot as a new contact"
Gemini will call the tools and display results in the terminal.
Troubleshooting
"/mcp command not found"
Cause: Outdated Gemini CLI or command not supported.
Fix:
- Update Gemini CLI to the latest release
- Check release notes for MCP support
MCP server doesn't appear in /mcp list
Cause: Configuration not loaded or file location wrong.
Fix:
- Check if config file exists at
~/.gemini/settings.json(or equivalent) - Verify the MCP server is added correctly
- Restart Gemini CLI
"Authentication required" when calling tools
Fix:
- Go to Settings → Credentials
- Scroll to the "Credentials" section
- Click "Add Credential" (or "Connect [Provider]" if no credentials exist) on needed providers
- Complete OAuth or add API key in the credential panel
- Select validation tool and click "Validate Now"
- Try the tool again in Gemini CLI
See Provider Credentials Guide.
Tools work but return empty data
Cause: Connected to wrong account or no data exists.
Fix:
- Settings → Credentials → find [Provider] and expand it
- Scroll to the "Credentials" section
- Check which account is connected
- If wrong, click "Edit" on the credential card
- In the credential panel, click "Connect with [Provider]" again and use correct account
- Re-validate the credential
- Verify data exists in the provider's app
Configuration Details
Gemini CLI likely uses the same config format as Gemini Code.
See: Gemini Code Integration for detailed config examples.
CLI-Specific Features
Scripting
You can pipe commands to Gemini CLI:
echo "List my Smartlead campaigns" | gemini
Useful for:
- Automation scripts
- Cron jobs
- CI/CD pipelines
Output Formats
Gemini CLI may support different output formats:
- Plain text (default)
- JSON (
--jsonflag) - Markdown (
--markdownflag)
Check gemini --help for available options.
Advanced Usage
Multiple MCP servers
Configure multiple MCP servers in ~/.gemini/settings.json:
{
"mcpServers": {
"marketing": {
"command": "npx",
"args": ["mcp-remote", "https://mcp.mcpbundles.com/bundle/abc123"]
},
"dev": {
"command": "npx",
"args": ["mcp-remote", "https://mcp.mcpbundles.com/bundle/def456"]
}
}
}
All tools from all MCP servers will be available in the CLI.
Environment-specific MCP servers
Use different MCPBundles MCP server URLs for different environments:
Production:
{
"mcpServers": {
"prod": {
"command": "npx",
"args": ["mcp-remote", "https://mcp.mcpbundles.com/bundle/prod-id"]
}
}
}
Staging:
Switch the config to use your staging MCP server URL.
Next Steps
- Browse MCP servers — Explore MCP servers
- Connect Credentials — Set up auth
- Troubleshooting — Fix issues
Need Help?
- Not working? See Troubleshooting
- Questions? Check the FAQ
- Support: Email help@mcpbundles.com