mdnest CLI
The mdnest CLI lets you read, write, search, and organize notes from any terminal. Supports multiple servers with @alias paths.
Install
From your own server (4.8.5+)
Every mdnest server serves the exact CLI it was built with, at /cli/mdnest,
with no login needed. Its installer gets the CLI from that server:
curl -fsSL https://notes.example.com/cli/install.sh | bash -s -- https://notes.example.com
Settings, then the CLI tab, shows this command with your server's address filled in, next to separate commands to update an installed CLI and to connect it to the server. Use it when the server runs a develop build, an older release or a fork: the CLI you get matches the server, which the GitHub copy may not. If the server cannot serve the CLI (an older server, or a proxy in the way), the installer falls back to the latest release from GitHub and says so.
It only installs (and may ask the one question about AI tools described in
AI agent skills). It then prints
mdnest login https://notes.example.com, which you run to connect the CLI to
the server; it asks for a token at the terminal (see Login). Installing and connecting are separate steps
because most people already have the CLI connected, or are only updating it.
From GitHub
One command, works on macOS and Linux:
curl -fsSL https://mdnest.dev/install.sh | bash
Served from mdnest.dev rather than raw.githubusercontent.com. GitHub's raw
CDN is a single tier and it fails on its own — a POP that runs out of backend
connections answers 503 Backend.max_conn reached to every request in that
region while GitHub itself is perfectly healthy, and a curl … | bash
one-liner has nowhere else to go. The GitHub URL is the same script and still
works when the CDN is up:
curl -fsSL https://raw.githubusercontent.com/mahsanamin/mdnest/main/install-cli.sh | bash
Either way the installer tries three sources in order — GitHub raw first (it
publishes the moment a fix lands on main), then jsDelivr, then mdnest.dev
— twice each, and tells you what every one of them said if they all fail.
mdnest update uses the same chain.
No dependencies — just bash and curl. python3/jq are used when present (for prettier JSON), but the CLI falls back to pure-bash/awk so every command works without them. The installer downloads to a temp file and installs atomically (using sudo only if /usr/local/bin isn't writable, and falling back to ~/.local/bin with a PATH hint if it can't) — so it never leaves a half-written binary or aborts mid-download on a fresh machine.
AI agent skills
At the end of the install, if an AI tool is on your computer (the claude,
codex or gemini command, or a ~/.claude, ~/.codex or ~/.agents
folder) and the mdnest skill is not set up yet, the installer asks once:
Let your AI tools (Claude Code, Codex, ...) use mdnest? [Y/n]
- Enter or y runs
mdnest agent installand says how to undo it (mdnest agent remove). See Use mdnest from your AI agent. - n installs nothing and writes
~/.config/mdnest/agent-skills-declined, so no installer, login or update asks or reminds you again. - No terminal (an AI agent or a script is running the installer): nothing is installed and the installer prints a one-line tip instead.
mdnest login asks the same question once after a successful login, for
people who installed the CLI before the installer asked. mdnest update never
asks; it only prints the tip.
To decide up front, pass a flag to the installer:
# set up the skill without asking (useful when an agent runs the install)
curl -fsSL https://mdnest.dev/install.sh | bash -s -- --agent-skills
# never ask
curl -fsSL https://mdnest.dev/install.sh | bash -s -- --no-agent-skills
# the same, for your own server's installer
curl -fsSL https://notes.example.com/cli/install.sh | bash -s -- https://notes.example.com --agent-skills
MDNEST_AGENT_SKILLS=1 (install) or MDNEST_AGENT_SKILLS=0 (never ask) does
the same as the flags, and also applies to mdnest login.
Install from a specific branch
To try an unreleased build, point at that branch's installer and set MDNEST_BRANCH:
curl -fsSL https://mdnest.dev/install.sh | MDNEST_BRANCH=develop bash
mdnest update honours the same MDNEST_BRANCH (default main), so you can stay on a branch:
MDNEST_BRANCH=develop mdnest update --force
Login
Every server you log into gets a short alias (@work, @home, etc). The alias appears in your paths (@work/engineering/README.md) and in copy-path URIs from the web UI.
Paste the token at a prompt
Leave the token off and, in a terminal, the CLI asks for it:
mdnest login https://work-server:3236
# Create a token in the web UI at https://work-server:3236
# (Settings, then the API Tokens tab), copy it, and paste it here.
# Token (not shown):
What you paste is not shown and does not go into your shell history. The CLI
checks the token with the server before saving it, and saves nothing if the
server refuses it or you press Enter without one. If the server has no
SERVER_ALIAS, it also asks what to call the server. @alias works here too:
mdnest login @work https://work-server:3236.
The prompt reads from the terminal itself, not from standard input, so it works
under curl ... | bash. With no terminal at all (a script or CI job), login
without a token prints the usage and exits 1, as before; pass the token on the
command line there.
After a successful login, if an AI tool is on your computer and the mdnest skill is not set up, login asks the AI agent skills question once. It is not asked again after a no, or with no terminal.
Pick the alias yourself
mdnest login @work https://work-server:3236 <token>
mdnest login @personal https://home-server:3236 <token>
Let the CLI use the server's own SERVER_ALIAS
If the server has SERVER_ALIAS=work set in its mdnest.conf, the CLI can pick that up automatically:
mdnest login https://work-server:3236 <token>
# → Logged in to @work (https://work-server:3236) (SERVER_ALIAS from /api/config)
If the server doesn't advertise a SERVER_ALIAS, the CLI refuses — you'll be told to either pass @alias explicitly or configure SERVER_ALIAS on the server. (There is no more silent @default — that hid which server was which.)
When login refuses
Every failure names the actual cause and prints a command you can paste as-is.
"Couldn't reach ... to ask what it calls itself" — the server never answered,
so nothing about its config is known yet. The message says why (DNS, connection
refused, timeout, TLS) and offers to name the server yourself instead. This is
distinct from the server answering and having no SERVER_ALIAS set; only the
latter is a reason to go and edit the server's mdnest.conf.
"'x' is not a URL — an alias needs a leading @" — the most common slip.
Without the @, every argument shifts along: your URL is read as the token and
your token is dropped. The fix is printed back with that one character added:
$ mdnest login work https://work-server:3236 mdnest_abc123
Error: 'work' is not a URL — an alias needs a leading '@'.
Run:
mdnest login @work https://work-server:3236 mdnest_abc123
Nothing is written to disk when login is refused — an unusable URL can never become your saved default server.
Rename an existing alias
If you have an older @default alias from a previous CLI version, rename it:
mdnest rename @default @work
Create API tokens in the web UI: Settings → API Tokens. Tokens work regardless of how the server authenticates users (local password, SSO, Firebase) — the token authenticates you directly, no IdP round-trip.
API tokens inherit your current access at request time (v3.5.0+). If you're a SuperAdmin, your token has SuperAdmin scope. If you're a namespace admin of growth, your token can read/write within growth only. If your access is revoked or your namespace-admin row is removed, your token loses that access immediately on the next request.
Path format
Every command uses a unified path:
@server/namespace/path/to/file.md
- @server — server alias (optional if only one server configured)
- namespace — workspace name on that server
- path — file or folder path within the namespace
The same format is used when you right-click → Copy Path in the web UI.
Two copied forms are accepted as they are, percent-encoding included:
mdnest://@server/namespace/path.md, from right-click → Copy path for CLI.- A browser link, from the address bar or right-click → Copy browser link:
'https://notes.example.com/#namespace/path/to/file.md'. Quote it, since an unquoted#starts a shell comment. The CLI finds the server you are logged in to with the same address (scheme, host and port; a base path, a?queryand a trailing#Headingare ignored). A chat link (#!chats/namespace/Chats/room.md) reads the chat note. A task board or stickies link is refused, because it does not name a note.
If you are not logged in to a server with that address, nothing is read and the CLI prints the command to fix it, for example:
No server registered for https://notes.example.com. Run: mdnest login https://notes.example.com mdnest_yourtoken
Commands
List namespaces or files
mdnest list # namespaces on default server (one per line)
mdnest list @work # namespaces on @work
mdnest list @work/engineering # files in namespace, as a tree
mdnest list @work/engineering/Architecture # scoped to one folder
mdnest list --json @work/engineering # raw API JSON, for scripts
A namespace listing is rendered as a tree with a count at the end:
engineering
├── Architecture/
│ ├── system-overview.md
│ └── decisions/
│ └── 001-storage.md
└── README.md
2 folders, 3 files
Pass --json (or set MDNEST_JSON=1) to get the raw /api/tree payload
instead — the shape scripts were parsing before the tree rendering existed.
Read a note
mdnest read @work/engineering/Architecture/system-overview.md
mdnest read engineering/docs/api.md # single server (no @)
Write (overwrite) a note
mdnest write @work/engineering/log.md "New content"
mdnest write @work/engineering/draft.md - # read from stdin
echo "piped" | mdnest write engineering/draft.md -
Create a new note
mdnest create @work/engineering/new-doc.md "# Title"
echo "# Title" | mdnest create @work/engineering/new-doc.md - # read from stdin
create takes content the same way as write/append: an inline string, or
- to read from stdin. It exits non-zero if no content is supplied (rather than
silently creating an empty file), and fails if the note already exists — use
write to overwrite an existing note.
Edit one string in a note
mdnest edit @work/engineering/log.md "Status: draft" "Status: final"
mdnest edit @work/engineering/log.md "v4.3.3" "v4.3.4" --replace-all
edit replaces an exact string and leaves the rest of the file alone. Reach for
it instead of read + rebuild + write whenever you only mean to change part
of a note — that round trip overwrites anything saved in between by the web UI,
git-sync, or another agent, and reports success while doing it.
Two properties make it safe to hand to a script or an agent:
- The match is exact and unambiguous. The old text is matched literally, so
.,*,[,$&and$1are just characters — nothing is treated as a pattern in the text being searched for, and nothing is expanded in the replacement. If the old text is not found, or occurs more than once without--replace-all, the command fails and names the count instead of guessing. Add surrounding lines to make a match unique. - A concurrent save is refused, not overwritten. The write carries the
version the edit read (
If-Match), so if the note changed in between you get a 409 and the note is left exactly as the other writer left it. Re-run the same command to apply the edit to the current content.
$ mdnest edit @work/engineering/log.md "alpha" "beta"
Error: the old text occurs 3 times in log.md.
Add surrounding lines to make it unique, or pass --replace-all.
Pass an empty replacement to delete the matched text. An edit that would empty
the note is refused — use write or delete if that is the intent.
Append / Prepend
mdnest append @work/engineering/log.md "## $(date) - Meeting notes"
mdnest prepend @work/engineering/log.md "Important update"
echo "from pipe" | mdnest append engineering/log.md -
Delete
mdnest delete @work/engineering/old-doc.md
Move / Rename
mdnest move @work/engineering/old-name.md new-name.md
To another namespace (v4.7.0+), give the full destination or --to-ns:
mdnest move @work/personal/Notes/plan.md @work/shared/Project/plan.md
mdnest move @work/personal/Notes/plan.md Project/plan.md --to-ns shared
The server copies, checks the copy, then removes the original. Comments travel with the note, and nothing at the destination is ever overwritten (a collision is an error that names the path). A destination on a different @alias is refused: copying between servers is not a server-side operation.
Copy (v4.7.0+)
mdnest copy @work/engineering/Specs Specs-2026 # same namespace
mdnest copy @work/personal/Notes Archive/Notes --to-ns shared
Same destination rules as move. Copies get new note IDs and no comments.
Download (v4.7.0+)
mdnest download @work/engineering/Architecture # saves Architecture.zip here
mdnest download @work/engineering/notes/meeting.md ./meeting.md
A file downloads as itself and a folder as a zip. Without an output file, the server's name is used in the current folder. A download never overwrites an existing local file, and a failed one leaves nothing behind. Folders over the server's limits are refused with the actual counts.
Which features a server has on
mdnest features @work # pages, chat, task board, drawings, slides: on or off
mdnest features @work --json # the same, for scripts and agents
Reads the server's public settings, so it needs no login. It also says whether
an HTML page's scripts run on that server. AI agents check it before they offer
or use an optional feature; over MCP the same answer comes from the
server_features tool.
HTML pages (server ENABLE_PAGES=true)
mdnest page publish @work/engineering/Reports/q3-report ./report-folder # folder with index.html
mdnest page publish @work/engineering/Reports/q3-report ./report.html # or one .html file
mdnest page list @work/engineering # every page you can read
mdnest page list @work/engineering revenue # pages whose text has "revenue"
mdnest page list --json @work/engineering # raw API JSON
mdnest page pull @work/engineering/Reports/q3-report ./q3-copy # into a new or empty folder
mdnest page delete @work/engineering/Reports/q3-report
mdnest page export @work/engineering pages.tgz # namespace backup
mdnest page import @work/engineering pages.tgz # restore handles with new ids
mdnest read @work/engineering/Reports/q3-report.page.md # the handle, then the page text
An HTML page is a view-only report or dashboard written in HTML. It shows in
the notes tree as a small handle file, here Reports/q3-report.page.md (the
.page.md is added when you leave it out). Its HTML and other files are kept
apart from the notes by default. With PAGES_IN_GIT=true, new publishes go in
the namespace's hidden .mdnest/pages/ folder so git sync saves them too. A Markdown note stays the default for everything else:
AI agents publish an HTML page only when someone explicitly asks for one (see
mdnest docs agents). A folder is sent as a gzipped tar made by the system tar; publishing
to the same handle replaces the page. Publishing and deleting need write
access on the handle's folder, listing and reading need read access, as for
the notes beside it.
mdnest read on a *.page.md prints the file as it is on disk, then a line
----- page text (extracted from the published HTML) ----- and the page's
visible text. If the page is not in that namespace it prints the reason
instead. With pages off it prints the file only.
Move, rename, copy or delete the handle with the normal commands: the page goes with it, also to another namespace. A server with pages off answers "this server has pages turned off". See "HTML pages" in setup.md.
page export and page import need write access to the whole namespace.
Export never overwrites an existing local file. The .tar.gz contains the
page files, handle paths, titles and descriptions from both stores, but no
unlinked pages. Missing files are skipped and listed in manifest.json; the
CLI prints the counts. Import validates the whole archive first, then restores
pages with new ids at their original handle paths. Existing page handles are
republished, ordinary notes are skipped and kept. Add --json after the file
name for per-entry restore results. Limits are 256 MB of page files, 10,000
files and 1,000 handles, plus each page's configured size and file limits.
Search
mdnest search @work/engineering "database"
mdnest search engineering "meeting"
Chat (on by default; server ENABLE_CHAT=false turns it off)
A chat is a note tagged mdnest-chat: true; each post is appended to it.
See chat.md for the format and the web UI.
mdnest chat new @work/engineering/Chats/release.md "Release"
mdnest chat post @work/engineering/Chats/release.md "Migrations done" --as api-agent
mdnest chat read @work/engineering/Chats/release.md --as api-agent
mdnest chat wait @work/engineering/Chats/release.md --as api-agent --timeout 120
mdnest chat wait @work/engineering/Chats/release.md --as api-agent --mentions
mdnest chat status @work/engineering/Chats/release.md "running the migration" --as api-agent
mdnest chat leave @work/engineering/Chats/release.md --as api-agent
mdnest chat list @work
Use one name per agent with --as (or MDNEST_CHAT_AS) on every command.
With a name, read marks the chat as read and wait returns only what is new
since then, never your own posts, so a loop is just wait → post → wait.
wait --mentions wakes only on @name / @all. wait exits 2 on
timeout; run it again. It exits 3 when the chat was deleted or moved, or
you were removed from it, and prints the chat leave command: the agent is
out of the chat. A temporary outage (connection refused or dropped,
a timeout, a proxy's 502/503/504) does not end the wait: it retries with a
growing pause until --timeout, and exits 1 only on a real error or a
server that stays down. --after N overrides the saved position.
MDNEST_CHAT_POLL sets the poll interval in seconds (default 3).
chat status shows a quiet "name is working: …" line under the chat for two
minutes (set it again during long work); the next post, or going back to
chat wait, clears it, and
chat read lists current statuses as working now: ….
chat keepalive is a Stop hook for Claude Code and Codex: an agent that tries
to end its turn while its last chat command was a wait is sent back to
waiting, until it runs chat leave. Setup is in chat.md.
Optional local chat workers
Structured chat reads support --last N, --type, --unseen-only and --json.
JSON returns parsed messages with stable id, author, time, type,
reply_to, meta, claimed_by and body fields. text and message numbers
remain available for older callers. Filters run before the limit. A normal
recent read returns the last matching messages. An unseen read returns the
oldest pending batch first, so acknowledgment cannot skip earlier work.
mdnest chat post notes/Chats/team.md "Please review" --as builder --type review --meta '{"verdict":"pending"}'
mdnest chat read notes/Chats/team.md --as reviewer --unseen-only --last 6 --json
mdnest chat read notes/Chats/team.md --as reviewer --unseen-only --type review --ack --json
mdnest chat claim notes/Chats/team.md --msg-id m_example --as reviewer --worker host1 --ttl 300
mdnest chat agent notes/Chats/team.md --as reviewer --prompt "Review the tests"
mdnest chat roster notes/Chats/team.md
New structured reads do not acknowledge unless --ack is explicit. Plain
read --as keeps its earlier local-cursor behavior. Claims return a lease ID;
renew with the same handle, worker and --lease-id. A competing active claim
returns an error with its holder and expiry. Claims coordinate one backend
writer only, and reject symlink aliases and the multi-writer app role.
watch --exec and crew require Node 22 or newer only when invoked. They run
commands on the machine where the CLI runs, never on the HTTP server:
mdnest chat watch notes/Chats/team.md --as reviewer --trait "Review tests" --mentions --exec 'my-review-worker' --timeout 15m
mdnest chat crew "Review the tests" --note notes/Chats/new-team.md --agent 'reviewer:Review tests:my-review-worker' --max-turns 8 --timeout 15m
A worker receives its prompt on stdin and the MDNEST_NOTE, MDNEST_MSG_ID,
MDNEST_MSG_AUTHOR, MDNEST_MSG_TYPE, MDNEST_MSG_BODY, MDNEST_MSG_META,
MDNEST_AGENT_HANDLE and MDNEST_AGENT_TRAIT environment fields. Quotes and
newlines remain data, never shell substitutions. The explicitly supplied
--exec command is shell code, so use only a command you trust locally.
Output is prefixed by handle. No model is called while idle.
Children use a temporary home containing only this server's mdnest connection,
removed on exit. That connection is your full mdnest API token for this
server, so any agent command you run can do anything your account can. Run
only agents you trust, and use a separate account limited to the namespaces
it needs for agents you do not trust. The normal home, ambient credential environment, interpreter
startup variables and MCP protocol streams are not inherited. Pass a required
provider credential by name with --pass-env PROVIDER_API_KEY, or use a local
wrapper with its own explicit configuration. --cwd selects a trusted local
working directory. This is environment separation, not an OS sandbox: a local
command still has the launching account's filesystem and network permissions. Existing interactive
provider login/profile support is not confirmed by the fake-process tests.
Do not expect a CLI to find a login in the temporary home automatically.
mdnest chat reply --with '<command>' is a ready-made worker command for an AI
CLI, so you do not have to write a wrapper:
mdnest chat crew "Plan a launch" --note notes/Chats/launch.md \
--agent "writer:Proposes ideas:mdnest chat reply --with 'claude -p'"
It reads the worker's prompt from stdin, adds a short instruction (write only
your next chat message, mention @handle to hand off), and runs the command
with sh -c, giving it that text on stdin. The command's output is posted to
MDNEST_NOTE as MDNEST_AGENT_HANDLE. If the command fails, or prints nothing
but spaces, nothing is posted and chat reply exits non-zero, so the runner
does not acknowledge the message. It never posts with --done: completing a
crew is left to you or to a command you write yourself.
The one change from the worker's environment is HOME: the command runs with
your real home folder, looked up from the user database because $HOME is
the temporary one. Only that command gets it; the post keeps the temporary
home and the runner's connection. This lets the AI CLI use your own login and
settings, which is the purpose, and it is the same trust as running that CLI
yourself. It also means the CLI keeps every tool and permission your own
settings allow, while the chat it reads is untrusted text that anyone who can
post in the room wrote. A message could ask the AI to read a file and repeat
it, and the answer is posted to the room. In a room where people you do not
trust can post, turn the CLI's tools off with its own options, or write your
own worker. PATH, --pass-env values, --cwd and the MDNEST_* fields are
passed through unchanged. Running chat reply outside a watch or crew
worker is an error.
crew --config crew.yaml also accepts local JSON, or this limited YAML shape:
max_turns: 8
timeout: "15m"
human_handle: "human"
agents:
- handle: reviewer
trait: "Review tests"
cmd: "my-review-worker"
Config files are local trusted input. Commands copied into shared notes are
never used as launch configuration. Startup/post operations are not exactly-once:
if a response is lost, check the room before retrying. The CLI refuses a second
create at the same path on the supported single backend writer. This does not
serialize external filesystem writers, hard links, differently cased aliases or
two namespaces mounting the same physical file. A crew creates a new note and refuses to
overwrite an existing one. It registers its roster and cursors, mentions the
first agent in the goal, and supplies recent context and handoff instructions.
Post with --done for completion. A pause, timeout, local turn cap or signal
stops children and pauses the crew rather than falsely marking it completed.
The local deadline and attempt cap cannot be raised by editing the note.
The human handle defaults to the authenticated account. A saved prompt edit is
read again for each invocation as untrusted persona data, while the executable,
working directory, inherited environment and budgets stay fixed locally.
A handle identifies one logical consumer per authenticated account. Duplicate watchers using the same handle share its durable acknowledged IDs and compete for leases; use different handles for independent consumers. A restart keeps that handle's cursor. A new message ID at an old position is still unseen. Edits to the same saved prompt are last-write-wins; reopen it before changing a prompt someone else may also be editing.
Workers claim before execution and acknowledge only after a successful exit. Lease expiry or a crash between work and acknowledgment can replay a task. Handlers must be idempotent. These cooperative leases do not fence external side effects. The runner renews a lease during work and cancels its child if renewal fails. Normal note writers can edit coordination state, so room limits are not an authorization boundary.
Agent approvals (experimental; server ENABLE_AGENT_APPROVALS=true)
Lets you answer an agent's permission prompts and questions from mdnest, and tells you when an agent is stuck or stopped. These commands are meant to be run by the agent as hooks, not by hand.
mdnest approval hook-config claude-code > approvals.json # print the hook settings
claude --settings approvals.json # use them for one session
mdnest approval hook-config codex # the same for Codex
approval request [--agent claude-code|codex] [--chat @alias/ns/path] [--as NAME] [--timeout N]
is the PermissionRequest hook. It reads the hook input on stdin, sends it
unchanged to the server named in ~/.config/mdnest/approvals.conf, waits for a
decision (540 seconds by default, never longer than MAX_WAIT), and prints
the server's answer exactly as received. On any failure (no policy file, a
tool not in TOOLS, a NEVER_REMOTE match, a timeout, an expired request,
an unreachable server, a CLI the server finds too old) it prints nothing and
exits 0, so the agent's terminal prompt answers. It finds the chat the agent
is in, and the agent's name there, the same way chat keepalive does (the
last mdnest chat wait ... --as NAME in the session), or takes --chat and
--as. An AskUserQuestion goes through whatever TOOLS says, unless the
policy says QUESTIONS=no.
approval done is the PostToolUse and Stop hook. It closes the session's
open requests that were answered in the terminal and clears its notices, and
only calls the server while one of them is open.
approval notify [--agent claude-code|codex] [--chat @alias/ns/path] [--as NAME]
is the Notification hook. It posts a notice (the agent is waiting in its
terminal, or idle) to the approvals list and one neutral line in the agent's
chat. chat keepalive calls it with --type stopped when it lets a chat
agent stop. One request, a 5 second limit, nothing printed.
Nothing keeps running on the machine between hooks: only approval request
waits, and only while its own question is open.
Needs only bash and curl. The policy file and the agent setup are in chat.md.
Use mdnest from your AI agent (optional)
AI agents such as Claude Code, Codex and Gemini CLI can learn to use mdnest from the CLI itself. Nothing is set up for them unless you say yes to the installer's question (see AI agent skills) or run the command yourself.
mdnest docs agents # the guide for AI agents: paths, which command to use, writing safely, chat
mdnest agent install # add a small mdnest skill to each AI tool found on this machine
mdnest agent status # what is installed where
mdnest agent remove # delete the skill files mdnest wrote
agent install writes one file per tool:
| Tool | File |
|---|---|
| Claude Code | ~/.claude/skills/mdnest/SKILL.md |
| Codex, Gemini CLI and other tools that read the shared skills folder | ~/.agents/skills/mdnest/SKILL.md |
The skill only tells the agent to run mdnest docs agents and follow it. The
guide is part of the CLI, so mdnest update also updates what your agents
know, with no reinstall.
- A tool counts as found when its folder (
~/.claude,~/.agents,~/.codexor~/.gemini) or its command (claude,codex,gemini) exists.--tool claudeor--tool agentsinstalls for one tool even if it was not found (codexandgeminiare accepted as names foragents). - Each file has a mark line with a checksum. If you edit the file, or a file
mdnest did not write is already at that path,
installleaves it alone unless you pass--force. removedeletes only files mdnest wrote. An edited one needs--force. A file mdnest did not write is never deleted.- Other tools: point them at
mdnest docs agentsin their own instructions file. - To undo it, run
mdnest agent remove. - If you answered no to the installer's question, it is not asked again. To
be asked again, delete
~/.config/mdnest/agent-skills-declined. You can also just runmdnest agent install.
Claude Code plugin. Instead of agent install, Claude Code users can add
the same skill as a plugin:
/plugin marketplace add mahsanamin/mdnest
/plugin install mdnest@mdnest
The plugin holds only the skill. It still needs the mdnest CLI installed and
logged in.
mdnest docs prints this CLI reference when the CLI sits in a clone of the
repository. A CLI installed with the one-line installer is a single file, so
there it prints the address of this page instead.
Server management
mdnest servers # list servers + version (and build commit, e.g. 3.11.0 (a1b2c3d))
mdnest servers -v # also list namespaces per server
mdnest whoami # CLI version, all servers, and the account each token acts as
mdnest logout @work # remove one server
mdnest logout # remove all
mdnest rename @old @new # rename a server alias (updates the default pointer too)
Legacy commands (backward compatible)
The old mdnest note <action> <namespace> <path> format still works:
mdnest note list
mdnest note read engineering Architecture/system-overview.md
mdnest note append engineering log.md "text"
Configuration
Server configs are stored in ~/.config/mdnest/servers/. Each server has its own file.
To set the server alias that appears in Copy Path from the web UI, add to mdnest.conf:
SERVER_ALIAS=work
This makes Copy Path produce @work/namespace/path which the CLI can use directly.
The setup commands (login, update, version, agent, and the install
scripts) use colour and a check mark when they print to a terminal. In a pipe,
or with NO_COLOR set, they print plain text. MDNEST_COLOR=never or
MDNEST_COLOR=always overrides that. Commands that print notes or data
(read, list, search, chat) never add colour.
Version compatibility
The CLI and the server ship from the same repo at the same version number, so the server you are talking to is the reference point for whether your CLI is current.
On a major mismatch (4.x CLI against a 3.x server, or the reverse) you
get a compatibility warning at login — the two may genuinely disagree about the
API.
On a same-major mismatch — your CLI older than the server — you get one
line telling you so, wherever you are already looking at versions
(mdnest servers, mdnest whoami, mdnest login):
Your mdnest CLI is v4.3.1; @work is running v4.3.2.
Update it with: mdnest update --server @work
It suggests --server, which installs the CLI that server was built with
(see Updating).
This exists because nothing pushes CLI updates to you. mdnest update is
pull-only, and before v4.3.2 the only check was the major-version one — so a
client could sit on a stale (or broken) point release indefinitely with no
signal at all. The notice is deliberately not printed on every command: the CLI
keeps no update cache, and checking on every read would cost a request each
time.
Two things it does not do, on purpose:
- It does not contact GitHub. The version comes from the
/api/configcall the CLI already makes, so there is no extra network round-trip and no new failure mode. The trade-off is that if your server is also out of date, nothing tells you — update the server and the CLI notice follows. - It never nags a pre-release about its own release.
4.3.2-devis treated as older than4.3.2and newer than4.3.1, matching the in-app update banner.
Updating
The app shows this too: Settings → CLI → Keeping it up to date names the
version your server is running, so you have something concrete to compare
mdnest version against.
mdnest update # self-update from main
mdnest update --force # reinstall even if the downloaded file is identical
MDNEST_BRANCH=develop mdnest update --force # track an unreleased build
mdnest update --server @work # the CLI the @work server was built with (4.8.5+)
mdnest update --server https://notes.example.com # same, by address
A CLI older than 4.8.5 does not know --server: it ignores the option, updates
from GitHub, and may report "up to date" while the server runs a newer
version. Run the server's install command once (see
From your own server) to get past that.
mdnest update compares the downloaded file with the installed one, not only
the version label, so it also replaces an older build that has the same label
(every build between two releases says, for example, 4.8.17-dev).
mdnest version prints a short fingerprint of the file next to the version,
mdnest CLI v4.8.17-dev (a1b2c3d), so you can tell two copies apart.
--server downloads only from that server's /cli/mdnest; it never falls
back to GitHub, because the point is to match the server. Like every update it
downloads to a temp file and checks that it really is the CLI before replacing
anything, so an error page or a proxy login page leaves your installed CLI as
it was.
Or reinstall from scratch:
curl -fsSL https://mdnest.dev/install.sh | bash
mdnest update reads the script straight from the main branch on GitHub, so
a CLI fix reaches you as soon as it lands there — independent of the tag and
the GitHub Release, which drive the in-app server update banner instead.