Code navigation gives your agent direct access to the internals of any indexed package or GitHub repository. Your agent can search symbols, list files, read source at exact line ranges, and grep across a dependency — all correctly versioned against what you have installed, without cloning anything. GitHits indexes average repositories in about 10 seconds. Large repositories like the Linux kernel take 2–5 minutes. After indexing, queries return in sub-second time. When a repository is still being indexed, the response carries aDocumentation Index
Fetch the complete documentation index at: https://docs.githits.com/llms.txt
Use this file to discover all available pages before exploring further.
searchRef or an INDEXING status that you can poll with search_status.
Supported languages for code indexing: Bash, C#, C++, CSS, Dart, Elixir, Erlang, Go, Java, JavaScript, Kotlin, Lua, Markdown, PHP, Proto, Python, R, Ruby, Rust, Scala, SCSS, Swift, TypeScript, Zig, and more.
search — unified code and symbol search
search — unified code and symbol search
search is the primary discovery tool. It searches across code and explicit symbols in any indexed package or GitHub repository. Use it when you need to find where something is defined or which files handle a specific concern.Query syntax supports implicit AND, uppercase OR, grouping with parentheses, negation with -, quoted phrases, and semantic qualifiers:| Qualifier | Description | Example |
|---|---|---|
kind: | Symbol kind | kind:function |
category: | Symbol category | category:callable |
path: | File path component | path:src/auth |
lang: | Language | lang:typescript |
name: | Symbol name | name:createServer |
intent: | File intent | intent:test |
npm:react, pypi:requests) or a full GitHub URL (https://github.com/expressjs/express).CLI usageDiscovery query string. Supports AND (implicit), OR (uppercase), parentheses,
- negation, quoted phrases, and semantic qualifiers (kind:, category:, path:, lang:, name:, intent:).Single search target. Package format:
npm:react@18.2.0 or npm:react for latest. Repository format: https://github.com/facebook/react.Restrict which sources to search:
code or symbol. Omit to let the backend choose automatically. Use Documentation Access for hosted and repo-backed docs.When
true, returns hits from sources that finished indexing while others continue, plus a searchRef for continuation. Defaults to false (waits for all sources).Maximum results to return (default 10, max 100).
type field tells you which follow-up tool to use:repository_codeorrepository_symbol→code_readwithlocator.filePath(andlocator.startLine/endLinewhen present)
search_status — poll async indexing progress
search_status — poll async indexing progress
search_status lets you follow up on a search response that returned a searchRef instead of hits. This happens when indexing is still running. Pass the searchRef from the prior search response to check progress, fetch partial hits, or retrieve final results.CLI usageThe
searchRef value from a prior search response. Pass it through unchanged (the response field uses camelCase; this parameter uses snake_case).code_files — list files in an indexed package or repo
code_files — list files in an indexed package or repo
code_files lists the files contained in an indexed dependency or repository. Use it to discover paths before calling code_read, to scope a code_grep, or to explore the structure of an unfamiliar package.Filter results by path prefix, glob patterns, file extensions, programming language, or file intent (production source, tests, examples, generated files, etc.).CLI usagePackage target (
registry + package_name) or repository target (repo_url + optional git_ref). Mutually exclusive.Literal directory prefix to filter by (e.g.,
src/ or lib/parser). Not a glob — use globs for pattern matching.Glob selectors with full glob semantics (e.g.,
src/**/*.ts). Combined with OR logic alongside path and path_prefix.File extensions to include, without a leading dot (e.g.,
["ts", "js"]).Language filters matching aigrep language names.
Inclusive file-intent filter:
production, test, benchmark, example, generated, fixture, build, or vendor.Maximum entries to return (1–1000, default 200).
{total, hasMore, files: [{path, name, language, fileType, byteSize}], resolution, indexedVersion}.code_read — read source files at exact line ranges
code_read — read source files at exact line ranges
code_read reads a specific file from an indexed dependency at exact line ranges. Use the filePath from a search, code_grep, or code_files result to target the file, then set start_line and end_line to fetch only the window you need.The MCP surface caps each read at 150 lines per call. If you request a broader range, the response truncates to 150 lines from your start point and includes a hint with the continuation start_line for the next call. The CLI command npx githits@latest code read has no line cap.CLI usagePackage target (
registry + package_name) or repository target (repo_url + optional git_ref). Mutually exclusive.Exact file path to read. Use
code_files to discover paths when you receive a FILE_NOT_FOUND error.Starting line (1-indexed). Omit to start at line 1.
Ending line (inclusive). When omitted, defaults to
start_line + 149 because the MCP surface caps each read at 150 lines.{path, language, totalLines, startLine, endLine, content, isBinary, hint?}. Binary files set isBinary: true and omit content.code_grep — deterministic grep over indexed source
code_grep — deterministic grep over indexed source
code_grep runs a deterministic text or regex grep over the indexed source files of a package or repository. Use it when you know the exact string or pattern you are looking for. Use search for discovery when you do not.Grep results include the matching file path and line number, which chain directly into code_read — pass filePath as path and pick a window around match.line for start_line/end_line.CLI usagePackage target (
registry + package_name) or repository target (repo_url + optional git_ref). Mutually exclusive.The text pattern to search for. Literal by default.
literal (default) or regex (RE2 syntax).Literal directory prefix to scope the grep (e.g.,
src/).Glob selectors (e.g.,
src/**/*.ts).File extensions to include, without a leading dot.
Case-sensitive matching. Defaults to
false.Lines of context before and after each match (equivalent to
grep -C).Cap on total matches returned.
MCP tool reference
| MCP tool | CLI command | Purpose |
|---|---|---|
search | npx githits@latest search | Unified discovery across code and symbols |
search_status | npx githits@latest search-status | Poll async indexing and fetch results by searchRef |
code_files | npx githits@latest code files | List files in an indexed package or repo |
code_read | npx githits@latest code read | Read source at exact line ranges |
code_grep | npx githits@latest code grep | Deterministic text or regex grep over indexed source |