Command-line interface (CLI)

The Neotoma CLI provides full access to every operation available in the MCP and REST API, plus administration commands for server lifecycle, storage, backups, and configuration. Run neotoma with no arguments for an interactive session (neotoma> prompt), or invoke commands directly (e.g. neotoma entities list).

Installation

# Install globally
npm install -g neotoma

# Initialize data directory and database
neotoma init

# Start the API server (development)
neotoma api start --env dev --background

From a source checkout: npm run setup:cli builds and links the global neotoma command. Use npm run watch:build to keep the global CLI in sync during development.

Environments

Target a specific environment with neotoma dev (port 3080) or neotoma prod (port 3180), or pass --env dev / --env prod. Server lifecycle commands (api start, api stop, api logs) always require --env.

Typical workflow

# Store entities
neotoma store --json='[{"entity_type":"task","title":"Review API rollout","status":"open"}]'

# List entities by type
neotoma entities list --type task --limit 10

# Search by identifier
neotoma entities search "Ana Rivera" --type contact

# Inspect provenance
neotoma observations list --entity-id <entity_id>

# Upload a file with AI interpretation
neotoma upload ./invoice.pdf

# Upload locally (no API server needed)
neotoma upload --local ./invoice.pdf

# Stream changes in real time
neotoma watch --tail --human

Global options

  • --offline: force in-process local transport (no API required)
  • --api-only: fail if API server is unavailable
  • --base-url <url>: target a specific API instance
  • --env dev|prod: environment selector (required for server commands)
  • --json: machine-readable JSON output
  • --pretty: formatted JSON output
  • --tunnel: start HTTPS tunnel (ngrok/cloudflared) with server start
  • --debug: emit detailed initialization logs to stderr

Offline support

Data commands (entities, relationships, sources, observations, timeline, store, schemas, stats, corrections, snapshots) are offline-first and use in-process local transport by default - no API server required. Server lifecycle commands (api start|stop|status|logs) manage the API process and are unaffected.

CommandDescriptionFlags
auth loginGet or authenticate the current user.
auth statusGet or authenticate the current user.
auth whoamiGet or authenticate the current user.
request (OAuth ops)Get or authenticate the current user.
entities listQuery entities with filters.--type, --limit, --offset, --search
entities getGet an entity by ID.<entity_id>
request --operation getEntitySnapshotGet an entity snapshot with provenance.--entity-id, --at?
request (getEntityObservationsList observations for an entity or get field provenance.--entity-id (or body)
listObservationsForEntityList observations for an entity or get field provenance.
getFieldProvenance)List observations for an entity or get field provenance.
relationships listList relationships for an entity.--entity-id
entities searchSearch for an entity by identifier or semantic.--query, --type
entities relatedRetrieve related entities or the graph neighborhood.--entity-id
entities neighborhoodRetrieve related entities or the graph neighborhood.--entity-id
request --operation mergeEntitiesMerge two entities.--source-id, --target-id
entities deleteDelete or restore an entity.<entity_id>
entities restoreDelete or restore an entity.<entity_id>
sources listList sources or get a source by ID.
request --operation getSourceByIdList sources or get a source by ID.
request (listObservations)List, query, or create observations.
observations listList, query, or create observations.
relationships listList relationships, get one by ID, or get a snapshot.
request (getRelationshipById)List relationships, get one by ID, or get a snapshot.
relationships get-snapshotList relationships, get one by ID, or get a snapshot.
request (createRelationship)Create, delete, or restore a relationship.--source-id, --target-id, --type
relationships deleteCreate, delete, or restore a relationship.--relationship-key
relationships restoreCreate, delete, or restore a relationship.--relationship-key
timeline listList timeline events or get one by ID.
timeline getList timeline events or get one by ID.<id>
schemas listList schema types or get a schema by entity type.
schemas getList schema types or get a schema by entity type.<entity_type>
schemas analyze-candidatesAnalyze schema candidates, get recommendations, update incrementally, or register a schema.--entity-type
schemas recommendationsAnalyze schema candidates, get recommendations, update incrementally, or register a schema.--entity-type
schemas update-incrementalAnalyze schema candidates, get recommendations, update incrementally, or register a schema.--entity-type
schemas registerAnalyze schema candidates, get recommendations, update incrementally, or register a schema.
storeStore structured entities.--json
upload <path>Store an unstructured file.<path>, --no-interpret?, --mime-type?
corrections createSubmit a correction or reinterpret a source.
interpretations reinterpretSubmit a correction or reinterpret a source.<source_id>
request --operation listInterpretationsList interpretations.
statsGet server stats, server info, or run health check snapshots.
snapshots checkGet server stats, server info, or run health check snapshots.
request --operation getFileUrlGet a signed file URL (internal).
analyze <filePath>Parse a file into agent-readable text without storing.<filePath>
Check for a newer npm package version.
api statusHealth check.--env dev|prod
OpenAPI specification.
initInitialize Neotoma (data dirs, DB, encryption, .env).--data-dir, --force, --skip-db, --skip-env
resetReset local Neotoma state to clean slate.--yes
api startStart, stop, or manage the API server.--env, --background, --tunnel, --tunnel-provider
api stopStart, stop, or manage the API server.--env
api statusStart, stop, or manage the API server.--env
api logsStart, stop, or manage the API server.--env
api processesStart, stop, or manage the API server.
mcp configConfigure or check MCP server entries in IDE configs.--no-check
mcp checkConfigure or check MCP server entries in IDE configs.--user-level
cli-instructions configCheck or install CLI agent instructions for IDEs.
cli-instructions checkCheck or install CLI agent instructions for IDEs.--user-level, --yes
watchStream record changes in real time.--interval, --json, --human, --tail
storage infoShow or change storage paths and merge databases.
storage set-data-dirShow or change storage paths and merge databases.--move-db-files, --on-conflict, --yes
storage merge-dbShow or change storage paths and merge databases.--source, --target, --mode, --dry-run
backup createCreate or restore a backup.--output
backup restoreCreate or restore a backup.--from, --target
logs tailRead persistent log files.--decrypt, --lines, --file
sessionInteractive session with persistent prompt.--servers
dev listRun npm scripts from the repo.
dev <script>Run npm scripts from the repo.-- <args>
interpretations interpret-uninterpretedInterpret uninterpreted sources (backfill).--limit, --dry-run, --interpretation-config
auth logoutLog out or get MCP auth token.
auth mcp-tokenLog out or get MCP auth token.

Authentication

Local CLI commands run without login in development. For production or MCP OAuth:

  • neotoma auth login - OAuth PKCE flow for MCP Connect
  • neotoma auth status - show auth mode and user details
  • neotoma auth mcp-token - print key-derived MCP token (when encryption is enabled)
  • neotoma auth logout - clear stored OAuth credentials

Storage and configuration

CLI config is stored at ~/.config/neotoma/config.json. Run neotoma storage info to see data directory, database path, sources directory, and log paths. Use neotoma storage set-data-dir to relocate the data directory with optional DB migration. Use neotoma storage merge-db to merge SQLite databases (safe mode by default).

Backups

neotoma backup create creates a timestamped backup of the database, sources, and logs with a manifest.json containing checksums. neotoma backup restore --from <dir> restores a backup into the data directory. Encrypted data stays encrypted; preserve the key file or mnemonic.

See MCP reference for agent-native transport, REST API reference for HTTP endpoints, and troubleshooting for common failure modes.