Skip to content

fix gemini mcp registration to write to correct settings.json#155

Open
asujithan wants to merge 1 commit into
mainfrom
gemini-mcp-fix
Open

fix gemini mcp registration to write to correct settings.json#155
asujithan wants to merge 1 commit into
mainfrom
gemini-mcp-fix

Conversation

@asujithan

@asujithan asujithan commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

Summary

Before:
ucode configure mcp would silently register Gemini MCP servers into a
file the launcher never reads, so /mcp inside ucode gemini always
showed "No MCP servers configured." even after a successful save.

add_gemini_mcp_server / remove_gemini_mcp_server ran gemini mcp add/remove without setting GEMINI_CLI_HOME, so entries went to
$HOME/.gemini/settings.json. But agents/gemini.py launches Gemini
with GEMINI_CLI_HOME=~/.ucode/.gemini-home, which makes the session
read from a different settings.json. The two never intersected.

Fix: pin GEMINI_CLI_HOME to the same gemini.GEMINI_HOME_DIR for
both subprocess calls so registrations write to the file the launcher
reads.

Test plan

  • uv run ruff check src/ucode/mcp.py tests/test_mcp.py
  • uv run pytest tests/test_mcp.py (39/39)
  • ucode configure mcp → select an entry → ucode gemini
    /mcp lists the registered servers and tools/list works.
  • ~/.ucode/.gemini-home/.gemini/settings.json contains the new
    mcpServers entries; ~/.gemini/settings.json is no longer
    written by ucode.
Screenshot 2026-06-11 at 5 20 51 PM

@asujithan asujithan requested a review from AarushiShah-db June 12, 2026 00:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant