Repository navigation
CLI Reference
This page documents every subcommand and option of the nodepilot binary, with examples.
nodepilot [--data-dir <DIR>] <COMMAND>
Commands:
serve Run the web panel (UI + REST API + MCP over HTTP)
mcp Run an MCP server on stdio (for Claude, Cursor, etc.) using the same database
user Manage panel users: create, reset-2fa, passwd
token API tokens for CLI, MCP and agents: create
help Print help for a command
| Option | Env variable | Default | Meaning |
|---|---|---|---|
--data-dir <DIR> |
NODEPILOT_DATA |
data |
Data directory with the database and master key. Global: accepted before or after the subcommand |
-h, --help
|
Print help (also nodepilot help <command>) |
||
-V, --version
|
Print the version, e.g. nodepilot 0.1.0
|
Every command opens the data directory, applies pending database migrations and loads the master key before doing anything else. That has some consequences:
-
Point every command at the right data directory. With the systemd setup that is
/var/lib/nodepilot. The CLI does not read/etc/nodepilot/nodepilot.env, and the relative defaultdatacreates a new, empty database in the current directory. -
Run commands as the service user (
sudo -u nodepilot ...) so that any files SQLite creates stay owned bynodepilot. - The master key must be reachable. If you sealed it in the TPM, see Troubleshooting.
- You can run
userandtokencommands while the panel is running. They share the same SQLite database.
On a systemd install, a convenient shell alias:
alias np='sudo -u nodepilot /usr/local/bin/nodepilot --data-dir /var/lib/nodepilot'Logs go to stderr. Set the level with RUST_LOG (default info,sqlx=warn,russh=warn).
Runs the panel: web UI, REST API, WebSocket terminal and MCP over HTTP (POST /api/mcp). It also starts the background jobs: stats polling, the backup scheduler, the terminal session reaper, the update checker and audit log cleanup.
| Option | Env variable | Default | Meaning |
|---|---|---|---|
--listen <ADDR> |
NODEPILOT_LISTEN |
127.0.0.1:7780 |
IP:port to listen on |
--stats-interval <SECS> |
NODEPILOT_STATS_INTERVAL |
30 |
Stats polling interval in seconds (minimum 5) |
--metrics-retention-days <DAYS> |
NODEPILOT_METRICS_RETENTION_DAYS |
7 |
Days of metric history to keep |
--secure-cookies |
NODEPILOT_SECURE_COOKIES |
off | Mark the session cookie Secure (env value must be true or false) |
--cors-origins <LIST> |
NODEPILOT_CORS_ORIGINS |
none | Comma-separated origins allowed to call the API cross-origin with a Bearer token |
--trusted-proxies <LIST> |
NODEPILOT_TRUSTED_PROXIES |
none | Reverse proxies on other hosts (IPs or CIDRs) whose X-Forwarded-For is trusted; loopback is always trusted |
Details for each option are in Configuration.
# Local test run
nodepilot serve --data-dir ./np-data
# Listen on all interfaces, poll every 15 s, keep 30 days of history
nodepilot serve --data-dir /srv/nodepilot --listen 0.0.0.0:7780 \
--stats-interval 15 --metrics-retention-days 30
# Behind HTTPS, with a separate web client allowed
NODEPILOT_SECURE_COOKIES=true \
NODEPILOT_CORS_ORIGINS=https://app.example.com \
nodepilot serve --data-dir /var/lib/nodepilotIf there are no users yet, serve logs no users yet — open http://<listen> to create the administrator account. If the port is taken, it exits with an error (see Troubleshooting).
Runs an MCP server over stdio against the same database, for an AI client running on the panel host. Stdout carries the MCP protocol; logs go to stderr.
| Option | Env variable | Default | Meaning |
|---|---|---|---|
--token <TOKEN> |
NODEPILOT_TOKEN |
none | Limit the agent to the permissions of this API token. Without it, the agent has full access, acting as the first user created |
At least one user must exist; otherwise it fails with no users yet: open the panel and create the administrator first. An unknown or expired token fails with invalid API token.
# Full access (only on a host you control)
sudo -u nodepilot nodepilot mcp --data-dir /var/lib/nodepilot
# Restricted to a token's permissions
sudo -u nodepilot env NODEPILOT_TOKEN=np_... nodepilot mcp --data-dir /var/lib/nodepilotExample MCP client entry (for a client that launches stdio servers from a JSON config):
{
"mcpServers": {
"nodepilot": {
"command": "/usr/local/bin/nodepilot",
"args": ["mcp", "--data-dir", "/var/lib/nodepilot", "--token", "np_..."]
}
}
}The client process must be able to read the data directory and the master key. For remote agents, use HTTP instead (POST https://<panel>/api/mcp with a Bearer token). See MCP and AI Agents.
Manage panel users. Every user has full access in the web UI; API tokens are how access is restricted.
nodepilot user create <USERNAME> --password <PASSWORD>
| Argument / option | Env variable | Meaning |
|---|---|---|
<USERNAME> |
Login name. Leading and trailing spaces are trimmed; must not be empty. Must be unique | |
--password <PASSWORD> |
NODEPILOT_PASSWORD |
At least 8 characters. Required |
Prints created user <name>. Works whether or not other users exist, so it can also create the first administrator instead of the web setup form.
sudo -u nodepilot nodepilot --data-dir /var/lib/nodepilot user create alice --password 'correct horse battery'
# Keep the password out of shell history and the process list
read -rs NODEPILOT_PASSWORD; export NODEPILOT_PASSWORD
nodepilot --data-dir ./np-data user create aliceWith sudo, note that it does not pass your environment through by default. Run the read/export as the target user, or use the --password form.
nodepilot user passwd <USERNAME> --password <PASSWORD>
| Argument / option | Env variable | Meaning |
|---|---|---|
<USERNAME> |
Existing user | |
--password <PASSWORD> |
NODEPILOT_PASSWORD |
New password, at least 8 characters. Required |
Sets the password and ends all of the user's sessions. API tokens stay valid. Prints password updated for <name>.
sudo -u nodepilot nodepilot --data-dir /var/lib/nodepilot user passwd admin --password 'new-long-password'nodepilot user reset-2fa <USERNAME>
Turns off two-factor authentication for the user (secret, pending setup and recovery codes are removed) and ends all of their sessions. Use it when someone has lost both their authenticator and their recovery codes. Prints two-factor authentication disabled for <name>. The reset is recorded in the audit log as a critical event (auth:2fa-reset-cli).
sudo -u nodepilot nodepilot --data-dir /var/lib/nodepilot user reset-2fa adminreset2fa is accepted as an alias.
A missing user gives Error: user not found.
Issues an API token for a user and prints it to stdout. The token is shown only once; only its hash is stored.
nodepilot token create --user <USER> --name <NAME> [--read-only] [--expires-in-days <DAYS>]
| Option | Default | Meaning |
|---|---|---|
--user <USER> |
required | Username the token belongs to |
--name <NAME> |
required | Label shown in the panel's token list |
--read-only |
off (full access) | Read access to every area except command execution (exec) and administration (admin) |
--expires-in-days <DAYS> |
0 |
Lifetime in days; 0 means the token never expires |
Tokens look like np_ followed by 64 hex characters. Use them as Authorization: Bearer np_.... Tokens with custom per-area permissions are created in the panel (API section) or through POST /api/tokens; see API.
# Full-access token for an AI agent
sudo -u nodepilot nodepilot --data-dir /var/lib/nodepilot token create --user admin --name claude
# Read-only token for monitoring that expires in 90 days
sudo -u nodepilot nodepilot --data-dir /var/lib/nodepilot token create \
--user admin --name grafana --read-only --expires-in-days 90
# Store it straight into a file
nodepilot --data-dir ./np-data token create --user admin --name ci > ci.tokenAn unknown user gives user <name> not found.
Commands exit with status 0 on success. On failure they print Error: <message> (with a Caused by: chain) to stderr and exit non-zero.
NodePilot · Releases · Report a vulnerability · Apache-2.0
Set up
Use
Secure
Integrate
Reference