← All Fix Guides
high
✓ Verified: 2026-11-26 AGY v2.35.2 / gemini-cli 0.71.1
mcp agy agygemini-cli
MCP Server Shows Disconnected, EADDRINUSE, or Missing Env Vars
MCP_DISCONNECTED EADDRINUSE ENOENT
Matching Symptoms
- • MCP server silently shows `Disconnected` in Antigravity or `gemini mcp list`.
- • Remote Streamable HTTP MCP fails because `url` (SSE) was configured instead of `httpUrl`.
- • MCP subprocess cannot see `*_KEY`, `*_TOKEN`, or `*_SECRET` environment variables.
Root Cause
Workspace directory is untrusted, JSON syntax or transport key (`url` vs `httpUrl`) is mismatched, port is already occupied (`EADDRINUSE`), or the CLI security sanitizer stripped `*KEY*`/`*TOKEN*`/`*SECRET*` env vars not explicitly declared in the server `env` block.
Step-by-Step Fix
- 1 Run
npx agycraft-mcp doctoroffline to lintmcp_config.json/.gemini/settings.json, checkurlvshttpUrl, and detect stripped env patterns. - 2 Trust the current workspace directory (
gemini trust) if running in a newly cloned repo. - 3 Use
urlstrictly for legacy SSE servers andhttpUrlfor Streamable HTTP MCP endpoints. - 4 Explicitly declare required config keys or
${ENV_VAR}references inside the MCP server'senvblock.
Copyable Commands
Run agycraft offline MCP & config doctor (all)
npx agycraft-mcp doctor List registered MCP servers and live connection states (all)
gemini mcp list Check occupied local port (replace 3000 with your MCP port) (unix)
lsof -i :3000 -sTCP:LISTEN Verify Fix
Verify
gemini mcp list