# Command line

> Install the executor command, sign in to OneDoor with it, and call your tools from a shell.

Source: https://docs.onedoor.team/run/cli/
All docs in one file: https://docs.onedoor.team/llms-full.txt

> The command-line tool is the open-source `executor` program that OneDoor is
> built on. It keeps its name. OneDoor users must log in with
> `executor login --host https://app.onedoor.team`. Without `--host`, the
> command signs in to a different service.

The `executor` command does two jobs. It is a client of a OneDoor server, hosted
or self-hosted: it signs in, calls your tools from a shell, and serves them to
MCP clients over stdio. It can also run its own server on your machine, for one
person: that local server holds your accounts, runs your apps and serves an MCP
endpoint for your agents. The local server is separate from hosted OneDoor;
nothing is copied between them.

## Install

With npm. The package is a launcher that downloads the program's own runtime
for your platform on first run, so Node only starts it. Supports macOS on Apple
Silicon and Intel, Linux (glibc) on ARM64 and x64, and Windows on x64.

```bash
npm install -g executor@2.0.0-beta.56
executor --version
```

The program is one executable with its runtime, dashboard, Git and workerd
beside it; no source checkout, Node or Bun is needed to run it.

The npm package is a small launcher. The first time a version starts, it
downloads that release's archive for your platform from the public GitHub
release, checks it against the SHA-256 the package records, and keeps it in
`~/.executor/v2/launcher/<version>`. Set `EXECUTOR_DOWNLOAD_URL` to use a mirror
of the releases.

If `executor --version` shows version 1, your shell is finding an older install.
Run `type -a executor` on macOS or Linux, or `where.exe executor` on Windows,
to see which executable takes priority. Remove the old install with the package
manager that installed it, then open a new terminal. For example, use
`bun remove -g executor` for an old Bun install. This does not delete your data.

