---
agent:
  instructions: "Use this search API to find relevant content across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown."
  endpoint: "https://moreflow.io/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# moreflow from the command line

@moreflow/cli runs the same operations as the moreflow MCP server from your terminal. Find an operation, read its contract, call it with JSON. Built for scripts, CI jobs, bulk exports and coding agents that work in a shell.

Current version: `@moreflow/cli@0.1.0`[Full developer guide](https://docs.moreflow.io/#cli)

## Install

Run it without installing:

```
npx @moreflow/cli@0.1.0
```

Copy

Or install it globally:

```
npm install -g @moreflow/cli@0.1.0
```

Copy

## Quickstart

1.  ### Install the CLI

    This puts the moreflow command on your PATH. Without installing, put npx @moreflow/cli in front of each command instead.

    ```
    npm install -g @moreflow/cli@0.1.0
    ```

    Copy

2.  ### Sign in

    A browser window opens. Sign in to moreflow, choose the workspace and decide which business areas the CLI may use and how much it may change without asking.

    ```
    moreflow auth login --oauth
    ```

    Copy

3.  ### See what's there

    List the modules, such as clients, deals or invoices.

    ```
    moreflow modules
    ```

    Copy

4.  ### Find an operation

    Search in plain words. You only see operations your sign-in allows.

    ```
    moreflow find send invoice
    ```

    Copy

5.  ### Read its contract

    Input schema, example inputs, possible errors and whether a write needs confirmation.

    ```
    moreflow describe clients.create
    ```

    Copy

6.  ### Call it

    Pass the input as JSON. List operations can follow every page for you.

    ```
    moreflow call clients.list '{"limit":5}'
    moreflow call clients.list --all --max-items 200
    ```

    Copy

## Sign-in options

Use your browser for your own machine and an API token for servers and CI. Saved credentials stay in a file only you can read.

-   Browser login

    Sign in through the browser; the person chooses what the CLI may do.

    `moreflow auth login --oauth`
-   API token profile

    Save an API token as a profile (asks for it, or reads stdin).

    `moreflow auth login`
-   API token in the environment

    Use a token for one shell without saving it.

    `MOREFLOW_API_TOKEN`
-   Profile selection

    Pick a saved profile per command; moreflow auth use sets the active one.

    `--profile <name>`

When several are set, a command uses them in this order:

1.  `--profile`
2.  `MOREFLOW_API_TOKEN`
3.  `MOREFLOW_PROFILE`
4.  `the active profile`

### Environment variables

`MOREFLOW_API_TOKEN`

An API token for this shell.

`MOREFLOW_PROFILE`

The saved profile to use.

`MOREFLOW_API_BASE_URL`

Selects another environment (default https://api.moreflow.io).

## CLI or MCP?

Both run the same moreflow operations with the same permissions. Pick by where the work happens.

|  | CLI | MCP server |
| --- | --- | --- |
| Best for | Scripts, CI jobs, bulk exports, coding agents with a shell | Chat assistants such as Claude and ChatGPT |
| Output | JSON on stdout, ready for pipes, files and jq | Answers inside the chat |
| Large reads | Follows every page of a list into a file | One page per tool call |
| Sign-in | Browser login or a saved API token | OAuth connector or API token |
| Errors | Stable exit codes for scripts | Error messages for the assistant |

[Connect an AI assistant over MCP →](https://moreflow.io/en/mcp)

## Command reference

Generated from the same spec as moreflow --help.

### moreflow modules

List the operation modules.

Usage

moreflow modules

Prints { modules: \[...\] }: every module id. Pass one to moreflow find --module.

Examples

```
moreflow modules
```

Copy

### moreflow find

Search operations.

Usage

moreflow find \[query\] \[--module <id>\] \[--limit <n>\]

Searches the operations this credential can see, best match first. Without a query it lists them by id. Prints { items, nextCursor }; each item has the id, name, summary, kind and effect.

Options

`--module <id>`

Only operations of this module.

`--limit <n>`

Page size (1 to 100).

Examples

```
moreflow find send invoice
moreflow find --module clients --limit 100
```

Copy

### moreflow describe

Input, examples, errors and safety of one operation.

Usage

moreflow describe <operationId> \[--related\] \[--full\]

Prints the live contract of one operation: description, effect and whether it needs confirmation, the input JSON Schema, example inputs and declared errors with their recovery.

Options

`--related`

Adds relatedOperations and nextOperations.

`--full`

The complete discovery document, including the output schema.

Examples

```
moreflow describe clients.create
moreflow describe clients.create --related
```

Copy

### moreflow call

Run an operation.

Usage

moreflow call <operationId> \[input\] \[options\]

Runs one operation. input is a JSON object: inline, @file, or - for stdin. Omit it for an operation without required input.

Options

`--all`

Read every page of a list. For a list operation: follow nextCursor and print every item on its own line.

`--max-items <n>`

With --all: stop after n items.

`--idempotency-key <key>`

The key of this write. The key of this write. The CLI generates one per call; pass the key a failure reported to repeat that call without running the write twice.

`--confirm`

Approve a write that requires confirmation. Approves a write that requires confirmation. Pass it only after the person you act for approved this exact change.

`--approval-token <token>`

Retry an approved agent action. The token a CONFIRMATION\_REQUIRED failure returned, once that approval was granted in moreflow.

Examples

```
moreflow call clients.list '{"limit":5}'
moreflow call clients.list --all --max-items 200
moreflow call clients.create '{"firstName":"Ada","lastName":"Lovelace"}'
```

Copy

### moreflow whoami

The account and grant the credential acts as.

Usage

moreflow whoami

Asks the API which account and grant the current credential acts as, and prints { profile, tokenSource, baseUrl, caller }. Run it before a write when more than one token is in play.

Examples

```
moreflow whoami
```

Copy

### moreflow auth

Manage saved credential profiles.

Usage

moreflow auth login \[--oauth \[--no-browser\]\] \[--profile <name>\] \[--base-url <url>\]
moreflow auth status
moreflow auth use <profile>
moreflow auth logout \[--profile <name>\]

Saved credential profiles, kept in a file only you can read.

Options

`--oauth`

Sign in through the browser instead of saving an API token.

`--no-browser`

With --oauth: print the URL instead of opening it.

Subcommands

`moreflow auth login --oauth`

Signs in through the browser. The person signs in to moreflow, picks the account and business areas, and how much the CLI may do without asking; writes beyond that wait for their approval. The login refreshes itself. --no-browser only prints the URL (on stderr), for a machine without a browser: the redirect still returns to this machine.

`moreflow auth login`

Without --oauth: saves an API token. Reads it from the terminal without echoing it, or from stdin: printf %s "$TOKEN" | moreflow auth login. Every credential is checked against the API before it is saved, and its profile (default: default) becomes the active one.

`moreflow auth status`

Lists the profiles and the active one. Never prints a token.

`moreflow auth use`

Makes a saved profile the active one.

`moreflow auth logout`

Forgets a saved credential. A browser login is also ended on the server; revoke an API token in moreflow to end it.

A command uses, in this order: --profile, MOREFLOW\_API\_TOKEN, MOREFLOW\_PROFILE, the active profile.

Examples

```
moreflow auth login --oauth
moreflow auth login --oauth --profile dev --base-url https://dev-api.moreflow.io
moreflow auth status
moreflow auth use dev
moreflow auth logout --profile dev
```

Copy

### Global options

`--profile <name>`

The saved profile to use; overrides MOREFLOW\_API\_TOKEN.

`--base-url <url>`

Overrides MOREFLOW\_API\_BASE\_URL and the profile's URL.

`--timeout-ms <n>`

Time limit per request (default 60000).

`--max-retries <n>`

Retries after a 429, a 5xx or a network failure (default 2).

`--help`

Print the overview, or one command’s reference.

`--version`

Print the CLI version.

### Exit codes

Scripts can branch on the exit code instead of parsing error text.

| Code | Category | Meaning |
| --- | --- | --- |
| 0 | OK | Success |
| 1 | INTERNAL | Internal error |
| 2 | USAGE | Wrong command line; nothing was sent |
| 3 | UNAUTHENTICATED | Unauthenticated |
| 4 | PERMISSION\_DENIED | Permission denied (scope, plan or policy) |
| 5 | NOT\_FOUND | Not found |
| 6 | INVALID\_ARGUMENT | Invalid argument |
| 7 | FAILED\_PRECONDITION | Failed precondition, including a required confirmation |
| 8 | CONFLICT | Conflict |
| 9 | RESOURCE\_EXHAUSTED | Rate or quota limit |
| 10 | UNAVAILABLE | Unavailable (network, timeout or server failure) |

## Questions

### What is the moreflow CLI?

@moreflow/cli is moreflow's official command-line tool. It calls the moreflow operations API from a shell: the same operations an AI assistant uses over MCP, with JSON in and JSON out.

### Do I need the CLI if I already use the MCP server?

Not for chatting. The MCP server is the better fit for Claude, ChatGPT and other chat assistants. The CLI is for work a chat can't do well: exporting thousands of records into a file, scheduled scripts, CI jobs, and coding agents that already work in a terminal.

### Is it safe to let an agent run it?

Yes, within the limits you set. At sign-in you choose the business areas and how much the CLI may change without asking. A write that needs confirmation stops with exit code 7 until you approve it, and every write carries an idempotency key, so you can repeat a failed write without running it twice.

### Does the CLI cost extra?

No. API, MCP and CLI access are included in every moreflow plan, including the 14-day free trial.

### What do I need to run it?

Node.js with npm. Run it with npx, or install it globally with npm, then sign in with your browser or an API token.

## No moreflow account yet?

Start a 14-day free trial. API, MCP and CLI access are included in every plan.

[Start free trial](https://app.moreflow.io/signup?referrer=moreflow.io&button=cli_cta)
