Agents

Graph Indexer for Gemini CLI

Add Graph Indexer to Gemini CLI with npx graph-indexer init, which writes .gemini/settings.json. Tool schemas skip const and additionalProperties.

Updated Graph Indexer 3.0.0 View as Markdown

Graph Indexer for Gemini CLI is a local MCP server that gives Gemini CLI exact references, call graphs and change impact. Run npx graph-indexer init; it writes the server into .gemini/settings.json under mcpServers, and its tool schemas are written without const or additionalProperties, which some Gemini-family hosts drop.

How do I add Graph Indexer to Gemini CLI?

From the repository root, with Node.js 22.5 or later:

npx graph-indexer init

init selects Gemini CLI when the repository has a .gemini directory or a GEMINI.md file. Otherwise target it with npx graph-indexer init --agents gemini.

What does npx graph-indexer init write for Gemini CLI?

FileContent
.gemini/settings.jsonA graph-indexer entry under mcpServers, merged with existing settings
AGENTS.mdA managed block with the lookup rules
.gitignore.graph-indexer/

What is the manual Gemini CLI configuration?

The entry in .gemini/settings.json is a standard stdio server:

{
  "mcpServers": {
    "graph-indexer": {
      "command": "npx",
      "args": ["-y", "graph-indexer@3", "serve"]
    }
  }
}

Without --repo, the server indexes the git repository containing Gemini CLI’s working directory. You can also set the GRAPH_INDEXER_REPO environment variable.

Why does the Gemini CLI integration care about tool schemas?

Gemini CLI users hit a quirk other agents do not: some Gemini-family hosts drop MCP tools whose JSON schemas contain const or additionalProperties. The Graph Indexer 3.0 MCP server implements its protocol without an SDK and writes input schemas that use neither keyword, so none of the eight tools disappears. If a tool is missing in another Gemini host, check its MCP server list first.

What does Gemini CLI gain from Graph Indexer?

Gemini CLI gets eight read-only tools over stdio, with plain-text replies of typically 400 to 1,500 tokens.

  • find_references returns real uses of a symbol rather than every textual match, and marks calls made through base types.
  • search_code answers “where are JWT tokens validated” style questions with ranked symbols.
  • change_impact returns the blast radius of your uncommitted diff when called with diff.
  • outline gives a ranked map of a directory within a token budget.

In the localization benchmark on 169 real commits across 5 repositories, the right file was in the top 5 results for 80.5% of tasks, against 76.9% for a grep-ranked baseline, a small margin. Hooks are not part of the Gemini CLI setup. See the benchmarks and the tools reference.

Frequently asked questions

Why do Graph Indexer's tool schemas avoid const and additionalProperties?

Some Gemini-family hosts drop tools whose input schemas use const or additionalProperties. Graph Indexer's schemas omit both so all eight tools stay visible to Gemini CLI.

Does init write to GEMINI.md?

No. For Gemini CLI, init adds its managed block to AGENTS.md. If you rely on GEMINI.md alone, copy the short block there or configure your setup to read AGENTS.md.

Will init overwrite my .gemini/settings.json?

No. It adds the graph-indexer entry under mcpServers and keeps your other settings. If the file has comments or is not plain JSON, init leaves it untouched and prints the entry.

Are there hooks for Gemini CLI?

The hook command recognises Gemini CLI tool names, but init --hooks does not write a Gemini hook configuration. The MCP tools and the AGENTS.md block are the supported integration.

Try it on your repo.

npx graph-indexer init
Using Claude Code? Install the plugin