| Command | Purpose |
| --- | --- |
| `executor login --host https://app.onedoor.team`, `executor logout`, `executor whoami` | Sign in to OneDoor for tools, sign out, and show what the sign-in reaches. See [Use your tools from a shell](#use-your-tools-from-a-shell). |
| `executor search`, `describe`, `call`, `execute`, `resume`, `skills` | Call your tools from a shell. |
| `executor mcp` | Serve your tools to an MCP client over stdio. |
| `executor apps` | Create, edit, deploy and install apps. See [Author an app](/author-an-app). |
| `executor` | Start the background server on this computer if it is not running, open its dashboard and exit. See [The background server](#the-background-server). |
| `executor serve` | Run the local server in this terminal, without opening a browser, until you press Ctrl+C. |
| `executor service` | Start, stop and configure the background server, print a connection link and replace its API key. |
| `executor upgrade` | Install the newest release the way the program was installed; `--rollback` returns to the previous one. |

## Use your tools from a shell

`executor login --host https://app.onedoor.team` signs in to hosted OneDoor. It
prints a link and a code; open the link in any browser where you are signed in,
check the code and approve. On that page you choose which apps the sign-in
reaches and how approvals are answered. Always pass `--host`:

```sh
executor login --host https://app.onedoor.team
```

For a self-hosted server, pass its own origin to `--host` instead.

The sign-in is saved in your operating system's credential store, or, on a
machine without one, in a file under `~/.local/state/executor/auth` that only
you can read. It renews itself. `executor whoami` prints the host, its
company, what the sign-in reaches, its approval mode and whether
`executor apps` is signed in too. `executor logout` removes this computer's
sign-ins for the host. The grant stays listed in OneDoor until someone revokes
it there, so signing out does not by itself revoke access.

Every client command, the tool commands, `executor mcp` and `executor apps`,
talks to one host: `--host`, then `EXECUTOR_HOST`, then the host you signed in
to last, with `executor login --host https://app.onedoor.team` or
`executor apps login`.
With none of these, it uses the background server on this computer, which
starts if needed, with its API key. `executor logout` forgets the host it signs
out of, so commands go back to the background server. Set
`EXECUTOR_ACCESS_TOKEN` to send a pasted access token instead of a saved
sign-in.

The tool commands call the [MCP tools](/mcp#the-tools) of the same name and
print the result as JSON on stdout. A failure exits with status 1 and prints the
error's message, code and next step on stderr; when stdout is not a terminal, it
also prints them as `{"error": {...}}` on stdout.

| Command | Arguments |
| --- | --- |
| `executor search [query]` | `--namespace <app>`, `--limit <n>`, `--offset <n>` |
| `executor describe <path>...` | One to 20 exact paths from `search`. |
| `executor call [path]` | `--input <json>` or `--input-file <file>`, `-` for standard input. Without a path, the input is a JSON array of `{ "path", "input" }` calls, which run concurrently. The input defaults to `{}`. |
| `executor execute` | `--code <program>` or `--file <file>`, `-` for standard input. |
| `executor resume [request-id]` | `--action accept\|decline\|cancel`. In browser mode a bare `executor resume` is enough. |
| `executor skills` | `--app <slug>`, `--name <skill>`, `--file <path>`, `--version <id>`, `--revision <revision>` |

```sh
executor search "github issues"
executor call tools.github.issues.list --input '{"repo":"acme/web"}' > issues.json
executor execute --file report.js > report.json
```

Redirect a large result to a file and read the part you need, instead of
passing it whole to your agent. When a call to a write is set to Ask, the call is
held. An owner or admin approves it on the Approvals screen in OneDoor. Never
run the call again to continue it; collect the result with `executor resume`:

- Resume only after the approver has approved the call.
- **Browser mode:** a bare `executor resume` is safe to repeat. It prints the
  result once the call has finished.
- **Model mode:** ask the approver, then run
  `executor resume <id> --action accept`. It waits for a call that is still
  running, up to the server's per-call time limit (5 minutes by default).
- Never answer at the printed link, and never use `--action accept`, before the
  approver has approved.
- The person resuming must still have access to the app.

### Serve your tools to an MCP client

`executor mcp` is a stdio MCP server for clients that start a command, such as
Claude Code:

```sh
claude mcp add onedoor -- executor mcp
```

It passes every message to the host's MCP endpoint, including approvals and
questions the host asks the client, with your sign-in, which it renews as it
runs. It tells the agent that the `executor` command is available in its shell.
When the host no longer knows its MCP session, as after the host restarts, it
opens a new one and sends the request again, so the client keeps working.
Without a sign-in, it serves the background server on this computer.

## The background server

Run without a sign-in, the program uses its own server on your computer. Each
data directory has one background server that every command shares. The
first command that needs it starts it: `executor`, `executor service start`, or
a client command without a host, such as `executor apps list` or `executor search`. It keeps running after that command exits, until you
run `executor service stop`. Nothing is installed with your operating system, so
it does not start again after you restart your computer: MCP clients cannot
connect until you run `executor` or `executor service start`.

On first launch, the program saves its API and encryption keys in macOS
Keychain, Windows Credential Manager, or Linux Secret Service. Unlock the
credential store and allow access when asked. If there is no credential store on
the first launch, for example on a Linux server without GNOME Keyring, it saves
the keys to `keys.json` in its data directory instead. The file is readable only
by your user. Keep that directory private. If a credential store exists but
access is denied, for example because you dismissed the prompt or the store is
locked, the program stops without writing `keys.json`. Start it again to be
asked again. Where no prompt can appear, such as over SSH, unlock the store
first: on Linux run `gnome-keyring-daemon --unlock`, on macOS
`security unlock-keychain`.

To use `keys.json` on a new data directory even when a credential store works,
set `EXECUTOR_KEY_STORAGE=file` for its first start. Set
`EXECUTOR_KEY_STORAGE=os` to require the credential store and never fall back to
`keys.json`. The program never switches an existing directory's key storage: a
value that does not match the directory stops startup and changes nothing.

When the background server runs another version, `executor` stops it and
starts its own version. Other commands use whichever version is running. An
upgrade outside `executor upgrade`, such as `npm i -g` or the
install script, removes or replaces the executable it runs from. It then stops
by itself within five seconds, and the next command starts the installed
version; the install script stops it first. On Windows the files of a running
program cannot be replaced, so run `executor service stop` before you install
with npm, pnpm, Bun or Yarn.

| Command | Purpose |
| --- | --- |
| `executor service start` | Start the background server, or confirm that it runs, and print its URL. |
| `executor service stop` | Stop it. |
| `executor service restart` | Stop it and start this version. |
| `executor service status` | Print its URL, version and process ID, with `starting`, `stopping` or `not responding` before them while it starts, stops or does not answer, or `stopped`. |
| `executor service get [setting]` | Print every setting as JSON, or one setting. |
| `executor service set <setting> <value>` | Change a setting. |
| `executor service unset <setting>` | Remove a setting. |
| `executor service pair` | Print a new connection link for the background server. |
| `executor service rotate-key` | Replace the saved API key. Run `executor service restart`, then update clients that used the old key. |

`executor service pair` asks the background server for a link, waiting up to
30 seconds while it starts, stops or does not respond. It only reads: it never
starts the server or creates a data directory or keys. When you set
`EXECUTOR_API_KEY`, it sends that key instead, to the background server or,
when none runs, to the server on `EXECUTOR_PORT`.

| Setting | Purpose |
| --- | --- |
| `port` | The port it listens on. `EXECUTOR_PORT` wins over it; the default is `4312`. Each data directory's background server needs its own port. |
| `env` | Extra environment variables for it: `executor service set env <name> <value>`, `executor service unset env <name>`. |
| `disabled` | `true` makes `executor`, and client commands without a host, run a private server for the command instead, as `--standalone` does. `executor service start` and `executor service pair` still use the background server. |

Changing `port` or `env`, or setting `disabled` to `true`, stops the background
server; the next command that needs it starts it with the new settings. It
runs with the environment of the command that started it plus `env`, so use
`env` for variables it should always have, such as `EXECUTOR_BROWSER_ORIGIN`.
`EXECUTOR_API_KEY` and `EXECUTOR_ENCRYPTION_KEY` reach it only when both are
set, as for supplied keys; `EXECUTOR_API_KEY` alone is only the key the command
itself sends.

The data directory holds the settings in `service.json`. While the server runs,
`server.json` records its address, process ID and a password that changes each
time it starts, and `.server.lock` stops a second server from opening the same
data directory. `service.json` and `server.json` are readable only by your user.

`executor --standalone` runs a private server on a free port for that command
instead, until you press Ctrl+C. It uses the same data directory, so stop the
background server first or set `EXECUTOR_DATA_DIR` to another folder.
`executor --server <url>` opens the dashboard of a server that already
runs at that URL, using `EXECUTOR_API_KEY` or the API key saved in the data
directory. `executor serve` runs the server in your terminal instead of the
background, so stop the background server first; while it runs, other commands
use it as they would the background server.

### Configure it

| Variable | Purpose |
| --- | --- |
| `EXECUTOR_PORT` | Port. Wins over the `port` setting; the default is `4312`. |
| `EXECUTOR_NO_UPDATE_CHECK` | Set to `1` to skip the daily check for a newer release. |
| `EXECUTOR_DATA_DIR` | Data directory, default `~/.executor/v2/cli`. |
| `EXECUTOR_BROWSER_ORIGIN` | Exact HTTPS origin for generated browser links. |
| `EXECUTOR_WEBHOOK_ORIGIN` | Exact HTTPS origin that receives webhooks. |
| `EXECUTOR_KEY_STORAGE` | `file` or `os`: key storage for a new data directory. |
| `DO_NOT_TRACK` or `EXECUTOR_DISABLE_ANALYTICS` | Set to `1` to turn off anonymous [usage analytics](/run/usage-analytics) and feedback. |

To keep keys in a secret manager instead, supply both `EXECUTOR_API_KEY` (at
least 32 characters) and `EXECUTOR_ENCRYPTION_KEY` (exactly 64 hexadecimal
characters) before the first start. Keep these same keys for every start.
The program does not save supplied keys. A directory keeps its chosen key source
across upgrades: a directory using the credential store still needs it later,
and a directory using `keys.json` needs that file.

### Connect an agent to it

Use the local dashboard's **Connect** card to add the local MCP endpoint to your
agent. A client that starts a command can run `executor mcp` instead; see
[Serve your tools to an MCP client](#serve-your-tools-to-an-mcp-client).
The client connects to the background server. After you restart your
computer, run `executor` or `executor service start` first; until then the
client's connection is refused. If you change the port, update the client's URL.

To connect an agent to hosted OneDoor instead, see
[Add an MCP client](/mcp-clients).

### Back it up

Back up the data directory, including `installation.json`, and its matching
OS credential. The credential service is `com.usefulsoftware.executor.v2`;
its account ID is in `installation.json`. Copying only the database to another
machine is not enough to restore it. If you supplied keys, back them up in
your secret manager.

Missing keys stop startup. The program will not generate replacements for an
existing installation. Restore the original keys to recover access.

## Update

`executor` and `executor serve` check npm at most once a day for a newer
release on their channel and print a reminder to run `executor upgrade`. Beta
installs are told about stable once it is newer. The check never installs
anything and is skipped in CI. The v2 data directory stays the same when beta
becomes stable. Uninstalling the package does not delete data or keys.

`executor upgrade` installs the newest release on your channel the way
the program was installed, which it tells from where its files live. For an
install from the install script, it downloads the release, checks it against
the release's SHA256SUMS, confirms the new version starts, and then switches
`current` to it. The version it replaced stays installed, and
`executor upgrade --rollback` switches back to it. For npm, pnpm, Bun or Yarn,
it runs that package manager; `--method npm|pnpm|bun|yarn` chooses one instead.
It first checks that your Node.js meets the new launcher's requirement, and
afterwards runs `executor --version` to confirm the new command works.

```sh
executor upgrade                 # newest release on your channel
executor upgrade 2.0.0-beta.16   # a specific release
executor upgrade --rollback      # back to the previous release (install script)
executor upgrade --method pnpm   # install with pnpm
```

On a terminal it asks before installing; `--yes` skips the question. Without a
terminal, as for agents and CI, it installs without asking. Installing an older
release needs the version and confirmation, or `--yes` without a terminal. If
you run the program through `npx`, `bunx` or `pnpm dlx`, there is nothing to
upgrade: run `npx executor@2.0.0-beta.56`, or a newer version, to change release. When it cannot
tell which package manager installed it, it prints the install command for each
one instead of guessing.

The upgrade replaces the files the background server runs from, so
`executor upgrade` and `executor upgrade --rollback` stop it first and start it
again on the new version afterwards. If the upgrade fails or you cancel it, the
old version starts again. If the new version does not start, the upgrade still
succeeds and tells you to run `executor service start`. A release from before
the background server, which `--rollback` or an older version can install,
has no `executor service`: run `executor serve`, or `executor`, and keep it
running. A background server from a development build keeps running. The
program never updates itself without being asked.
