Gemini CLI Security for Beginners: Extensions & MCP Integration (as of 01 Aug 2026)
A note on this guide. This is a snapshot of what was true as of 01 Aug 2026 — a permanent, frozen archive page that will never be silently edited later (a future update would be a brand-new dated page). It’s a plain-language rewrite of a technical entry that was already fact-checked by a 3-lens review panel (a skeptic, a beginner reader, and someone checking dates and version numbers) plus a senior reviewer. This version doesn’t change any fact — only the words, so someone brand new to AI tools and to MCP can follow along.
Before you start: what is an MCP server?
- MCP stands for Model Context Protocol. It’s a shared standard that lets an AI agent — like Gemini CLI — plug in outside tools.
- Think of an MCP server as a plug-in. It’s a small program that gives Gemini CLI a new ability it didn’t have before: reading a database, calling a web API, or running commands on your computer.
- Here’s the important part: an MCP server acts on the model’s behalf. If that plug-in is malicious, or if someone breaks into it, it can do anything you’ve allowed it to do — on your real computer — without you ever writing that code yourself.
- A Gemini CLI extension is just a bundle: a package that ships one or more MCP servers together with some custom commands, so you can install several plug-ins at once.
- Before any of this works, you need Gemini CLI installed. Run this one command in your
terminal (you’ll need Node.js installed first):
npm install -g @google/gemini-cli
Keep that idea in mind for the rest of this guide: every MCP server and every extension is code that can act for you. Everything below is about controlling how much you trust that code, and how much power you hand it.
How to read the labels
- ✅ independently-corroborated — confirmed by 2 or more separate, unrelated sources
- 📄 vendor-documented — comes only from Google’s official docs (trustworthy, but one source)
- ⚠️ WARNING — a default that could cost you money, break your machine, or remove a safety net
- 🕒 verify live — this changes fast (version numbers, limits); check the current value
Practice: Never turn on trust: true or --yolo unless you personally control that server
Do: Leave MCP servers set to trust: false — that’s the default — so Gemini CLI always asks
you to confirm before it runs a tool. Only switch a server to trust: true if you wrote it
yourself and it runs on your own machine. Here’s what that looks like as a complete, working
command:
gemini mcp add my-internal-server --trust --url http://localhost:8080
Never use --yolo (Gemini CLI’s “auto-approve everything, don’t ask” mode) on any machine that
ever touches untrusted input — including a build/CI server.
Why (beginner): trust: true tells Gemini CLI “don’t ask me, just run whatever this server’s
tools want to do” — including shell commands, file writes, or sending data over the network —
with no chance for you to say no. Google’s own documentation says to use it “cautiously and only
for servers you completely control.” Here’s what goes wrong when that’s ignored: Google shipped a
version of --yolo that silently ignored the fine-grained list of tools a user had approved, and
combined with a second bug — automated (CI) mode auto-trusting whatever folder it was pointed at
— this became a maximum-severity bug. It let an attacker who could simply open a public GitHub
issue reach full code execution on a company’s CI servers. Google fixed it in @google/gemini-cli
version 0.39.1 and the run-gemini-cli GitHub Action version 0.1.22 (24 Apr 2026). It’s now
tracked as CVE-2026-12537 (officially published 24 Jun 2026 — two vulnerability databases,
NVD and CIRCL, confirm this is the same bug referenced elsewhere as GHSA-wpqr-6v78-jr5g, even
though the original write-ups from April predate the CVE number being assigned).
Caveat / contested: 🕒 verify live — check you’re on a version at or after the 24 Apr 2026
fix (0.39.1 / 0.1.22). Security researchers disagree on exactly how severe this bug was: Google’s
own team scores it 10.0 out of 10, the maximum (using the CVSS 4.0 scoring system); the
independent NVD database scores it lower, 7.8 out of 10 — “HIGH” but not maximum (using the older
CVSS 3.1 scoring system). Separately, this wasn’t the only trust-related bug found recently —
Pillar Security’s “Week of Sandbox Escapes” research (20–23 Jul 2026) found a new Docker-related
escape in Gemini CLI (since fixed) and a still-unpatched bypass in Google’s separate Antigravity
tool. One more detail worth knowing: an extension’s own config file cannot set trust: true for
itself — only your personal settings.json can do that — so a malicious extension can’t quietly
grant itself no-confirmation mode on its own. But if you set trust: true yourself for that
extension’s server, that protection disappears.
Sources: Gemini CLI docs — MCP servers (fetched 01 Aug 2026) · GBHackers — Critical Gemini CLI Flaw Raises Supply Chain Security Concerns (27 Apr 2026) · Pillar Security — My Agentic Trust Issues (5 May 2026) · NVD — CVE-2026-12537 (CVSS scoring dispute + CVE↔GHSA link) · GitHub Advisory Database — GHSA-wpqr-6v78-jr5g · Pillar Security — The Week of Sandbox Escapes (Jul 2026)
Confidence: independently-corroborated
Practice: Don’t assume “Trusted Folders” is protecting you — check it yourself, and read the popup
Do: Google’s own documentation contradicts itself about whether the “Trusted Folders” safety
feature is on or off by default — don’t just assume either way. When Gemini CLI shows you a
first-time popup asking whether to trust a new folder, actually read what it lists (any MCP
servers, custom commands, and other things that folder would activate) before clicking “Trust
folder.” Don’t click “Trust parent folder” (which trusts everything above it too), and don’t
trust a folder just because the popup is annoying — especially not on a computer that also runs
automated jobs against code you didn’t write yourself. If you never see this popup at all, that’s
a sign the feature might already be on for you by default — check the /permissions command, and
if you want to be sure the popup is active, explicitly turn it on by setting
"security": {"folderTrust": {"enabled": true}} in your settings.
Why (beginner): In a folder Gemini CLI doesn’t trust, it refuses to auto-connect to MCP
servers, blocks installing extensions, and makes you approve every tool call by hand. This is
your safety net against a folder — or someone else’s code you’re reviewing — that secretly ships
a poisoned config file or a malicious MCP server definition. The CVE from the practice above
happened specifically because automated (“headless”) mode skipped this exact safety check and
auto-trusted whatever folder it was pointed at, loading a malicious hidden config file before any
protection could kick in.
Caveat / contested: This mainly protects you when you’re using Gemini CLI directly, sitting
at the keyboard. The bug above was in automated/CI mode, which skipped this check entirely — so
an automated pipeline needs the fixed software version, not just correct trust settings. You need
both: the right settings AND an up-to-date version.
Sources: Gemini CLI docs — Trusted Folders (fetched 01 Aug 2026) · github.com/google-gemini/gemini-cli — docs/cli/trusted-folders.md (“disabled by default” — contradicts the settings-reference table’s stated true default; fetched 01 Aug 2026) · The Hacker News — Google Fixes CVSS 10 Gemini CLI CI RCE and Cursor Flaws Enable Code Execution (30 Apr 2026) · Cloud Security Alliance Labs — Gemini CLI CVSS 10.0: RCE in AI Developer Tools (2 May 2026)
Confidence: independently-corroborated
Practice: Treat every extension as unchecked code — even Google’s own — and look before you install
Do: Before you run an install command like this complete example:
gemini extensions install https://github.com/gemini-cli-extensions/security
open that GitHub repository first. Skim its gemini-extension.json file (what tools or servers
does it add?) and any bundled program source, especially if it will process things you don’t
control — GitHub issues, pull requests, web pages. Don’t assume something is safe just because it
looks official or was written by Google.
Why (beginner): Google’s own extension gallery warns that it does not vet, endorse, or
guarantee the security of anything listed there, and tells users to “carefully inspect any
extension and its source code before installing.” This isn’t just cautious wording — it’s
happened. Google’s own official “security” extension (which is supposed to scan pull requests for
vulnerabilities) shipped with a bug called “prototype pollution” — a type of JavaScript bug where
crafted input corrupts a shared template that other code relies on, letting an attacker’s data
quietly override how unrelated code behaves. A pull request containing just the single word
“constructor” in the right spot could trigger it (researchers scored this bug 7.1 out of 10 for
severity, catalogued as CWE-1321, a standard reference number for this class of bug). Researchers
escalated it into running arbitrary commands, and even used it to hide their findings from the
very tool meant to catch them. Google fixed it by changing how the code stores data (merged 15
Oct 2025), but the bug wasn’t publicly written up until five months later, in March 2026. The
lesson: extension code runs with full power on your machine the moment you install it — an
official label doesn’t change that.
Caveat / contested: We could only find one independent write-up of this specific bug (plus
Google’s own fix commit, which confirms the bug existed but isn’t a second independent security
review). So we’re labeling this “thin” evidence rather than “well-corroborated,” to be honest
about how solid the sourcing actually is.
Sources: Gemini CLI Extensions Gallery (fetched 01 Aug 2026) · Symbiotic Security — Who Scans the Scanners? Uncovering a Critical Bug in Gemini’s Security CLI (13 Mar 2026) · gemini-cli-extensions/security PR #91 (merged 15 Oct 2025)
Confidence: thin
Practice: Add an explicit block-list for dangerous actions — don’t rely on the popup alone
Do: In your settings file, you can list specific dangerous actions you never want Gemini CLI to even offer, for example:
"excludeTools": ["run_shell_command(rm -rf *)"]
Add this in addition to — not instead of — leaving trust: false on. You can also limit what
each individual MCP server is allowed to do, using includeTools / excludeTools per server.
Why (beginner): A confirmation popup only protects you if you read it carefully every single
time. When you’re in a hurry, it’s easy to click “yes” on something destructive — like a command
that deletes files — without really reading it. excludeTools removes the option entirely, so
there’s no popup left to accidentally click through.
Caveat / contested: This pattern is described only on Google’s own documentation pages — we
didn’t find independent security research testing how well it actually holds up against a
determined malicious server (in theory, a compromised server could rename its own tool to dodge
your block-list pattern).
Sources: Gemini CLI docs — Extensions best practices (fetched 01 Aug 2026) · Gemini CLI docs — MCP servers (fetched 01 Aug 2026) · Gemini CLI docs — Extension reference (fetched 01 Aug 2026)
Confidence: vendor-documented
Practice: Don’t paste real API keys straight into an MCP server’s config file
Do: Don’t write a real API key or password as literal text inside an MCP server’s env
section in your settings file, unless you genuinely mean to hand that exact value to that exact
server. Instead, reference your own terminal’s environment, like "MY_KEY": "$MY_KEY", so the
real secret lives only in your terminal — not in a config file that could get shared, backed up,
or committed to a repository. Remember: the moment you explicitly name a variable this way,
Gemini CLI treats that as your informed permission and skips the automatic protection described
below.
Why (beginner): Gemini CLI automatically hides (“redacts”) variables with names matching
patterns like *TOKEN*, *SECRET*, *PASSWORD*, *KEY*, *AUTH*, *CREDENTIAL*,
GEMINI_API_KEY, and GOOGLE_API_KEY, before passing your environment to MCP servers and
extensions. That’s a good safety net — but it switches off the instant you explicitly list one of
those variables for a specific server. Extensions also don’t automatically see your whole
terminal environment; only variables you’ve allowed through reach them, which is a second safety
net — but again, one you can accidentally switch off yourself without realizing it. What goes
wrong if you ignore this: a real secret sitting in plain text in a config file can leak the
moment that file gets shared, backed up, or pushed to a public repository.
Caveat / contested: This is described only in Google’s own documentation; we couldn’t find
independent security research specifically testing this protection for ways around it.
Sources: Gemini CLI docs — MCP servers (fetched 01 Aug 2026) · Gemini CLI docs — Extension reference (fetched 01 Aug 2026)
Confidence: vendor-documented
Practice: ⚠️ Don’t use underscores in MCP server names — it can silently break your security rules
Do: When you name an MCP server in your settings file, use dashes, not underscores — write
my-server, not my_server.
Why (beginner): Gemini CLI’s own documentation warns that an underscore in a server name
confuses the part of the software that matches names against rules, and this “can cause wildcard
rules and security policies to fail silently.” In plain words: a security rule you think is
protecting you might quietly not be applied at all — and nothing tells you it failed. That’s what
makes this dangerous: it doesn’t throw an error message. It just quietly doesn’t work.
Caveat / contested: This comes from one source only (Google’s own documentation) and hasn’t
been independently confirmed elsewhere. But it costs nothing to follow — it’s just a naming
choice — so it’s worth doing even though it’s unverified.
Sources: Gemini CLI docs — MCP servers (fetched 01 Aug 2026)
Confidence: thin
Practice: Treat anything an MCP tool tells you (or its own description) as untrusted
Do: Assume that any text an MCP tool sends back — or even text baked into how the tool describes itself — could secretly contain instructions aimed at the AI model, not at you. This is called “tool poisoning” or indirect prompt injection: a malicious or hacked MCP server hides instructions inside what looks like ordinary data, and the model — which can’t reliably tell the difference between data and instructions — may just follow them. Be extra careful with any MCP server that reads content you don’t control, like GitHub issues, pull requests, web pages, or emails, and then feeds the results back to the model. Why (beginner): This has actually happened to Gemini CLI. Independent researchers (a study called “Comment and Control,” published 15 Apr 2026) showed they could hijack Gemini CLI — plus Claude Code and GitHub Copilot — just by hiding malicious instructions inside GitHub issue text, pull-request titles, and comments that the AI agent read as part of its normal work. In vulnerable setups, this led to CI secrets being stolen. Separately, a different reported flaw let instructions hidden inside a repository’s README file get carried out as if they were commands the user had typed themselves (fixed in Gemini CLI version 0.1.14, 25 Jul 2025). This general category of attack — “tool poisoning” — is a known risk across the whole MCP ecosystem, not something unique to Gemini CLI. Caveat / contested: We couldn’t find documentation or independent research saying whether Gemini CLI’s interface actually warns you when a tool description looks suspicious, the way some other AI tools do. Treat that specific question as unresolved — we found no evidence either way. Sources: Aptible — Prompt Injection in MCP: Tool Poisoning and Blast Radius (fetched 01 Aug 2026) · CSO Online — Google patches Gemini CLI tool after prompt injection flaw uncovered (29 Jul 2025) · SecurityWeek — Claude Code, Gemini CLI, GitHub Copilot Agents Vulnerable to Prompt Injection via Comments (15 Apr 2026, “Comment and Control” research) · Cloud Security Alliance Labs research note (2 May 2026) Confidence: contested
Practice: Only install Gemini CLI from the official npm package or Google’s own docs — never from a search result
Do: Install with this exact command, typed by hand rather than copy-pasted from a random blog or advertisement:
npm install -g @google/gemini-cli
Only use another install method if it’s linked directly from Google’s own documentation. Never
paste a one-line “installer” command from a page you found by searching, without first checking
that the web address is genuinely Google’s.
Why (beginner): Between roughly March and May 2026, attackers ran a fake-website campaign
that got malicious lookalike sites (for example, geminicli[.]co[.]com) to rank above the real
Gemini CLI documentation in search results. Here’s the trick: the fake page’s copy-paste command
really did install the genuine, uncompromised Gemini CLI from npm — so nothing looked wrong. But
it also quietly ran a hidden PowerShell program in the background that stole browser cookies,
login tokens, CI/CD credentials, and VPN keys. This particular attack targeted how you install the
base tool, not the extension system — but it’s the exact same habit you need for vetting
extensions: never blindly run code from a source you haven’t checked yourself.
Caveat / contested: This specific campaign targeted the base installer, not the extension
marketplace directly. Also, one of our two sources says openly that it’s reporting on someone
else’s research rather than doing its own independent investigation — so even though it’s two
different publishers, it’s really one finding reported twice, not two separate confirmations. This
is why we’re labeling it “thin” rather than “well-corroborated.”
Sources: EclecticIQ — SEO poisoning campaign leverages Gemini and Claude Code impersonation to deliver infostealer (21 May 2026) · GBHackers — Hackers Use SEO Poisoning to Fake Gemini CLI, Claude Installers (23 May 2026, derivative of EclecticIQ’s research per its own text)
Confidence: thin
If you’re a team/org admin (optional — skip this if you’re an individual user)
The technical version of this entry includes one more practice about organization-wide MCP-server allowlists, managed through Google’s admin console. That practice is genuinely useful — but only if you administer Gemini CLI for a company or team. It requires enterprise/admin access most individual beginners won’t have, so it’s left out of this beginner version. If that applies to you, read the full technical entry for that practice, its worked example, and its sources.
Still being checked (not fully confirmed yet)
- Whether Gemini CLI’s interface shows a warning when a tool description looks suspicious, the way some other AI tools do — Google’s own docs don’t say either way, and the one academic study that tested this couldn’t be accessed to verify its claims. ⚠ #TBD
- We didn’t find any report of an actual malicious (not just buggy) non-Google Gemini CLI extension — the one concrete bug we found (prototype pollution in Google’s own “security” extension) was in a Google-authored extension, not a random third party’s. This kind of risk is plausible and matches Google’s own warning about not vetting extensions, but it isn’t a documented real-world incident yet. ⚠ #TBD
CHANGELOG (grading → this entry)
- Re-leveled from the graded 2026-08-01 technical entry
(
best-practices/gemini-cli-extensions-mcp-security/2026-08-01) for readers brand new to AI tools and to MCP. Facts, commands, dates, version numbers, and sources are unchanged — only the wording, structure, and reading level changed. See that entry’s own CHANGELOG for the original grading corrections this rewrite inherits. - Dropped as too advanced: the enterprise/admin MCP-server-allowlist practice. Its own caveat in the technical entry says it’s “an enterprise-tier feature, not something most individual/beginner users will touch,” so it’s summarized in an “if you’re an admin” note instead of given as a full practice; its sources were not carried into this entry along with it, per Translator rules (no source is stripped from a practice that’s kept — this one wasn’t kept as a full practice).
- Kept all 7 remaining practices, every ⚠️ WARNING, the top-of-entry MCP definition (simplified
further into a bulleted explainer), the
gemini mcp add ... --trustworked example, thegemini extensions install <github-url>worked example, and the install prerequisite note — all carried over with the same facts as the technical entry. - Simplified language throughout, defined jargon on first use, and added plain-language “what goes wrong” framing to each practice’s “Why” section. No new facts, commands, dates, or URLs were introduced anywhere in this rewrite.