Let me start with the bottom line: once you connect MCP servers to Gemini CLI, tasks like reading local files, querying a database, and managing GitHub repositories become natural parts of your conversation — no context-switching required.
I first felt this shift while analyzing user behavior logs stored in a local SQLite database. Previously, I'd write a Python script, load it with pandas, format the output… With Gemini CLI hooked up to an MCP server, I could just ask "which steps had the highest drop-off last week?" and get a real answer — from actual data.
What MCP Is and Why It Matters for Gemini CLI
MCP (Model Context Protocol) is an open standard introduced by Anthropic that defines a common communication layer between AI models and external tools. Think of it as "USB for AI agents" — once a tool implements an MCP server, any MCP-capable client (Claude Code, Gemini CLI, etc.) can use it through the same interface.
Gemini CLI added official MCP client support in early 2026. Configuration lives in a GEMINI.md file at your project root, so you can manage which MCP servers are active on a per-project basis without touching any global settings.
For a detailed comparison with Claude Code's approach, see Gemini CLI vs Claude Code: An Honest 2026 Comparison.
Configuring MCP Servers in GEMINI.md
All MCP configuration for Gemini CLI goes into a GEMINI.md file at the root of your project. Here's the basic format:
# MCP Servers
## filesystem
- command: npx
- args: ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/project"]
## sqlite
- command: npx
- args: ["-y", "@modelcontextprotocol/server-sqlite", "--db-path", "./data/app.db"]After saving, start gemini and the defined MCP servers launch automatically. Run /tools inside the session to confirm they're registered and available.
One thing to remember: server-specific flags like --db-path go at the end of the args array. Relative paths work fine and are recommended for repositories shared across a team.
filesystem MCP: Automate Everyday File Tasks
The @modelcontextprotocol/server-filesystem package is the best place to start. It gives Gemini CLI read/write access to directories you specify.
# MCP Servers
## filesystem
- command: npx
- args: [
"-y",
"@modelcontextprotocol/server-filesystem",
"./src",
"./docs"
]With this config, ./src and ./docs are accessible. Then just ask:
> Write tests for src/components/Button.tsx and save them to src/components/Button.test.tsx
✓ Reading Button.tsx...
✓ Generating test file...
✓ Written to src/components/Button.test.tsx
Because Gemini actually reads the source file before generating tests, the output reflects real props and type definitions — not guesses. The old "paste your code then ask for tests" workflow disappears entirely.
Security note: Always restrict the filesystem MCP paths to project subdirectories. Passing / or ~ as a root exposes your entire filesystem. Treat MCP path config the same way you'd treat file permission settings.
SQLite MCP: Query Your Local Database in Plain Language
Connecting a local SQLite database via MCP lets you work with real data without writing a single SQL statement.
## sqlite
- command: npx
- args: ["-y", "@modelcontextprotocol/server-sqlite", "--db-path", "./data/app.db"]> Describe the users table structure, then count new signups from last week
◎ Tables: users, sessions, events
◎ users schema:
- id: INTEGER PRIMARY KEY
- email: TEXT NOT NULL
- created_at: TIMESTAMP DEFAULT CURRENT_TIMESTAMP
...
◎ New signups (2026-04-27 to 2026-05-03): 247
- Mobile: 183 (74.1%)
- Web: 64 (25.9%)
The result isn't a guess — Gemini reads the actual schema and runs a real query. This makes exploratory analysis before writing application code much faster.
Where I personally find this most useful is schema migration impact checks. "How many records have a null status column?" used to require me to remember the table structure and write the query myself. Now it's a sentence.
For more advanced API-level MCP patterns, check out Gemini × MCP Server Integration Guide.
GitHub MCP: Code Review and Issue Management Without Leaving the Terminal
The GitHub MCP server brings repository operations directly into your Gemini CLI session.
## github
- command: npx
- args: ["-y", "@modelcontextprotocol/server-github"]
- env:
GITHUB_TOKEN: "${GITHUB_TOKEN}"Set GITHUB_TOKEN to a Personal Access Token with repo scope. Then:
> Summarize this week's merged PRs, sorted by size of change
◎ Merged PRs this week (2026-04-28 to 2026-05-04): 12
1. #347 - feat: search refactor (+1,240/-892 lines)
Author: @dev-alice | Reviewers: @dev-bob, @dev-carol
2. #352 - fix: mobile nav layout regression (+87/-43 lines)
...
Before your weekly team sync, asking "summarize this week's releases" takes seconds and gives you everything you need for a standup or retrospective. That alone halved the time I spend preparing those summaries.
If you want to build a custom MCP server for your own tooling, the Gemini API Custom MCP Server TypeScript Guide walks through the full implementation.
Combining Multiple MCP Servers for Complex Workflows
You can run multiple MCP servers simultaneously. This is where the real leverage shows up — when a task spans tools.
# MCP Servers
## filesystem
- command: npx
- args: ["-y", "@modelcontextprotocol/server-filesystem", "./src", "./tests"]
## sqlite
- command: npx
- args: ["-y", "@modelcontextprotocol/server-sqlite", "--db-path", "./data/dev.db"]
## github
- command: npx
- args: ["-y", "@modelcontextprotocol/server-github"]
- env:
GITHUB_TOKEN: "${GITHUB_TOKEN}"With all three active, a prompt like "read the DB schema, generate TypeScript types for each table, and write type tests to tests/" runs as a single conversation. Gemini reads the schema, generates the types, writes them to disk, and creates the test file — without you switching context once.
One practical note: MCP servers require Node.js 18 or newer. The first run with npx -y will download the package automatically, adding a few seconds of startup time. For CI pipelines, pre-installing the packages is worth the setup effort.
Managing GEMINI.md Across Projects and Teams
One question that comes up quickly once you start using MCP in Gemini CLI: how do you manage GEMINI.md files cleanly when you work across multiple repositories or with a team?
The short answer is to commit GEMINI.md to your repository, just like you would an .eslintrc or .prettierrc. The file documents which external tools the project expects, and new contributors benefit from seeing that context immediately.
For environment-specific values like GITHUB_TOKEN, never hardcode the actual token in GEMINI.md. Use the ${VARIABLE_NAME} interpolation syntax and document the required variables in your README or .env.example. This keeps secrets out of version control while still making the configuration self-documenting.
If you work on multiple projects, you may want different MCP configurations per project rather than a single global setup. Gemini CLI respects the GEMINI.md in the directory where you launch it, so each repository carries its own configuration independently. A monorepo can even have different configurations at different subdirectory levels if you need that granularity.
One pattern I use on solo projects: keep a GEMINI.md.example file in the repo with placeholder paths and token references, and have each developer copy it to GEMINI.md (listed in .gitignore) with their local paths filled in. This avoids absolute-path mismatches between machines while keeping the template visible to everyone.
Common Setup Issues and How to Fix Them
"Tools aren't showing up": Check your GEMINI.md indentation. The YAML-like format is strict about two-space indentation — a single off-by-one space can silently break parsing. If you see MCP server failed to start in the Gemini CLI startup log, the config file is the first place to look.
"Permission denied reading files": Verify that the path you passed to filesystem MCP actually exists and that the user running Gemini CLI has read permission. A quick ls -la ./src will tell you everything you need.
"I don't want Gemini writing to my database": Add --readonly to the SQLite MCP args: ["-y", "@modelcontextprotocol/server-sqlite", "--db-path", "./data/app.db", "--readonly"]. This restricts the server to SELECT queries only, which is the right default for analytics use cases.
For broader Gemini CLI troubleshooting, the Gemini CLI Error Troubleshooting Guide covers common failure modes in detail.
Start with filesystem MCP Today
The setup is simpler than it looks. If npx works on your machine and you have a project with a src/ directory, you're three lines of GEMINI.md away from having Gemini CLI read your codebase in real time.
Create a GEMINI.md at your project root, add the filesystem MCP pointing at ./src, and ask Gemini to list all the files. Watching it enumerate your project structure through MCP rather than from a paste makes the capability immediately tangible. From there, which tools to connect next — a local database, a GitHub repo, an internal API — tends to become obvious on its own.