Command-line client
A command-line client for Corpus. Every path names its vault — work:notes/todo — so a command never acts on the wrong one. It sends each command to the MCP endpoint with an API key, so it can do what the key's scope allows. The commands below are generated from the CLI's own catalogue.
Install
Requires Node 22 or newer.
npm install -g @schupke/corpus-cli
Sign in
Create an API key in Integrations → API keys. corpus login asks for it without showing it, checks it against the server, and stores it with the server's address under a profile. --profile, --dev and --prod pick a profile for one command; corpus use makes one the default.
corpus login --url https://api.corpus.schupke.io corpus whoami
Paths
A path starts with its vault: work:notes/todo. Only the first colon divides, so a note name may contain more. work:notes/todo.md is the same note, and paths are always printed without the extension. A trailing slash marks a folder, and work: alone is the vault's root. A path without a vault is refused.
Output
Listings and search results print one record per line on stdout, never coloured or aligned. -l switches to tab-separated long form, -0 to NUL-separated records for xargs -0, and --json to the raw payload. Errors go to stderr, and so do summaries when stderr is a terminal.
open prints a Markdown note's exact bytes and a spreadsheet as tab-separated values. A drawing has no text, so open refuses one.
Configuration
Profiles are stored in ~/.config/corpus/config.json (under XDG_CONFIG_HOME when it is set), readable only by you. CORPUS_URL and CORPUS_TOKEN override the stored values, and --url and --token override both. CORPUS_DEBUG turns on --verbose.
Exit codes
The exit status says what went wrong, so a script can tell a missing note from a failed connection.
| Code | Meaning |
|---|---|
0 | Done. |
1 | Internal error. |
2 | Usage: an unknown command or flag, or a folder given without -r. |
3 | No API key, or the server rejected it. |
4 | The API key has read scope and the command writes. |
5 | The server refused the operation. |
6 | Network failure, timeout, rate limit or server error. |
7 | The config file is unreadable, malformed or written by a newer CLI. |
8 | No note or folder at that path. |
9 | Something already exists at the destination. |
130 | Interrupted. |
Global options
Every command accepts these, in any position.
| Flag | Type | Description |
|---|---|---|
--url | value | server origin, or the full /api/mcp endpoint |
--token | value | corpus_pat_… API key; also read from CORPUS_TOKEN |
--profile | value | use a named profile from the config |
--local | flag | shorthand for --url http://localhost:4283 |
--dev | flag | use the 'dev' profile |
--prod | flag | use the 'prod' profile |
--timeout | value | per-request timeout in ms (default 30000; 0 disables) |
--json | flag | print the raw payload as JSON instead of formatted records |
-0, --null | flag | separate output records with NUL, for xargs -0 |
-y, --yes | flag | assume yes for confirmations |
-q, --quiet | flag | suppress the stderr summaries |
--refresh | flag | ignore the cached tool list |
--no-color | flag | never colour stderr (NO_COLOR is honoured too) |
--verbose | flag | print diagnostics; also enabled by CORPUS_DEBUG |
-h, --help | flag | show this help, or a command's help |
-V, --version | flag | print the version |
Commands
Vault
corpus vaults
list the vaults, and what others share with you, each as VAULT: — where paths startcorpus vaults [-l]
| Flag | Type | Description |
|---|---|---|
-l, --long | flag | print name, id, and whether it is personal or shared with you |
corpus ls
list the entries in a foldercorpus ls [VAULT:PATH] [-R] [-l] [-d|-f] [--depth N]
| Flag | Type | Description |
|---|---|---|
-R, --recursive | flag | descend into subfolders, printing full paths instead of basenames |
-l, --long | flag | print kind and path, tab-separated |
-d, --dirs-only | flag | list folders only |
-f, --files-only | flag | list notes only |
--depth | value | how many levels to descend |
corpus tree
list a folder and everything under it, one path per linecorpus tree VAULT:[PATH] [--depth N] [-d]
| Flag | Type | Description |
|---|---|---|
--depth | value | how many levels to descend |
-d, --dirs-only | flag | list folders only |
corpus open
print a note's markdown to stdout byte for byte, or a spreadsheet as TSValias catcorpus open VAULT:PATH... [--header] [--ignore-missing]
| Flag | Type | Description |
|---|---|---|
--header | flag | print a ==> path <== header before each note |
--ignore-missing | flag | skip paths that do not exist instead of failing |
corpus stat
report whether a path is a note or a foldercorpus stat VAULT:PATH
Takes no options of its own.
corpus search
search note names and content in every vault, grep-stylecorpus search QUERY [--vault NAME] [--under VAULT:PATH] [--tag NAME]... [--type KIND]... [--limit N] [-d] [--match-path] [-l] [-c] [-q]
| Flag | Type | Description |
|---|---|---|
--limit | value | maximum number of hits to return |
--vault | value | search one vault instead of every vault |
--under | value | restrict the search to one folder, as VAULT:PATH |
-d, --dirs | flag | include folder hits alongside note hits |
--dirs-only | flag | return folder hits only |
--match-path | flag | match the full vault path, not just the note name and body |
--tag | value | only entries carrying this tag; repeatable, and all of them must match |
--type | value | only notes of this kind: markdown, canvas or spreadsheet; repeatable |
-l, --files-with-matches | flag | print each matching path once, with no line numbers |
-c, --count | flag | print the number of matches instead of the matches |
corpus create
create a note, making any missing folderswrite keycorpus create VAULT:PATH [--text S | --file F | -] [--force]
| Flag | Type | Description |
|---|---|---|
--text | value | take the content from this argument |
--file | value | take the content from a local file (- for stdin) |
--force | flag | overwrite the note when it already exists |
--allow-empty | flag | permit empty content, which is otherwise refused |
corpus mkdir
create a folder, making any missing parentswrite keycorpus mkdir VAULT:PATH... [-p]
| Flag | Type | Description |
|---|---|---|
-p, --parents | flag | create missing parents, and succeed if it already exists |
corpus write
overwrite a note's body from stdin, --text, or --filewrite keycorpus write VAULT:PATH [--text S | --file F] [--allow-empty]
| Flag | Type | Description |
|---|---|---|
--text | value | take the content from this argument |
--file | value | take the content from a local file (- for stdin) |
--allow-empty | flag | permit empty content, which is otherwise refused |
corpus append
append to a notewrite keycorpus append VAULT:PATH [--text S | --file F | -] [--no-newline]
| Flag | Type | Description |
|---|---|---|
--text | value | take the content from this argument |
--file | value | take the content from a local file (- for stdin) |
--no-newline | flag | do not insert a newline before the appended text |
corpus replace
substitute text inside a notewrite keycorpus replace VAULT:PATH FIND SUB [--regex] [--ignore-case] [--count N] [--dry-run] [-l]
| Flag | Type | Description |
|---|---|---|
--regex | flag | treat the pattern as a regular expression, matched per line |
--ignore-case | flag | match without regard to case |
--count | value | stop after this many replacements |
--dry-run | flag | report what would change without writing |
-l, --long | flag | print each replacement as path<TAB>line<TAB>text |
corpus mv
move or rename notes and folders within a vaultalias movewrite keycorpus mv VAULT:SRC VAULT:DEST | corpus mv VAULT:SRC... VAULT:DESTDIR/
| Flag | Type | Description |
|---|---|---|
-l, --long | flag | print each move as from<TAB>to |
--from-stdin | flag | read the paths to act on from stdin, one per line |
corpus rm
move notes and folders to the trashalias deletewrite keycorpus rm VAULT:PATH... [-r] [-f] [-i] [--file | --dir]
| Flag | Type | Description |
|---|---|---|
-r, --recursive | flag | allow deleting a folder and everything under it |
-f, --force | flag | ignore paths that do not exist, and never prompt |
-i, --interactive | flag | confirm before each deletion |
--file | flag | treat the path as a note, instead of inferring its kind |
--dir | flag | treat the path as a folder, instead of inferring its kind |
--from-stdin | flag | read the paths to act on from stdin, one per line |
corpus versions
list a note's saved versions, newest firstcorpus versions VAULT:PATH
Takes no options of its own.
corpus show-version
print the stored body of one saved versioncorpus show-version VERSION_ID
Takes no options of its own.
corpus restore
make a saved version current againwrite keycorpus restore VERSION_ID
Takes no options of its own.
corpus save-version
keep a note as it is now as a version in its historywrite keycorpus save-version VAULT:PATH
Takes no options of its own.
corpus tag
show or change the tags on one note or folderwrite keycorpus tag VAULT:PATH [-a NAME]… [-r NAME]… [--set NAMES] [-d|-f]
| Flag | Type | Description |
|---|---|---|
-a, --add | value | add a tag, creating it if new; repeatable, or comma-separated |
-r, --remove | value | remove a tag from this note or folder; the tag itself stays in the vault |
--set | value | replace the whole set with this comma-separated list |
-d, --dirs-only | flag | treat PATH as a folder |
-f, --files-only | flag | treat PATH as a note |
corpus star
star noteswrite keycorpus star VAULT:PATH...
Takes no options of its own.
corpus unstar
unstar noteswrite keycorpus unstar VAULT:PATH...
Takes no options of its own.
corpus starred
list starred notes in every vault, most recently edited firstcorpus starred [-l]
| Flag | Type | Description |
|---|---|---|
-l, --long | flag | print kind and path, tab-separated |
corpus usage
show what the account stores against its storage limitcorpus usage [--human]
| Flag | Type | Description |
|---|---|---|
--human | flag | print sizes in KiB/MiB/GiB instead of bytes |
Auth and profiles
corpus login
store an API key for a corpus servercorpus login [--url URL | --local] [--dev | --prod | --profile NAME] [--token PAT]
Takes no options of its own.
corpus logout
revoke a stored API key and forget itcorpus logout [--dev | --prod | --profile NAME] [--all]
| Flag | Type | Description |
|---|---|---|
--all | flag | remove every stored profile, not just the current one |
corpus status
show the configured server and API key, without contacting itcorpus status [--dev | --prod | --profile NAME]
Takes no options of its own.
corpus whoami
report what this API key can do (cached; --refresh to re-check)corpus whoami [--dev | --prod | --profile NAME] [--refresh]
Takes no options of its own.
corpus profiles
list stored profilescorpus profiles
Takes no options of its own.
corpus use
make a profile the defaultcorpus use PROFILE
Takes no options of its own.
corpus tools
list the tools this API key is grantedcorpus tools
Takes no options of its own.