---
title: "CLI"
description: "Every endpoint as a mentio command, plus a live feed and MCP setup, for scripts and terminals."
canonical: https://docs.mentio.dev/cli
markdown: https://docs.mentio.dev/cli.mdx
---

# CLI

Every endpoint as a mentio command, plus a live feed and MCP setup, for scripts and terminals.

`mentio` is the Mentio API on the command line. Every public endpoint is a `noun:verb` command generated from the OpenAPI document, so the CLI is complete and cannot drift; three more commands do what one request cannot: `auth:*`, `mentions:watch` and `mcp:config`.

```bash
npm install -g @mentio-dev/cli
mentio --help
```

Or without installing: `npx @mentio-dev/cli mentions:search --platform reddit`.

## Authenticate

The short path is the browser:

```bash
mentio auth:login
```

It opens the dashboard, you approve once, and a key named after this computer lands in `~/.mentio/config.json` (mode 600). The key travels from the browser tab to the CLI's loopback port and nowhere else; revoke it from the API keys page whenever you like. `--scope read` asks for a read-only key, `--no-open` prints the URL for a remote machine.

Three more ways, in order of precedence:

```bash
mentio keywords:list --api-key mk_live_...      # a flag, for one call
export MENTIO_API_KEY=mk_live_...               # the environment, for CI
mentio auth:set --key mk_live_...               # a key you already have
```

`mentio auth:check` tells you which workspace the key belongs to and where it came from; `mentio auth:logout` removes the stored key. For a self-hosted deployment add `--api-url`, `MENTIO_API_URL`, or `auth:set --url`. Keys come from the dashboard or from `mentio api-keys:create --name ci --scope read`; a `read` key can only run the commands that `GET`.

## Commands

Every command, with every flag, is listed by area: [Keywords](/cli/keywords), [Mentions](/cli/mentions), [People and segments](/cli/people), [Alerts and channels](/cli/alerts), [Analytics](/cli/analytics) and [Account](/cli/account). The shape is always the same:

```bash
mentio keywords:list
mentio keywords:create --term "acme" --kind brand --platforms reddit,hackernews
mentio keywords:update kw_60d9... --muted true
mentio mentions:search --relevant true --sentiment negative --limit 50
mentio mentions:update mm_7f3a... --status done --note "Replied in thread"
mentio people:list --minFollowers 5000 --sort reach
mentio analytics:summary --range 7d --compare true --timezone Europe/Madrid
mentio analytics:breakdown --by platform --range 30d
mentio channels:create --kind webhook --url https://example.com/hooks/mentio
mentio alerts:create --name "Buying signals" --event mention.buy_intent --filter '{"intents":["buy_intent"]}' --channelIds dest_...
```

Ids are positional; filters and fields are flags named exactly as in the API. Every flag takes a value, booleans included (`--muted false`), so an update can set a field either way. Lists are comma-separated, nested objects are JSON, and on a nullable field the literal `null` clears it (`--note null`). A whole body can go in `--json '{...}'`, or `--json -` to read it from stdin; flags override its fields.

## Output

JSON, always: compact when piped, indented on a terminal or with `--pretty`, so `mentio ... | jq` and a glance both work. `--table` renders a list as columns:

```bash
mentio keywords:list --table
mentio mentions:search --limit 5 | jq '.data[].post.url'
```

Errors go to stderr as the API's [error envelope](/errors) and exit 1; a usage mistake exits 2. CSV exports print the file (`mentio mentions:export --since 2026-09-01 > mentions.csv`) or write it with `--out`.

## Follow the feed

```bash
mentio mentions:watch --platform reddit --relevant true --interval 30
```

`mentions:watch` polls the newest page and prints each mention it has not printed before as one JSON line, oldest first, so a pipeline is an alert channel. It takes the same filters as `mentions:search`. `--from-start` prints the current page before following.

```bash
mentio mentions:watch --sentiment negative | while read -r line; do
  echo "$line" | jq -r '.post.url' | xargs -I{} curl -s -X POST "$SLACK_WEBHOOK" -d "{\"text\":\"Negative mention: {}\"}"
done
```

## MCP in one line

`mentio mcp:config` prints the configuration for the [MCP server](/mcp) with your key filled in:

```bash
mentio mcp:config                    # the `claude mcp add` command
mentio mcp:config --client cursor    # JSON for .cursor/mcp.json
mentio mcp:config --client vscode    # JSON for .vscode/mcp.json
```

## Any-API alternative

If you already use [Restish](https://rest.sh), it reads the same OpenAPI document and gives you a generic command line with no install of ours:

```bash
restish api configure mentio https://api.mentio.dev/v1/openapi.json
```
