Command line
Your context, from any shell.
Search, read, and write your prompts, documents, and collections from a terminal, a script, or a CI job. Each of the 35 REST API operations is one command.
- JSON on stdout
- Node.js 20+
- MIT license
zsh
$ contextrepo search "onboarding checklist"DocumentsSCORE ID TITLE/NAME HIGHLIGHT 0.62 jn7a4m2kq9x8w3v6t5r1p0z2n8s4d… Customer onboarding checklist ## Week one: accounts, access… 0.41 jn7c8e2r5t1y4u7m9o3p6a2s5d8f1… Support handoff runbook Hand the account to support a…PromptsSCORE ID TITLE/NAME HIGHLIGHT 0.47 kh7b2e5h8k1n4q7t0w3z6c9f2j5m8p1s Onboarding email draftCollectionsSCORE ID TITLE/NAME HIGHLIGHT 0.44 jd7c5f8j1m4p7s0v3y6b9e2h5k8n1q4t Customer successRuns wherever a shell runs.
CI jobs, cron, git hooks, and coding agents already run commands. Now each of them can read and write your context.
Add one step after your release job. Set CONTEXTREPO_API_KEY from your CI secrets and the step runs without init or a prompt. The acknowledgement carries the new document's id and revision.
release job
$ contextrepo documents create --title "Release notes 2.4" --content-file CHANGELOG.md --tags releaseid: jn7d5g8j1m4p7s0v3y6b9e2h5k8n1q4trevision: 1contentHash: sha256:9f2c41d07be3a8c5noop: norevision 1 · etag "r1-9f2c41d0" · hash sha256:9f2c41d07be3a8c5Made for scripts. Clean stdout. Clear exit codes.
zsh
$ contextrepo whoami > /dev/null; echo "exit $?"exit 0$ CONTEXTREPO_API_KEY="$REVOKED_KEY" contextrepo whoami; echo "exit $?"✖ 401 — Invalid authentication hint: the API key was rejected; run `contextrepo auth login` or check CONTEXTREPO_API_KEYexit 3- 0
Success
The command did what you asked.
- 1
API error
The API answered with an error, such as 404 not found or 409 conflict.
- 2
Usage error
A missing argument, a bad flag value, or an unreadable config file.
- 3
Auth error
The key was rejected (401) or lacks the scope for the command (403).
- 4
Network error
The API could not be reached, or the request timed out.
- 130
Cancelled
You cancelled the key prompt during setup.
Exact JSON
--json prints the exact API JSON, so jq and your own code read the same fields the API docs describe.
Clean stdout
Results go to stdout. Errors, hints, and generated idempotency keys go to stderr, and --quiet drops the hints.
Pipes both ways
Pipe content into prompts create or documents create, and documents get --raw prints the Markdown alone.
35 API operations. One command each.
Every group has --help with examples. For anything else, contextrepo api sends a raw request to any /v1 path.
prompts7
- list
- get
- create
- update
- delete
- versions
- restore
documents13
- list
- get
- create
- update
- delete
- versions
- restore
- refresh
- scrape
- lease
- coordination get
- coordination enable
- coordination disable
collections8
- list
- get
- create
- update
- delete
- items
- add
- remove
retrieval6
- search
- reason
- pd search
- pd expand
- pd read
- pd session
account1
- whoami
tools
- init
- auth login
- auth status
- auth logout
- doctor
- config
- log
- completion
- api
CLI or MCP? Same items. Pick by where the work runs.
| MCP serverSet up MCP | CLISet up the CLI | |
|---|---|---|
| Where it runs | Inside chat and coding clients: Claude, ChatGPT, Cursor, and other MCP clients. | In a shell: terminals, scripts, CI jobs, cron, git hooks, and agents that run commands. |
| Who picks the call | The model chooses tools from what you ask in plain language. | You or your script name the exact command and flags. |
| How it signs in | OAuth sign-in, or an API key through the stdio bridge. | An API key, saved by init or read from CONTEXTREPO_API_KEY. |
| What comes back | Tool results that the model reads and summarizes for you. | Tables for people, exact JSON for programs, and an exit code. |
| Surface | 29 tools at one URL. | 35 API operations, one command each. |
- Where it runs
- MCP serverInside chat and coding clients: Claude, ChatGPT, Cursor, and other MCP clients.
- CLIIn a shell: terminals, scripts, CI jobs, cron, git hooks, and agents that run commands.
- Who picks the call
- MCP serverThe model chooses tools from what you ask in plain language.
- CLIYou or your script name the exact command and flags.
- How it signs in
- MCP serverOAuth sign-in, or an API key through the stdio bridge.
- CLIAn API key, saved by init or read from CONTEXTREPO_API_KEY.
- What comes back
- MCP serverTool results that the model reads and summarizes for you.
- CLITables for people, exact JSON for programs, and an exit code.
- Surface
- MCP server29 tools at one URL.
- CLI35 API operations, one command each.
Four steps to your first command. From API key to a passing check.
Step 01
Create an API key
In Settings, under API Keys, create a key with Read or Write on prompts and on documents and collections. The full key is shown once, so copy it.
Step 02
Install the CLI
Install the package globally with npm. It adds one command, contextrepo, and needs Node.js 20 or newer.
Step 03
Connect this machine
Run init and paste the key. The CLI checks it with the API, then saves it to your config file. In CI, set CONTEXTREPO_API_KEY instead.
Step 04
Check the setup
Run doctor. It checks Node.js, the config file, the API, and your key, one line per check.
zsh
$ contextrepo init ██████╗ ██████╗ ███╗ ██╗████████╗███████╗██╗ ██╗████████╗██╔════╝██╔═══██╗████╗ ██║╚══██╔══╝██╔════╝╚██╗██╔╝╚══██╔══╝██║ ██║ ██║██╔██╗ ██║ ██║ █████╗ ╚███╔╝ ██║██║ ██║ ██║██║╚██╗██║ ██║ ██╔══╝ ██╔██╗ ██║╚██████╗╚██████╔╝██║ ╚████║ ██║ ███████╗██╔╝ ██╗ ██║ ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═╝ ╚══════╝╚═╝ ╚═╝ ╚═╝ ██████╗ ███████╗██████╗ ██████╗██╔══██╗██╔════╝██╔══██╗██╔═══██╗██████╔╝█████╗ ██████╔╝██║ ██║██╔══██╗██╔══╝ ██╔═══╝ ██║ ██║██║ ██║███████╗██║ ╚██████╔╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═════╝ Context Repo CLI v0.1.0 Paste an API key to connect this machine. Create one in the dashboard under Settings → API Keys. │◇ Context Repo API key│ ▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪▪│◇✔ Connected as Ada Lovelace kind: apiKey Prompts: Write (includes Read) · Documents & Collections: Write (includes Read) config: ~/.config/contextrepo/config.json Try: contextrepo prompts list contextrepo search "onboarding checklist" contextrepo log enableYour questions, answered.
An open-source command-line client for the Context Repo REST API. It installs one command, contextrepo, that searches, reads, creates, versions, and organizes your prompts, documents, and collections. It talks to the REST API directly and never opens an MCP session.
The CLI is free and MIT licensed. It connects to your Context Repo account with an API key, and API keys come with every plan, including the 7-day Pro or Pro Max trial.
Install it in the job with npm install -g @contextrepo/cli and set CONTEXTREPO_API_KEY from your CI secrets. With the key in the environment, the job needs no config file and no init. Branch on the exit code: 0 is success, 3 is an auth problem, and 4 is a network problem.
contextrepo init saves it to config.json in ~/.config/contextrepo on macOS and Linux (or $XDG_CONFIG_HOME/contextrepo), with file mode 600 so only you can read it. On Windows it uses %APPDATA%\contextrepo. The key is never echoed. Prefer CONTEXTREPO_API_KEY to the --api-key flag so the key stays out of your shell history.
Use the MCP server inside chat and coding clients, where the model picks the tools for you. Use the CLI where work runs as commands: terminals, scripts, CI jobs, cron, git hooks, and agents that run shell commands. Both reach the same prompts, documents, and collections, so you can use both.
No. It sends requests only to the Context Repo API. An optional action log, off by default, appends one line per command to a local NDJSON file. It never records your API key or any request or response body.
Yes. contextrepo api sends an authenticated request to any /v1 path, for example contextrepo api GET /v1/user/me, and --json prints the exact response.
Open source, MIT
One install.
Every API operation in your shell.