Connecting CodeNavi to Gemini CLI¶
Gemini CLI is Google's terminal
coding agent. It speaks MCP natively and reaches CodeNavi over Streamable HTTP.
Once connected, its agent gets CodeNavi's tools: semantic search, the call graph
(find_callers, impact_analysis, diff_impact), the overview and the index tools by
default, with grep, file reading and the rest one reveal_tools() call away
(config.md).
Gemini CLI is not Antigravity. Both keep files under
~/.gemini/, but Antigravity reads~/.gemini/config/mcp_config.jsonand Gemini CLI reads~/.gemini/settings.json. A block in one file does nothing for the other. Antigravity has its own page: Antigravity.
The endpoint¶
- URL:
http://localhost:8765/mcp(unscoped) or/mcp/<codebase>(scoped) - Header:
Authorization: Bearer <CODENAVI_AUTH_TOKEN> - Get the token from your install's
.env:grep '^CODENAVI_AUTH_TOKEN=' .env | cut -d= -f2-(run from your install directory)
The /connect page on your server builds the exact block for you, with your
server's address and token filled in.
Configure it¶
The quickest way is the CLI. -s user writes your user settings, so the server
is there in every project. Without it, Gemini CLI writes the project's
.gemini/settings.json.
gemini mcp add -s user --transport http \
--header "Authorization: Bearer <PASTE_TOKEN>" \
codenavi http://localhost:8765/mcp
Or edit ~/.gemini/settings.json (user) or .gemini/settings.json (project)
by hand:
{
"mcpServers": {
"codenavi": {
"url": "http://localhost:8765/mcp",
"type": "http",
"headers": { "Authorization": "Bearer <PASTE_TOKEN>" }
}
}
}
If your server runs with auth turned off, drop the headers line.
Verify¶
From the shell:
gemini mcp list
codenavi should show as Connected. If it shows Disabled with a warning
that the folder is untrusted, see "The things that bite people" below.
Inside a session, /mcp lists the server with its tools. Then try:
"Use semantic_search to find where payment processing happens."
The things that bite people¶
- Untrusted folders turn MCP servers off. Gemini CLI disables every MCP
server, user-level ones too, in a folder you have not trusted. Start
geminiin your project once and choose Trust folder (or Trust parent folder). For headless runs, pass--skip-trustor setGEMINI_CLI_TRUST_WORKSPACE=true. - Keep
"type": "http"next tourl. That is whatgemini mcp addwrites. Older guides usehttpUrl; it still works but is deprecated. - Paste the literal token. Gemini CLI documents variable expansion for a
server's
envblock, not forheaders. Put the real Bearer value in the header and keep the file private (chmod 600 ~/.gemini/settings.json). - Leave the server's
trustoff."trust": trueon the server entry (not the same as trusting a folder) skips the confirmation for every tool call, includingreindex_full,restoreanddelete_note. If you want an agent that can only read, run the server withCODENAVI_MCP_READ_ONLY=trueinstead (config.md). - Unscoped vs scoped
/mcp. Use unscoped/mcpunless you know the codebase name./mcp/<name>returnsUnknown codebase(404) for a name that isn't configured; a single-codebase install is usually nameddefault.
Agent instructions¶
Gemini CLI has no CodeNavi plugin. To make it prefer semantic_search over
grep, copy the usage rules from the /connect page into your GEMINI.md.
Privacy¶
Gemini CLI sends your prompts, and the code chunks CodeNavi returns, to Google's hosted Gemini models. Whatever leaves the agent leaves your machine. Scope CodeNavi to codebases you're comfortable sharing. The CodeNavi server itself never phones home.