Supercharging Gemini CLI with MCP Servers- The Missing Manual


TL;DR: We’ll walk you step-by-step through installing, configuring, and using MCP servers to turn Gemini CLI into an AI-powered DevOps assistant. From creating files and directories to browsing GitHub and automating workflows — this guide has you covered.


🧠 What Are MCP Servers?

MCP stands for Model Context Protocol — a flexible, open protocol that allows Gemini CLI to connect to external tools, files, APIs, and systems.

Think of MCP servers as plugins or “tools” Gemini can access directly from your terminal.

With MCP servers, Gemini CLI can:

  • 🔍 Read and edit files in your repo
  • 🧱 Manage projects with structured prompts
  • 🧑‍💻 Automate directory creation, refactoring, or test generation
  • 🗃 Connect to GitHub, Supabase, Playwright, and more

🛠️ Before You Begin

Make sure you’ve already installed Gemini CLI. If not, read this guide: Click Here


🔰 Getting Started with MCP Support in Gemini CLI

Gemini CLI comes with /mcp commands to manage MCP servers:

Use the help command:

/help

To explore MCP support:

/mcp

You’ll see a message like in your case:

No MCP server configured. Please add one in .gemini/settings.json.

Configuration Options

Gemini CLI has two main ways to configure it:

User settings file:** ~/.gemini/settings.json – applies to all Gemini CLI sessions for the current user

- Access with: `vi ~/.gemini/settings.json`

Project settings file:** .gemini/settings.json – applies only to the specific project and overrides user settings

You can use the project settings for this setup since it’s the easier option.

⚙️ Setting Up Your First MCP Server

📁 Step 1: Create a .gemini folder in your project

mkdir .gemini
code .gemini/settings.json

This is a project-specific configuration and is preferred over the global ~/.gemini/settings.json for easier collaboration and isolation.


✍️ Step 2: Add Base Configuration

{
  "contextFileName": "GEMINI.md"
}

Then create the context file:

vi GEMINI.md

This file is where Gemini will maintain context for the session, like chat history or planning outputs.


🧩 Step 3: Install a MCP Server (Example: Firecrawl-mcp)

Update settings.json to include the MCP server:

{
  "mcpServers": {
   "firecrawl-mcp": {
      "command": "npx",
      "args": ["-y", "firecrawl-mcp"],
      "env": {
        "FIRECRAWL_API_KEY": "fc-28cea317ec2b454f9feb49c713328904"
      }
    },
   "servers": {
      "filesystem": {
        "command": "npx",
        "args": [
          "-y",
          "@modelcontextprotocol/server-filesystem",
          "${workspaceFolder}"
        ]
      }
    }
  }
}


🧪 Test Your MCP Setup

Restart Gemini CLI:

/quit
gemini

Now try these commands:

Command Description
/mcp Show MCP help and status
/mcp list List active servers
/mcp status Show connection status
/mcp tools List available tools from connected MCPs
/mcp desc Show server description and capabilities

✅ Example: Create a Folder Using Gemini CLI + Filesystem MCP

Prompt Gemini:

Create a folder named 'project-AiopsOne' in the current directory.

Gemini will ask for permission like:

Allow execution of MCP tool "create_directory" from server "filesystem"?
● Yes, allow once
○ Yes, always allow tool "create_directory"
○ No
────────────────────────────────────────────────────────────────────────╮
│  > Create a folder named 'project-AiopsOne' in the current directory.  │
╰────────────────────────────────────────────────────────────────────────╯

✦ I will create a folder named 'project-AiopsOne' in the current directory.
 ╭─────────────────────────────────────────────────────────────────────────────────────╮
 │ ✔  Shell mkdir project-AiopsOne (Create a new directory named "project-AiopsOne".)  │
 ╰─────────────────────────────────────────────────────────────────────────────────────╯
✦ I have created the directory.
 ╭──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
 │ ✔  Shell ls -F                                                                                                                               │
 │                                                                                                                                              │
 │    coindesk_2025-07-06.md                                                                                                                    │
 │    p1.py                                                                                                                                     │
 │    project-AiopsOne/                                                                                                                         │
 │                                                                                                                                              │
 ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
✦ Done.

$ ls -la

ℹ total 16
  drwxr-xr-x   5 jay  staff   160 Jul  8 20:06 .
  drwxr-xr-x  49 jay  staff  1568 Jul  6 14:26 ..
  -rw-r--r--@  1 jay  staff  3816 Jul  6 14:56 coindesk_2025-07-06.md
  -rw-r--r--@  1 jay  staff    20 Jul  8 19:27 p1.py
  drwxr-xr-x@  2 jay  staff    64 Jul  8 20:06 project-AiopsOne
  

Once confirmed, Gemini will run the tool and create the folder.

You can also use:

  • read_file
  • write_file
  • list_directory
  • delete_file

All via prompts!


🧠 Best Practices

  • Use project-level config for safety and team sharing
  • Only expose controlled directories to Filesystem MCP
  • Store your contextFileName (GEMINI.md) in version control for repeatable agent behavior

🧰 Top MCP Servers to Try Next

MCP Server What It Does
server-filesystem File editing, directory creation, file reading/writing
server-github Browse and search live GitHub repos
server-supabase Connect Gemini to your database
server-playwright Automate the browser via CLI
server-sequential Plan step-by-step complex tasks

👉 MCP list: ModelContextProtocol GitHub


🧯 Troubleshooting

Problem Solution
MCP doesn’t show in /mcp tools Check path and JSON format in settings.json
Server status: disconnected Ensure correct working directory and restart Gemini
Commands not working Run /mcp status and check for errors

🔐 Security Reminder

  • Never expose root / or ~/ to filesystem MCP
  • Avoid sharing .gemini/settings.json if it includes sensitive paths
  • Use “env” block to provide secure tokens via environment variables

🎯 Final Thoughts

MCP servers turn Gemini CLI into an agent-native command-line powerhouse.

You can now:

  • 🧑‍💻 Refactor code by prompt
  • 🗃 Access and manage files
  • 🧠 Automate tasks with reasoning

Once you set up one MCP server, it becomes easier to add more — and suddenly Gemini is no longer just a CLI, it’s a coding agent.