Menu

AI

Gemini CLI MCP Server Disconnected or Not Working: How to Fix It (Gemini CLI)

Fix Gemini CLI MCP servers that show Disconnected, find no tools or lose API keys. Covers url vs httpUrl, folder trust, env redaction, OAuth and /mcp list.

By: Irina ShvayaNovember 2, 2026

Gemini CLI MCP Server Disconnected or Not Working: How to Fix It (Gemini CLI)

This fix is part of MCP troubleshooting, within The MCP Guide. Still stuck? Request a free MCP readiness review.

When a Gemini CLI MCP server shows Disconnected, the cause is usually the transport key, folder trust, or an environment variable the CLI stripped out. The fastest fix is to run /mcp list (or gemini mcp list from your shell) to see the real error, make sure a Streamable HTTP server uses httpUrl rather than url, and run gemini trust in the folder if a local server is involved.

Checked against: Google's MCP servers with Gemini CLI documentation and the Google Developers Blog post on the move to Antigravity CLI, read on 2 November 2026. The latest @google/gemini-cli package on npm was 0.66.0 that day. eSEOspace did not run these steps on your setup.

Key Takeaways

  • In settings.json, httpUrl is for Streamable HTTP and url is for SSE. Using the wrong key is a common reason a remote server never connects.
  • Local stdio servers show Disconnected in gemini mcp list when the current folder is untrusted. Run gemini trust.
  • Gemini CLI redacts host environment variables matching patterns like *TOKEN*, *KEY* and *SECRET*. Pass the ones a server needs in its env block.
  • Errors from background servers are "silent by default." You see one hint, MCP issues detected. Run /mcp list for status.
  • Google says Gemini CLI stopped serving Google AI Pro, Ultra and free individual users on 18 June 2026. Those users now need Antigravity CLI.

What this error means

Gemini CLI tracks each server as DISCONNECTED, CONNECTING or CONNECTED. The docs say DISCONNECTED means the server "is not connected or has errors." It also closes connections to servers that "provide no usable tools," so a server that starts but lists zero tools also ends up disconnected.

Before you debug the server, check you can still use Gemini CLI at all. Google's blog post dated 19 May 2026 says Gemini CLI and Gemini Code Assist IDE extensions stop serving requests on 18 June 2026 for Google AI Pro and Ultra, and for free use through Gemini Code Assist for individuals. Gemini Code Assist Standard and Enterprise users keep access, and paid Gemini API keys still work. If your sign-in fails for every request, not only MCP, this is the likely reason.

Quick fix

  1. Run gemini mcp list in your shell. It shows each server's status, for example ✗ sse-server: https://api.example.com/sse (sse) - Disconnected.
  2. For a remote server, check the transport key. Streamable HTTP uses httpUrl. SSE uses url.
  3. For a local server, run gemini trust in the project folder.
  4. Run the server's command by hand in a terminal to confirm it starts.
  5. Add any API key the server needs to its env block explicitly.
  6. Restart Gemini CLI and run /mcp to confirm tools are listed.

A correct remote entry, checked against Google's docs on 2 November 2026:

{
  "mcpServers": {
    "my-remote": {
      "httpUrl": "https://api.example.com/mcp",
      "headers": { "Authorization": "Bearer YOUR_TOKEN" },
      "timeout": 30000
    }
  }
}

Or from the shell:

gemini mcp add --transport http --header "Authorization: Bearer abc123" my-remote https://api.example.com/mcp/

Fix by client / OS

Gemini CLI: wrong transport

The docs define three mutually exclusive keys: command for stdio, url for an "SSE endpoint URL," and httpUrl for an "HTTP streaming endpoint URL." Many vendors now publish only a Streamable HTTP endpoint ending in /mcp. Put it under url and the CLI tries SSE against it. The gemini mcp add default transport is stdio, so pass --transport http for a URL. Our SSE deprecation guide explains why SSE endpoints are disappearing.

Gemini CLI: untrusted folder

Google's docs note that stdio servers "are only tested and displayed as 'Connected' if the current folder is trusted. If the folder is untrusted, they will show as 'Disconnected'." Run gemini trust in a folder you have reviewed.

