Skip to content

Command-line client

A path-addressed, line-oriented client for a Corpus vault. It talks to the same MCP endpoint an editor does, so a token is all it needs. The commands below come from the CLI's own catalogue.

Install

Requires Node 22 or newer.

npm install -g @schupke/corpus-cli

Sign in

Store a token per server, then switch between them with a flag.

corpus login --url https://corpus.schupke.io
corpus whoami

Global options

Every command accepts these, in any position.

FlagTypeDescription
--urlvalueserver origin, or the full /api/mcp endpoint
--tokenvaluecorpus_pat_… token; also read from CORPUS_TOKEN
--profilevalueuse a named profile from the config
--localflagshorthand for --url http://localhost:4282
--devflaguse the 'dev' profile
--prodflaguse the 'prod' profile
--timeoutvalueper-request timeout in ms (default 30000; 0 disables)
--jsonflagprint the raw payload as JSON instead of formatted records
-0, --nullflagseparate output records with NUL, for xargs -0
-y, --yesflagassume yes for confirmations
-q, --quietflagsuppress the stderr summaries
--refreshflagignore the cached tool list
--no-colorflagnever colour stderr (NO_COLOR is honoured too)
--verboseflagprint diagnostics; also enabled by CORPUS_DEBUG
-h, --helpflagshow this help, or a command's help
-V, --versionflagprint the version

Commands

Vault

corpus ls

list the entries in a folder
corpus ls [PATH] [-R] [-l] [-d|-f] [--depth N]
FlagTypeDescription
-R, --recursiveflagdescend into subfolders, printing full paths instead of basenames
-l, --longflagprint kind and path, tab-separated
-d, --dirs-onlyflaglist folders only
-f, --files-onlyflaglist notes only
--depthvaluehow many levels to descend

corpus tree

list a folder and everything under it, one path per line
corpus tree [PATH] [--depth N] [-d]
FlagTypeDescription
--depthvaluehow many levels to descend
-d, --dirs-onlyflaglist folders only

corpus open

print a note's markdown to stdout, byte for bytealias cat
corpus open PATH... [--header] [--ignore-missing]
FlagTypeDescription
--headerflagprint a ==> path <== header before each note
--ignore-missingflagskip paths that do not exist instead of failing

corpus stat

report whether a path is a note or a folder
corpus stat PATH

Takes no options of its own.

corpus create

create a note, making any missing folderswrite token
corpus create PATH [--text S | --file F | -] [--force]
FlagTypeDescription
--textvaluetake the content from this argument
--filevaluetake the content from a local file (- for stdin)
--forceflagoverwrite the note when it already exists
--allow-emptyflagpermit empty content, which is otherwise refused

corpus mkdir

create a folder, making any missing parentswrite token
corpus mkdir PATH... [-p]
FlagTypeDescription
-p, --parentsflagcreate missing parents, and succeed if it already exists

corpus write

overwrite a note's body from stdin, --text, or --filewrite token
corpus write PATH [--text S | --file F] [--allow-empty]
FlagTypeDescription
--textvaluetake the content from this argument
--filevaluetake the content from a local file (- for stdin)
--allow-emptyflagpermit empty content, which is otherwise refused

corpus append

append to a notewrite token
corpus append PATH [--text S | --file F | -] [--no-newline]
FlagTypeDescription
--textvaluetake the content from this argument
--filevaluetake the content from a local file (- for stdin)
--no-newlineflagdo not insert a newline before the appended text

corpus replace

substitute text inside a notewrite token
corpus replace PATH FIND SUB [--regex] [--ignore-case] [--count N] [--dry-run] [-l]
FlagTypeDescription
--regexflagtreat the pattern as a regular expression, matched per line
--ignore-caseflagmatch without regard to case
--countvaluestop after this many replacements
--dry-runflagreport what would change without writing
-l, --longflagprint each replacement as path<TAB>line<TAB>text

corpus mv

move or rename notes and foldersalias movewrite token
corpus mv SRC DEST   |   corpus mv SRC... DESTDIR/
FlagTypeDescription
-l, --longflagprint each move as from<TAB>to
--from-stdinflagread the paths to act on from stdin, one per line

corpus rm

delete notes and foldersalias deletewrite token
corpus rm PATH... [-r] [-f] [-i] [--file | --dir]
FlagTypeDescription
-r, --recursiveflagallow deleting a folder and everything under it
-f, --forceflagignore paths that do not exist, and never prompt
-i, --interactiveflagconfirm before each deletion
--fileflagtreat the path as a note, instead of inferring its kind
--dirflagtreat the path as a folder, instead of inferring its kind
--from-stdinflagread the paths to act on from stdin, one per line

corpus versions

list a note's saved versions, newest first
corpus versions PATH

Takes no options of its own.

corpus show-version

print the markdown of one saved version
corpus show-version VERSION_ID

Takes no options of its own.

corpus restore

make a saved version current againwrite token
corpus restore VERSION_ID

Takes no options of its own.

corpus tags

list and manage the tag library
corpus tags [-l] | corpus tags add NAME [--color C] | corpus tags rm NAME | corpus tags rename OLD NEW | corpus tags color NAME C|none
FlagTypeDescription
-l, --longflagprint name, colour and use counts, tab-separated
--colorvaluehex colour for `add`, e.g. '#3b82f6'
--unusedflaglist only tags nothing carries

corpus tag

show or change the tags on one note or folderwrite token
corpus tag PATH [-a NAME]… [-r NAME]… [--set NAMES] [-d|-f]
FlagTypeDescription
-a, --addvalueadd a tag, creating it if new; repeatable, or comma-separated
-r, --removevalueremove a tag from this entry; the tag itself stays in the library
--setvaluereplace the whole set with this comma-separated list
-d, --dirs-onlyflagtreat PATH as a folder
-f, --files-onlyflagtreat PATH as a note

Auth and profiles

corpus login

store a token for a corpus server
corpus login [--url URL | --local] [--dev | --prod | --profile NAME] [--token PAT]

Takes no options of its own.

corpus logout

forget a stored token
corpus logout [--dev | --prod | --profile NAME] [--all]
FlagTypeDescription
--allflagremove every stored profile, not just the current one

corpus status

show the configured server and token, without contacting it
corpus status [--dev | --prod | --profile NAME]

Takes no options of its own.

corpus whoami

report what this token can do (cached; --refresh to re-check)
corpus whoami [--dev | --prod | --profile NAME] [--refresh]

Takes no options of its own.

corpus profiles

list stored profiles
corpus profiles

Takes no options of its own.

corpus use

make a profile the default
corpus use PROFILE

Takes no options of its own.

corpus tools

list the tools this token is granted
corpus tools

Takes no options of its own.