# Command line

> The datanotes command and its options.

```text
datanotes 3.10.0: Markdown notes as database tables, for you and your agents.


Usage:
  datanotes serve --database <folder> [options]   run the engine and its HTTP API (/datanotes/*)
  datanotes status --database <folder> [--json]   the running engine's health
  datanotes stop --database <folder> [--timeout-s <s>] stop the running engine gracefully
  datanotes store path --database <folder>        where the engine keeps the database's store
  datanotes store new-id --database <folder>      a new database id (a copied folder gets its own store)
  datanotes store backup --database <folder>      show or set the store's git backup (--remote <url>, --off)
  datanotes store restore --from <url> --database <folder>   restore the store from its git backup
  datanotes store convert-log --to <files|segments> --database <folder>   rewrite the transaction log in that format
  datanotes extension install <source> --database <folder>   install an extension: plan, confirm, write
                                               (a git URL with #<tag>, owner/repo@<tag>, or a folder)
  datanotes extension update | rollback | remove <name> --database <folder>   change an installed one
  datanotes extension list --database <folder>    the installed extensions
  datanotes extension check <folder>             check an extension's repository (for its authors)
  datanotes pack-merge <base> <ours> <theirs> [<path>]   git's merge driver of packs of rows, row by row
                                               (git sync registers it: merge.datanotes-pack.driver)
  Every command takes --vault <folder> instead of --database for a vault holding the database.
  datanotes mcp --database <folder>            MCP server over stdio, on the engine running on the folder
                                               (or one it starts for the session)
  datanotes mcp --url <url> --token-file <f>   MCP server over stdio, on an engine at an address
  datanotes mcp serve [options]                MCP server over Streamable HTTP at /mcp (each agent sends its token)
  datanotes --version | --help
  dnotes is a short name for datanotes: every command works under both names.


Options of serve:
  --database <folder>         the database folder (or DATANOTES_DATABASE): metastore.yaml at its
                              root (created there for a new database); paths start with the catalog
  --vault <folder>            or a vault holding the database (or DATANOTES_VAULT), for apps such as
                              Obsidian: the database is the folder of the vault's one metastore.yaml
                              (a new database: datanotes/); paths start at the vault's root
  --store <folder>            the engine's store (or DATANOTES_STORE; default <data home>/<database id>)
  --settings <file>           settings file (or DATANOTES_SETTINGS; default settings.json in the store)
  --host <address>            listen address (or DATANOTES_HOST; default 127.0.0.1)
  --port <port>               HTTP port for this run (or DATANOTES_PORT; default: the setting
                              httpServerPort, 27150); 0 for any free port, printed at start
  --watch events|poll         how file changes are seen (or DATANOTES_WATCH; default events)
  --poll-ms <ms>              poll interval (or DATANOTES_POLL_MS; default 3000)
  --embedding-key-file <file> file with the API key of the embedding provider (or DATANOTES_EMBEDDING_KEY_FILE;
                              DATANOTES_EMBEDDING_KEY gives the key itself)
  --git-sync                  commit, pull and push the vault (or DATANOTES_GIT_SYNC=1; --git-no-push)
  --git-interval-min <min>    minutes between two syncs (or DATANOTES_GIT_INTERVAL_MIN; default 10)
  --git-quiet-s <s>           a sync also <s> seconds after the last write (or DATANOTES_GIT_QUIET_S; default 60)
                              DATANOTES_GIT_NETWORK_TIMEOUT_S: the time limit of a pull or push (default 600)
  --store-backup              back up the store to git for this run (or DATANOTES_STORE_BACKUP=1; the
                              setting storeBackupEnabled keeps it on; --no-store-backup or =0 turns it off)
  --store-backup-remote <url> the store backup's git remote; turns the backup on
                              (or DATANOTES_STORE_BACKUP_REMOTE; default: the setting storeBackupRemote)
  --store-backup-interval-s <s> every <s> seconds (at least 10), when the store changed: a commit
                              between two operations, then a push (or DATANOTES_STORE_BACKUP_INTERVAL_S;
                              default: the setting storeBackupIntervalSeconds, 60)
  --log <file>                append console output to a file
                              DATANOTES_INDEX_CHECK=1: check the engine's indexes against the vault
                              after every operation, and log any difference as an error (slow: debugging)


Options of status (the engine is found through the lock in its store, called with the owner's token):
  --database <folder>         the database folder (or DATANOTES_DATABASE; --vault <folder> for a vault)
  --store <folder>            the engine's store, when serve was given one (or DATANOTES_STORE)
  --settings <file>           settings file with the owner's token (or DATANOTES_SETTINGS;
                              default settings.json in the store)
  --url <url> --token <token> call this engine instead, e.g. on another machine (or DATANOTES_URL, DATANOTES_TOKEN)
  --json                      the report as JSON
  Exit codes: 0 healthy; 1 needs attention (git sync blocked, store backup failing, a webhook failing, change feed not
  running, hand edits breaking the tables' rules in the last 24 h); 2 no engine running on the folder (or
  not reachable); 3 an engine runs but its status could not be read (no owner token, token refused, an error).


Options of stop (the engine finishes the requests under way, makes its last git sync and store backup
commit and push, releases its lock and exits):
  --database <folder>         the database folder (or DATANOTES_DATABASE; --vault <folder> for a vault)
  --store <folder>            the engine's store, when serve was given one (or DATANOTES_STORE)
  --settings <file>           settings file with the owner's token (or DATANOTES_SETTINGS;
                              default settings.json in the store)
  --url <url> --token <token> stop this engine instead (or DATANOTES_URL, DATANOTES_TOKEN)
  --timeout-s <seconds>       how long to wait for the engine to exit (default 60)
  --json                      the report as JSON
  Exit codes: 0 stopped; 1 not stopped (not answering, or still running after the timeout: stop it by
  force); 2 no engine running on the folder; 3 the stop could not be asked (another machine, still
  starting, token refused).


Options of store:
  --database <folder>         the database folder (or DATANOTES_DATABASE; --vault <folder> for a vault)
  --json                      store path, store backup, store convert-log: the answer as JSON
  --remote <url>              store backup: turn it on, pushing to this git repository (a first push now)
  --ssh-command <cmd>         store backup, with --remote: the store repository's core.sshCommand
                              (default: the vault repository's), e.g. C:/Windows/System32/OpenSSH/ssh.exe
  --interval-s <seconds>      store backup: every <seconds> (at least 10, default 60), when the
                              store changed: a commit between two operations, then a push
  --off                       store backup: turn it off (the store's repository stays)
  --from <url>                store restore: the git repository of the store backup
  --port <port>               store restore: the HTTP port in the new settings (default 27150)
  --force                     store restore: restore over a store that exists (kept aside, renamed)
  --no-backup                 store restore: leave the store backup off in the new settings
  --to <files|segments>       store convert-log: segments (a few large files) or files (one per
                              version, what Datanotes 3.0 reads); sets transactionLogFormat
  new-id, backup, restore and convert-log run only while no engine runs on the database, and
  hold its store while they run: an engine started meanwhile refuses to start.
  The data home holds one store per database: %LOCALAPPDATA%\Datanotes (Windows),
  ~/Library/Application Support/Datanotes (macOS), $XDG_DATA_HOME/datanotes or
  ~/.local/share/datanotes (Linux); DATANOTES_DATA_HOME moves it.


Options of extension (every command but check works through the engine running on the database):
  --database <folder>         the database folder (or DATANOTES_DATABASE; --vault <folder> for a vault)
  --store <folder>            the engine's store, when serve was given one (or DATANOTES_STORE)
  --settings <file>           settings file with the owner's token (or DATANOTES_SETTINGS;
                              default settings.json in the store)
  --url <url>                 an engine at an address (or DATANOTES_URL), with
  --token-file <file>         a file holding the owner's token (or DATANOTES_TOKEN_FILE)
  --map <list>                install, update: role=catalog.schema.table or role.column=column
  --create <roles>            install, update: create these tables the extension depends on
  --add <list>                install, update: add these role.column columns to matched tables
  --catalog <name>            install: the catalog of the tables and views it creates
  --schema <name>             install: the schema of the tables and views it creates
  --to <ref>                  update: the version tag or commit to move to (default: the newest tag)
  --from <source>             update: another source, such as the folder you develop in
  --dry-run                   install, update: print the plan and write nothing
  --yes                       write without asking (only once the user approved the plan)
  --json                      print one JSON object (the plan or the result) and never ask
  Lists (--map, --create, --add) are comma-separated. Exit codes: 0 done; 1 error; 2 the plan has
  problems (nothing written); 3 confirmation needed (run again with --yes once the user approved)


Options of mcp (stdio):
  --database <folder>         the database folder (or DATANOTES_DATABASE); acts with the owner's token,
                              and stops the engine it started when the client closes
  --vault <folder>            or a vault holding the database (or DATANOTES_VAULT)
  --url <url>                 the engine's address (or DATANOTES_URL), with
  --token-file <file>         a file holding the token (or DATANOTES_TOKEN_FILE, or the token in DATANOTES_TOKEN)
                              DATANOTES_ENGINE_START_TIMEOUT_S: how long --database waits for the engine
                              it starts, in seconds (default 60; a large database starts slowly)


Options of mcp serve:
  --url <url>                 the engine (default http://127.0.0.1:27150, or DATANOTES_URL)
  --host <address>            listen address (default 127.0.0.1, or DATANOTES_MCP_HOST)
  --port <n>                  port (default 27151, or DATANOTES_MCP_PORT)


Tools of mcp (both modes; default: every tool except create_webhook and delete_webhook):
  --profile <name>            read (read-only tools), write (no schema changes, no webhooks) or
                              all (every tool, webhooks included) (or DATANOTES_MCP_PROFILE)
  --tools <names>             only these tools, separated by commas (or DATANOTES_MCP_TOOLS)
  --except <names>            none of these tools, separated by commas (or DATANOTES_MCP_EXCEPT)
  --owner-tools               also offer create_webhook and delete_webhook
                              (or DATANOTES_MCP_OWNER_TOOLS=1)


Extensions of mcp (both modes): the tools of the extensions installed in the database (datanotes
extension install) come after the engine's tools; --profile read keeps only their read-only tools
  --no-extensions             offer no extension tools (or DATANOTES_MCP_EXTENSIONS=0)


Logs of mcp (both modes):
  --otlp-endpoint <url>       export logs over OTLP/HTTP, e.g. http://127.0.0.1:4318 (or the standard
                              OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_HEADERS, OTEL_SERVICE_NAME)


Docs of mcp (both modes): the tools list_docs, read_docs and search_docs read the docs of this
version from the package (dist/docs), or from the folder in DATANOTES_DOCS_DIR; search_docs also
ranks them by meaning when the engine has semantic search on (hybrid search)


Agents connect through the MCP server: npx -y datanotes mcp (https://datanotes.dev/start/connect-agents/).
Docs: https://datanotes.dev
```
