tilth

Tree-sitter code reading for agents: outlines, definitions, callers, file deps and function-level diffs

By jahala (individual) Rust Local · stdio Developer tools

61 popularity score ★ 358 ↓ 1.6k/wk

Connect your client

Local (npm)

Add in one click

Opens the app, which asks before it adds the server.

Or add it by command or config

Claude CodeTerminal
claude mcp add tilth -- npx -y tilth --mcp
Claude Desktopclaude_desktop_config.json
{
  "mcpServers": {
    "tilth": {
      "command": "npx",
      "args": [
        "-y",
        "tilth",
        "--mcp"
      ]
    }
  }
}
Cursor~/.cursor/mcp.json
{
  "mcpServers": {
    "tilth": {
      "command": "npx",
      "args": [
        "-y",
        "tilth",
        "--mcp"
      ]
    }
  }
}
VS Code.vscode/mcp.json
{
  "servers": {
    "tilth": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "tilth",
        "--mcp"
      ]
    }
  }
}
Codex~/.codex/config.toml
[mcp_servers.tilth]
command = "npx"
args = ["-y", "tilth", "--mcp"]
Gemini CLITerminal
gemini mcp add --scope user tilth npx -- -y tilth --mcp
Local (from source)

Add in one click

Opens the app, which asks before it adds the server.

Or add it by command or config

FirstTerminal
cargo install tilth
Claude CodeTerminal
claude mcp add tilth -- tilth --mcp
Claude Desktopclaude_desktop_config.json
{
  "mcpServers": {
    "tilth": {
      "command": "tilth",
      "args": [
        "--mcp"
      ]
    }
  }
}
Cursor~/.cursor/mcp.json
{
  "mcpServers": {
    "tilth": {
      "command": "tilth",
      "args": [
        "--mcp"
      ]
    }
  }
}
VS Code.vscode/mcp.json
{
  "servers": {
    "tilth": {
      "type": "stdio",
      "command": "tilth",
      "args": [
        "--mcp"
      ]
    }
  }
}
Codex~/.codex/config.toml
[mcp_servers.tilth]
command = "tilth"
args = ["--mcp"]
Gemini CLITerminal
gemini mcp add --scope user tilth tilth -- --mcp

What it does

tilth is a single Rust binary that works both as a command-line tool and as a stdio MCP server (started with `tilth --mcp`). It parses a local codebase with tree-sitter on each request rather than building an index, so an agent can ask structural questions about code instead of chaining grep and file reads.

In MCP mode it offers seven tools by default: reading a file (whole when small, as an outline of functions, classes and imports when it passes roughly 6,000 tokens, or by line range or markdown heading), symbol, text, regex and call-site search with definitions listed first, a glob-based file tree with token-size totals per directory, a file's imports and dependents, a one-call summary of a symbol (signature, body, callees, callers, siblings, tests), a function-level diff of uncommitted, staged or committed changes, and a report of tokens saved this session. Started with `--edit`, it adds an eighth tool, `tilth_write`, and switches reads to line:hash anchors so edits are rejected when the file changed since it was last read.

The tool definitions at v0.10.1 carry details the README leaves out: the `tilth_savings` tool exists at all, multi-symbol search takes at most 5 names, `tilth_write` takes at most 20 files per call, and `tilth_grok` returns 5 callers, 5 callees, 8 siblings and 8 tests by default, widened to 50/30/30/30 with `full` (src/mcp/tools/definitions.rs). In MCP mode, definitions already expanded earlier in the session come back as `[shown earlier]` instead of being repeated.

What it needs

RuntimeNode.jsorRust

The `tilth` binary: `cargo install tilth` (needs a Rust toolchain), a prebuilt binary from the GitHub releases page, or `npx tilth` (needs Node.js). `tilth_diff` calls the `git` program, so git must be on PATH and the folder must be a git repository for diffs. No account or key.

Limits

It parses syntax only and does not resolve types. Callers and dependencies are matched by name, so two functions with the same name in different modules are not told apart, and dynamic dispatch is not followed. Languages without a bundled grammar (17 are parsed) get text search and plain reading only; Dockerfile and Make files are recognised but not parsed. Search returns 10 matches by default, 100 with `full`, and walks the whole tree on each call, so time grows with repository size. Search includes gitignored files, skipping common build and dependency folders such as node_modules, target and .venv. The `--map` codebase skeleton is CLI-only, not an MCP tool.

Who it suits

Suits developers who run coding agents on a local repository and want definitions, call sites, file dependencies and per-function diffs from one local process, with nothing to index and no network calls. Leave out `--edit` to keep it read-only; add it only if you want it to replace the host's own edit tools. Because matching is by name with no type resolution, a language server based tool is the better pick when you need exact references across same-named symbols or dynamic dispatch.

Tools 8

tilth_read
Read one or more files: whole when small, outline when large, or chosen line ranges or headings
tilth_search
Find symbols, literal text, regex matches or call sites, definitions first, with source of top matches
tilth_list
Show files matching glob patterns as a tree with token-size totals per directory
tilth_deps
Show what a file imports and which other files use its exports
tilth_grok
Return a symbol's signature, doc, body, callees, callers, siblings and tests in one call
tilth_diff
Function-level diff of uncommitted, staged or committed changes via git
tilth_savings
Report an estimate of tokens saved in the current session
tilth_write
Edit mode only: write, overwrite or append to up to 20 files, with hash-anchored line edits

Similar servers