Skip to content

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

Merged
asujithan merged 2 commits into
mainfrom
gemini-mcp-fix
Jun 12, 2026
Merged

fix gemini mcp registration to write to correct settings.json#155
asujithan merged 2 commits 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

@AarushiShah-db AarushiShah-db left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you!!

@asujithan asujithan merged commit 9d97390 into main Jun 12, 2026
3 of 4 checks passed
@asujithan asujithan deleted the gemini-mcp-fix branch June 12, 2026 20:23
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.

2 participants