Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.githits.com/llms.txt

Use this file to discover all available pages before exploring further.

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 a 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_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 usage
npx githits@latest search-status <searchRef>
Parameters
search_ref
string
required
The searchRef value from a prior search response. Pass it through unchanged (the response field uses camelCase; this parameter uses snake_case).
If your original search call used allow_partial_results: true, the search_status response may include hits from sources that have finished so far, with pagination support via nextOffset.
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 usage
npx githits@latest code files npm:express
npx githits@latest code files npm:express --path-prefix src/
npx githits@latest code files npm:express --extensions ts js
npx githits@latest code files https://github.com/expressjs/express --file-intent test
Parameters
target
object
required
Package target (registry + package_name) or repository target (repo_url + optional git_ref). Mutually exclusive.
path_prefix
string
Literal directory prefix to filter by (e.g., src/ or lib/parser). Not a glob — use globs for pattern matching.
globs
array
Glob selectors with full glob semantics (e.g., src/**/*.ts). Combined with OR logic alongside path and path_prefix.
extensions
array
File extensions to include, without a leading dot (e.g., ["ts", "js"]).
languages
array
Language filters matching aigrep language names.
file_intent
string
Inclusive file-intent filter: production, test, benchmark, example, generated, fixture, build, or vendor.
limit
number
Maximum entries to return (1–1000, default 200).
The JSON envelope shape is {total, hasMore, files: [{path, name, language, fileType, byteSize}], resolution, indexedVersion}.
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 usage
npx githits@latest code read npm:express src/application.js
npx githits@latest code read npm:express src/application.js --start-line 120 --end-line 200
npx githits@latest code read https://github.com/expressjs/express lib/router/index.js
Parameters
target
object
required
Package target (registry + package_name) or repository target (repo_url + optional git_ref). Mutually exclusive.
path
string
required
Exact file path to read. Use code_files to discover paths when you receive a FILE_NOT_FOUND error.
start_line
number
Starting line (1-indexed). Omit to start at line 1.
end_line
number
Ending line (inclusive). When omitted, defaults to start_line + 149 because the MCP surface caps each read at 150 lines.
Pick a focused window — typically 80–150 lines around the symbol or grep match you are investigating. Each call beyond the cap costs additional context budget, so aim for one well-sized read per location.
Response fields: {path, language, totalLines, startLine, endLine, content, isBinary, hint?}. Binary files set isBinary: true and omit content.
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 usage
npx githits@latest code grep npm:express "Router"
npx githits@latest code grep npm:express "use\(.*middleware" --pattern-type regex
npx githits@latest code grep npm:express "createServer" --path-prefix src/ --extensions js
npx githits@latest code grep https://github.com/expressjs/express "response.json"
Parameters
target
object
required
Package target (registry + package_name) or repository target (repo_url + optional git_ref). Mutually exclusive.
pattern
string
The text pattern to search for. Literal by default.
pattern_type
string
default:"literal"
literal (default) or regex (RE2 syntax).
path_prefix
string
Literal directory prefix to scope the grep (e.g., src/).
globs
array
Glob selectors (e.g., src/**/*.ts).
extensions
array
File extensions to include, without a leading dot.
case_sensitive
boolean
Case-sensitive matching. Defaults to false.
context_lines
number
Lines of context before and after each match (equivalent to grep -C).
max_matches
number
Cap on total matches returned.
Narrow the grep scope with path_prefix, globs, or extensions to keep responses small. A whole-package grep can return a large number of matches on bigger packages.

MCP tool reference

MCP toolCLI commandPurpose
searchnpx githits@latest searchUnified discovery across code and symbols
search_statusnpx githits@latest search-statusPoll async indexing and fetch results by searchRef
code_filesnpx githits@latest code filesList files in an indexed package or repo
code_readnpx githits@latest code readRead source at exact line ranges
code_grepnpx githits@latest code grepDeterministic text or regex grep over indexed source