Skip to main content
Codanna is a local code intelligence MCP server and CLI for AI coding agents. This is the complete reference for the command-line interface — global flags, commands, MCP tools, and exit codes.

Global Flags

These flags work on every command:

Commands

Index Flags

--force with CLI paths clears the entire index but only rebuilds the specified paths. Other configured paths are not rebuilt. Run codanna index --force without paths to rebuild everything.

Retrieve Subcommands

All retrieve subcommands support:
  • --json for JSON output
  • --fields <fields> to filter JSON output to specific data fields
  • lang:<language> filter (e.g., lang:rust)

Retrieve Search Filters

Filters also work as key:value pairs:

Dump

Stream the whole index as JSON Lines: a begin envelope, one result envelope per symbol and per relationship, and a terminal summary envelope. Every line is the standard JSON envelope; row ordering is unspecified. Available since v0.14.0.
A relationship row identifies both endpoints by name, kind, file, and line, and carries the persisted call metadata:
The summary envelope closes the stream with totals and index provenance:
Scalar line fields (endpoint line, metadata line) are 1-indexed editor coordinates; range objects on symbol rows are 0-indexed machine coordinates. id values are scoped to the current index instance and change across re-indexes — identify symbols durably by name, file, line, and kind.
An unknown --relation or --kind value is rejected before any line is written (exit 2, accepted values listed on stderr). A stale index refuses with exit 7 as on every read command.

MCP Tools

See Tool Tiers for recommended usage patterns.

MCP Flags

MCP Test

Test MCP server connectivity and tool execution:

Serve Options

Documents Subcommands

Documents Flags

See Document Search for details.

Profile Subcommands

Profile Install Flags

See Collaboration for details.

Parse Flags

Benchmark

Benchmark parser performance for one or all languages:
Supported: rust, python, php, typescript, go, csharp, all.

Key:Value Arguments

Retrieve, MCP, and documents commands accept arguments as key:value pairs:
This format is equivalent to using flags and works alongside them.

Exit Codes

An index built by a binary with different output semantics is refused before any tool runs: read commands exit 7 with a message naming both versions, and codanna index rebuilds from scratch automatically. This prevents mixed-semantics results after an upgrade. The automatic rebuild also re-embeds when semantic search is enabled; large repositories take minutes. Since v0.10.1, a stale-index codanna serve (stdio) completes the MCP handshake with no tools and rebuild instructions, so MCP clients report the fix instead of a generic connection failure.
See Unix Piping for JSON envelope schema details.