← CLI Reference

Commands

Complete reference for the prep command-line interface.

prep serve

prep serve [--port <port>] [--host <host>] [--reload]

Starts the SourcePrep daemon and API server. This is the core process that must be running for MCP and the Dashboard to work.

  • --port: Port to listen on (default: 8400).
  • --reload: Enable auto-reload (for development).

To enable debug logging, set PREP_LOG_LEVEL=DEBUG before running.

prep add

prep add <path> [--name <name>] [--mode <mode>]

Registers a directory as a project and starts initial indexing.

  • --name: Friendly name for the project.
  • --mode: standalone (default), embedded (stores index in repo), or custom.
  • --index-path: Required if mode is custom. Useful for scratch disks.

prep build

prep build [<project_id>] [--full]

Triggers a manual re-index for a project. Useful if the watcher was off or you want to force a clean slate.

  • --full: Force a full rebuild, ignoring incremental cache.
prep search <query> [--project <id>] [--limit <k>] [--min-score <s>]

Runs a semantic search against the index and prints results. Great for testing retrieval quality.

  • --limit: Number of results (default: 10).
  • --min-score: Minimum similarity score 0.0-1.0 (default: 0.15).

prep context

prep context <query> [--project <id>] [--limit <k>] [--max-chars <n>] [--raw]

Generates the full prompt context payload for a given query, including citations.

  • --limit: Number of chunks (default: 5).
  • --max-chars: Maximum characters in output (default: 8000).
  • --raw: Output only the context string (no stats/formatting), useful for piping to LLMs.

prep status

prep status

Prints the health of the daemon, connected projects, and index statistics (file count, vector count).

prep mcp

prep mcp [--mode <mode>] [--auto] [--debug]

Runs the MCP server. Primary entry point for editor integration.

  • --mode: server (default, connects to daemon) or direct (runs engine in-process).
  • --daemon: URL of the daemon (default: http://127.0.0.1:8400). Used in server mode.
  • --repo-root: Path to repo root. Required for direct mode if not current directory.
  • --auto: Auto-detect project from current working directory (server mode).
  • --debug: Enable verbose logging to stderr.
  • --log-file: Write debug logs to a specific file.
  • --transport: stdio (default) or http (SSE).

prep mcp-config

prep mcp-config [--ide <ide>] [--mode <mode>]

Generates configuration JSON for connecting various editors (Cursor, Windsurf, Claude Code) to SourcePrep.

  • --ide: Target editor (cursor, windsurf, vscode, claude, or all).
  • --mode: auto (detects project from cwd), project (pinned to ID), or direct (no daemon).
  • --project: Project ID to pin (required if mode is project).

Utilities & Visualization

prep list

prep list

Lists all registered projects with their IDs, paths, and modes.

prep ui

prep ui [--port <port>]

Opens the SourcePrep web dashboard in your default browser.

prep models

prep models

Downloads the native embedding model (nomic-embed-text-v1.5) for offline use. Useful for air-gapped environments or pre-loading before the first build.

prep activity

prep activity [--weeks <n>] [--json] [--no-legend] [--no-labels]

Displays a terminal-based heatmap of indexing activity (GitHub-style).

  • --weeks: Number of weeks to display (default: 12).
  • --json: Output raw JSON data instead of the visualization.
  • --no-legend: Hide the color legend.
  • --no-labels: Hide day/month labels.

prep coverage

prep coverage

Shows a file tree visualization indicating which files are indexed, traced, or ignored.

prep overview

prep overview [--weeks <n>]

Shows a comprehensive dashboard overview in the terminal, including health stats and activity.

  • --weeks: Number of weeks for the activity graph (default: 12).

prep remove

prep remove <project_id> [--purge]

Unregisters a project from the daemon. Use --purge to also delete the index files from disk.

prep version

prep version

Prints the installed version of SourcePrep.