CLI reference¶
The CLI mirrors the MCP tools one-to-one — same pipelines, same scoring, same rendering.
# Serve as an MCP server (the most common entry point)
pydocs-mcp serve /path/to/project
# --config is a global flag: it goes BEFORE the subcommand
pydocs-mcp --config ./my-pydocs.yaml serve . --no-inspect --depth 2 --workers 8
pydocs-mcp serve . --gpu # run embedder inference on CUDA (see "GPU inference" below)
# Index only (no server) — useful for one-shot benchmark setups
pydocs-mcp index .
pydocs-mcp index . --force # clear cache + re-index
pydocs-mcp index . --skip-project # only index deps, not the project
pydocs-mcp index . --skip-deps # only index the project, not its deps
pydocs-mcp index . --gpu # index with CUDA-accelerated embeddings
# Search (mirrors the MCP `search_codebase` tool)
pydocs-mcp search "batch inference"
pydocs-mcp search "predict" --kind api -p vllm
pydocs-mcp search "handle request" -p __project__
# Navigate to a specific target (mirrors the other five MCP tools)
pydocs-mcp overview # list indexed packages (get_overview)
pydocs-mcp symbol fastapi.routing.APIRouter # class overview (get_symbol)
pydocs-mcp symbol fastapi.routing.APIRouter --depth tree
pydocs-mcp refs fastapi.routing.APIRouter.include_router --direction callers
pydocs-mcp refs requests.auth.HTTPBasicAuth --direction inherits
pydocs-mcp context fastapi.routing.APIRouter fastapi.applications.FastAPI
pydocs-mcp why "how does routing work" # recorded design rationale (get_why)
GPU inference (--gpu)¶
serve, index, and watch accept --gpu to run embedder inference on
CUDA — it covers all embedders: FastEmbed and the sentence_transformers
provider (single-vector dense) and PyLate (late-interaction / multi-vector). It needs no YAML change and
applies to both index-time and query-time embedding.
pydocs-mcp index . --gpu # CUDA-accelerated indexing
pydocs-mcp serve . --gpu # CUDA for both the initial index and query-time embedding
--gpu is a runtime latency knob only: it does not change retrieval results
and does not trigger a re-index — the execution device is excluded from the
index-cache key, so the same .tq / fast-plaid index is shared across CPU and
GPU runs. It requires the matching GPU runtime for whichever embedder you use
(onnxruntime-gpu, fastembed-gpu, or a CUDA build of torch for PyLate); see
INSTALL.md. With the default CPU runtimes
installed, FastEmbed/ONNX fall back to CPU and only the PyLate path requires real
CUDA. The benchmark runner takes the same --gpu flag.
search flags¶
# --kind docs → markdown / docstring chunks only
# --kind api → ModuleMember rows (functions, classes, signatures)
# --kind any → both, merged + scored together (default)
# --kind decision → mined architectural-decision records
pydocs-mcp search "predict" --kind api
pydocs-mcp search "router include" --kind any --limit 20 # --limit caps multi-repo unions only
# Restrict to one package. PyPI names are normalized to the DB form
# (e.g. "Flask-Login" → "flask_login"), so either spelling works.
pydocs-mcp search "auth" -p Flask-Login
# Search only YOUR project source via the __project__ sentinel.
pydocs-mcp search "handle request" -p __project__
# Restrict by SCOPE: project | deps | all (default all).
pydocs-mcp search "retry" --scope project
pydocs-mcp search "retry" --scope deps
# Cap results for multi-repo union searches (default 10). Single-project
# result count is set by the retrieval pipeline YAML, not this flag.
pydocs-mcp search "logging" --limit 5
# Point at a different project (default is cwd).
pydocs-mcp search "celery beat" --project-dir /path/to/other/project
# Force the pure-Python fallback (debug the Rust substitution boundary).
pydocs-mcp search "tokenizer" --no-rust
search finds candidates by relevance; symbol / refs / context jump to a
specific known name. symbol’s --depth accepts {summary, tree, source};
refs’ --direction accepts {callers, callees, inherits, impact, governed_by}. The
deprecated lookup command still works as an alias but warns — use the
task-shaped commands directly.
MCP tool reference¶
The surface is intentionally fixed at nine task-shaped tools — they cover every workflow, and pinning them keeps MCP clients stable across server retunes (see Configuration).
Tool |
Signature |
Purpose |
|---|---|---|
|
|
Orient yourself: what is indexed and what shape a repo/package has. Empty |
|
|
Full-text / hybrid search across indexed docs + code. |
|
|
Navigate to a known dotted path. |
|
|
Everything needed to understand one or more symbols, packed in a single call. |
|
|
Traverse the reference graph. |
|
|
Recorded architectural decisions and rationale for a topic or target. |
|
|
Exact-string / regex search (Python |
|
|
Find files by name pattern ( |
|
|
Read file content with line numbers ( |