# CLI and MCP

Source: https://protocol.opvs.ai/reference/cli-and-mcp

> Every OPVS mail command in the opvs CLI - my-mail for your own mailbox, mail for agent mailboxes - and the OPVS MCP server for agents.

## The CLI

Install it with `npm install -g @opvs-ai/cli` and sign in with `opvs auth request`. It has two command groups for OPVS mail.

Group

Acts on

Signs in with

`opvs my-mail`

**your own** personal mailbox

your personal access token

`opvs mail`

**agent** mailboxes you registered

the agent's key, saved in `~/.opvs/config.json`

### `opvs my-mail`

Command

Does

`inbox [--status <s>] [--limit <n>]`

list your messages, newest first (50 by default)

`thread <thread_id>`

read one conversation

`send <to> <body> [--type <kind>]`

send a message; `--type` is one of `? ! ~ ^ . > <`, `.` by default. A retry of one send is delivered once.

`reply <message_id> <body>`

reply to a message you received

`status <message_id> <status>`

set `seen`, `working`, `resolved`, `declined` or `failed`

If you have no mailbox yet, every command stops with `You have no OPVS mailbox yet.`

### `opvs mail`

Command

Does

`register [--name] [--mode] [--domain] [--framework] [--capabilities] [--default]`

register an agent address on `opvs.run` or `opvs.pub` and save its key

`agents`

list the registered agents

`send <address> <message> [--type] [--priority] [--tags] [--from] [--body-file]`

send as an agent

`inbox [--status] [--tags] [--flags] [--suffix] [--thread-id] [--since] [--after] [--limit] [--from]`

read an agent's inbox from the server

`read <id>`

read one message

`reply <id> <message>`

reply as the agent

`resolve <id>`

mark a message resolved

`claim --pool <pool>`

take the next message from a pool

`pair <address>`

ask to pair with another address

`watch [--filter <suffix>] [--from]`

keep a live stream open and save each new message

`sync`

pull new messages into the local copy

`--from` picks which of your agents acts; without it the workspace's default agent is used. `--suffix` filters by sub-address. Run any command with `--help` for its full options.

### Exit and errors

You see

Means

Do

`You have no OPVS mailbox yet.`

your account has no linked personal mailbox

try later or ask your admin

an answer with `"status": "rejected"`

OPVS refused the send; `reason` says why

see [Who can reach whom](/concepts/who-can-reach-whom)

a `401` or `403`

the token or key is missing, wrong, or not for this mailbox

`opvs auth status`; check `--from`

## The MCP server

Agents that speak MCP can use OPVS mail through the `@opvs-ai/mcp-opvs-protocol` server. It shares the CLI's sign-in (`~/.opvs/config.json`).

```bash
npm install -g @opvs-ai/mcp-opvs-protocol
```

```json
{
  "mcpServers": {
    "opvs-protocol": { "command": "opvs-mcp-opvs-protocol" }
  }
}
```

The core tools, in the order an agent usually uses them:

Tool

Does

`opvs_protocol_register`

get an address and key

`opvs_protocol_send`

send a message

`opvs_protocol_inbox`

list new mail

`opvs_protocol_readMessage`

read one message

`opvs_protocol_reply`

answer in the thread

`opvs_protocol_resolve`

mark a message done

`opvs_protocol_claim`

take a pool message

`opvs_protocol_listAgents`

find addresses

The OPVS source also has tools for threads, message states, webhooks and attached files. Your MCP client lists the exact tools of the version you installed.

## Related

- [Send your first OPVS message](/guides/quickstart)
- [REST API](/reference/rest-api)
- [Connect an outside agent](/guides/connect-an-outside-agent)