Gemini CLI: API keys not reaching the server

Gemini CLI sanitizes the environment it passes to MCP servers. By default it redacts GEMINI_API_KEY, GOOGLE_API_KEY and variables matching *TOKEN*, *SECRET*, *PASSWORD*, *KEY*, *AUTH* and *CREDENTIAL*. A server that reads GITHUB_TOKEN from your shell will not see it. Name it in the server's env block instead:

"env": { "GITHUB_TOKEN": "$GITHUB_TOKEN" }

The docs add that an undefined variable "resolves to an empty string," so check spelling. For other clients, see MCP env variables not passed.

Gemini CLI: OAuth sign-in fails

Gemini CLI starts OAuth after a 401, then opens a browser and waits for a redirect to http://localhost:<random-port>/oauth/callback. Google says this "will not work" in headless environments, remote SSH sessions without X11 forwarding, or containers without a browser. Use /mcp auth <serverName> to sign in or re-authenticate.

Gemini CLI: server ignored or disabled

Check three settings:

  • mcp.allowed in settings.json. If set, only listed servers connect.
  • mcp.excluded. Listed servers never connect.
  • gemini mcp disable <name>. Disabled servers show as "Disabled" in /mcp, and the state lives in ~/.gemini/mcp-server-enablement.json.

Also avoid underscores in server names. Google warns the policy parser splits tool names on the first underscore after mcp_, which "can cause wildcard rules and security policies to fail silently."

Windows, macOS and Linux

User settings live in ~/.gemini/settings.json and project settings in .gemini/settings.json. gemini mcp add writes to the project file by default; add -s user for all projects. On Windows, env values can also use %VAR_NAME%.

Where to find the logs

  • /mcp list or /mcp inside a session re-enables detailed errors for each server.
  • gemini mcp list from the shell shows connection errors for all configured servers.
  • Start the CLI with --debug for verbose output. Google says F12 opens a debug console in interactive mode.
  • MCP server stderr is captured and logged, with INFO messages filtered.

If it still fails

Raise the timeout value if the server is slow. The default request timeout is 600,000 ms (10 minutes). If tools connect but fail, Google suggests checking parameter validation and schemas. The CLI strips $schema and additionalProperties from tool schemas for Gemini API compatibility, so a tool that depends on them can behave differently.

Then test the server alone with the MCP Inspector, and look up JSON-RPC codes with our MCP error code lookup. Our Gemini CLI MCP setup guide walks through a clean install.

Next step

If you are choosing between Gemini CLI, Antigravity CLI and other agents for a team, compare MCP support first with our MCP client support matrix.

More in the MCP Guide

Free tools: MCP Error Code Lookup · MCP Config Generator

Latest research: State of MCP: October 2026

Frequently asked questions

Why does gemini mcp list say Disconnected for a local server?

Most often the folder is untrusted. Google's docs say stdio servers only show as Connected in a trusted folder. Run gemini trust, then check the command runs by hand.

Should I use url or httpUrl in Gemini CLI?

Use httpUrl for Streamable HTTP endpoints, which most hosted MCP servers now use. Use url only for an SSE endpoint, typically ending in /sse.

Why can't my MCP server see my API key in Gemini CLI?

Gemini CLI redacts sensitive host variables before starting MCP servers. Add the variable explicitly to the server's env block, which the docs say is trusted and not redacted.

Does Gemini CLI still work in 2026?

Yes for some users. Google's 19 May 2026 post says access continues for Gemini Code Assist Standard and Enterprise licenses and paid API keys. Google AI Pro, Ultra and free individual users moved to Antigravity CLI on 18 June 2026.

You Might Also like to Read

Get a FREE Website Audit

Enter your website and get a 20–30 page SEO, GEO, AEO & CRO audit within 24 hours. Completely free.

Don't have a site yet? Get in touch →

Ready to speak with a marketing expert?
Give us a call! (916) 866-7893

Websites Launched
1407
Websites Launched
Marketing Experts
29
Marketing Experts
Hours of Dedicated Work
204533
Hours of Dedicated Work
Irina S.Benjamin G.Jeanette M.David G.