# Connect ORDan to your AI client

`ordan-mcp` is ORDan's MCP server. It gives an AI agent phone calls, SMS and
phone numbers under its owner's capabilities, spend limits and approvals. It
runs on your machine over stdio: your client starts it with `npx -y ordan-mcp`
(Node.js 18.3 or later), and it talks to the ORDan API at
`https://api.ordan.io`.

- npm: [`ordan-mcp`](https://www.npmjs.com/package/ordan-mcp)
- MCP Registry: [`io.github.joshluberisse/ordan`](https://registry.modelcontextprotocol.io/v0.1/servers/io.github.joshluberisse%2Fordan/versions/latest)
- Pairing CLI: [`ordan-cli`](https://www.npmjs.com/package/ordan-cli), which
  installs the `ordan` command

Assistants that only accept a hosted MCP URL, such as ChatGPT, claude.ai on
the web and Microsoft Copilot Studio, connect to ORDan's hosted connector at
`https://mcp.ordan.io/mcp` instead, with nothing to install. See
[Hosted connector](#hosted-connector).

## 1. Pair the agent

An agent acts only under a grant its owner approves. Pair once per machine.
The credential stays on that machine and never enters the conversation.

```bash
npx -y ordan-cli agents connect --name "My Assistant"
```

The CLI prints a pairing URL, `https://app.ordan.io/activate`, and a short
code. The owner signs in, reviews the requested capabilities and monthly
limit, picks the organization and approves. The credential is saved to
`~/.config/ordan/credentials.json` (directory `0700`, file `0600`), where
`ordan-mcp` finds it. `npx -y ordan-cli status` shows which agent the machine
is paired as.

By default the agent asks for:

- outbound and inbound calls, DTMF, hanging up and transferring calls;
- sending and receiving SMS;
- provisioning a number;
- policy checks, and reading its own usage and events;
- a $25 monthly limit.

`--capabilities` and `--monthly-limit` change the request.

Other ways to pair:

- **From the conversation.** Skip the CLI and ask the agent to connect to
  ORDan. It calls the MCP tool `ordan.agent.create`, which returns the same
  pairing URL and code for the owner. Once the owner approves, the server
  holds the credential and saves it for the next session.
- **Over REST.** `POST /v1/agents` creates an agent and never pairs: it
  returns no URL or code. To pair over REST, start a request with
  `POST /v1/oauth/device/authorize`, show the owner its `verification_uri`
  and `user_code`, and poll `POST /v1/oauth/token`. A project key with
  `grants:write` needs no pairing: its `POST /v1/agents` creates the agent
  with a grant at once, it binds Lines with `POST /v1/grants/{grant}/lines`,
  and it acts for the agent by passing `agent` in its requests.
- **Headless machines and CI.** Issue a credential from the agent's page in
  the console (*Agents*), and give it to the server as `ORDAN_AGENT_TOKEN`.

## 2. Add the server to your client

### Claude Code

```bash
claude mcp add --scope user ordan -- npx -y ordan-mcp
claude mcp list
```

### Claude Desktop

*Settings → Developer → Edit Config* opens `claude_desktop_config.json`:

- macOS: `~/Library/Application Support/Claude/`
- Windows: `%APPDATA%\Claude\`
- Linux: `~/.config/Claude/`

Add ORDan, then quit and reopen Claude Desktop:

```json
{
  "mcpServers": {
    "ordan": { "command": "npx", "args": ["-y", "ordan-mcp"] }
  }
}
```

### OpenAI Codex (CLI and IDE extension)

```bash
codex mcp add ordan -- npx -y ordan-mcp
codex mcp list
```

Or in `~/.codex/config.toml`:

```toml
[mcp_servers.ordan]
command = "npx"
args = ["-y", "ordan-mcp"]
```

### VS Code and GitHub Copilot

In `.vscode/mcp.json`. VS Code's key is `servers`, not `mcpServers`:

```json
{
  "servers": {
    "ordan": { "type": "stdio", "command": "npx", "args": ["-y", "ordan-mcp"] }
  }
}
```

Or from a terminal, for your user profile:

```bash
code --add-mcp '{"name":"ordan","type":"stdio","command":"npx","args":["-y","ordan-mcp"]}'
```

### Cursor

In `~/.cursor/mcp.json` for all projects, or `.cursor/mcp.json` for one:

```json
{
  "mcpServers": {
    "ordan": { "type": "stdio", "command": "npx", "args": ["-y", "ordan-mcp"] }
  }
}
```

With the Cursor CLI, `agent mcp list` shows whether ORDan connects.

### Gemini CLI

```bash
gemini mcp add -s user ordan npx -y ordan-mcp
gemini mcp list
```

Or in `~/.gemini/settings.json` for all projects, or `.gemini/settings.json`
for one:

```json
{
  "mcpServers": {
    "ordan": { "command": "npx", "args": ["-y", "ordan-mcp"] }
  }
}
```

Gemini CLI starts MCP servers only in folders you trust. In an untrusted
folder `gemini mcp list` shows ORDan as disabled; trust the folder when
Gemini asks, or later with `/permissions`.

### Other MCP clients

Any client that launches stdio servers: command `npx`, arguments
`["-y", "ordan-mcp"]`.

### Options

Set these in the server's environment through your client: `env` in a JSON
config, or a flag after the server's name on the command line:

```bash
claude mcp add --scope user ordan -e ORDAN_PROFILE=work -- npx -y ordan-mcp
codex mcp add ordan --env ORDAN_PROFILE=work -- npx -y ordan-mcp
```

| Variable | Meaning |
| --- | --- |
| `ORDAN_API_URL` | The ORDan API. Default `https://api.ordan.io`. A saved credential is used only with the API that issued it. |
| `ORDAN_AGENT_TOKEN` | An agent credential to use instead of a paired one. |
| `ORDAN_PROFILE` | Which saved credential to use (default `default`). Pair another with `--profile <name>`. |
| `ORDAN_CONFIG_DIR` | Where saved credentials live. |

`npx -y ordan-mcp` runs the latest release; `ordan-mcp@<version>` pins one.

## 3. Check the connection

Ask the agent:

- "What's my ORDan status?" It calls `ordan.agent.status`.
- "Which Lines do I have?" It calls `ordan.line.list`.
- "What have I spent this month?" It calls `ordan.usage.get`.

## Hosted connector

For scopes, the current tool list and troubleshooting, see the
[hosted-connector guide](mcp-hosted.md).

The hosted connector is ORDan's MCP server as a URL:

```
https://mcp.ordan.io/mcp
```

It speaks Streamable HTTP and signs in with OAuth 2.1. Add it to your
assistant, and the assistant opens ORDan's console. There you sign in and
choose:
- which organization it acts in;
- which of the requested actions it may take (you can only narrow them);
- the Lines it may call and text from;
- the policy it follows, and its monthly limit.

It then acts as an agent you approved, exactly like a paired one. You can
revoke it any time under *Agents*.

- **claude.ai and Claude Desktop:** *Settings → Connectors*, add a custom
  connector with the URL above, then connect.
- **Claude Code:**

  ```sh
  claude mcp add --transport http ordan https://mcp.ordan.io/mcp
  ```

  Then run `/mcp` in Claude Code and choose *Authenticate*.
- **ChatGPT:** turn on developer mode in ChatGPT's settings, then create a
  connector with the URL above and OAuth authentication.
- **OpenAI Codex:**

  ```sh
  codex mcp add ordan --url https://mcp.ordan.io/mcp
  codex mcp login ordan
  ```
- **VS Code and GitHub Copilot**, in `.vscode/mcp.json`:

  ```json
  {
    "servers": {
      "ordan": { "type": "http", "url": "https://mcp.ordan.io/mcp" }
    }
  }
  ```
- **Microsoft Copilot Studio:** add a Model Context Protocol tool of type
  *Streamable*, with the URL above and OAuth 2.0 *dynamic discovery*.

The hosted connector offers the tools an assistant without a terminal can
use. Which ones appear depends on what you approved and on what this ORDan
deployment has switched on:

| You approved | Tools |
| --- | --- |
| Reading (always) | `ordan.agent.status`, `ordan.line.list`, `ordan.usage.get`, `ordan.ledger.read`, `ordan.policy.check` |
| Calls, while ORDan voice is on | `ordan.call.create`, `ordan.call.speak`, `ordan.call.speak.stop`, `ordan.call.listen`, `ordan.call.status`, `ordan.call.list`, `ordan.call.hangup`, `ordan.call.dtmf`, `ordan.call.report` |
| Texts, while SMS is on | `ordan.sms.send`, `ordan.sms.read` |

Numbers, purchases, transfers and recording stay with the local server. So
does `ordan.agent.create`, since the connector's sign-in replaces pairing.

## What the agent can do

| Area | Tools |
| --- | --- |
| Pairing | `ordan.agent.create`, `ordan.agent.status` |
| Lines and numbers | `ordan.line.provision`, `ordan.line.list`, `ordan.line.update`, `ordan.line.release`, `ordan.number.list`, `ordan.number.release` |
| Calls | `ordan.call.create`, `ordan.call.speak`, `ordan.call.speak.stop`, `ordan.call.listen`, `ordan.call.status`, `ordan.call.list`, `ordan.call.answer`, `ordan.call.hangup`, `ordan.call.transfer`, `ordan.call.dtmf`, `ordan.call.record`, `ordan.call.report` |
| SMS | `ordan.sms.send`, `ordan.sms.read` |
| Checks and records | `ordan.policy.check`, `ordan.usage.get`, `ordan.ledger.read` |
| Purchases | `ordan.purchase.authorize`, `ordan.purchase.complete`, `ordan.purchase.cancel` |

Every tool acts as the agent, and every action is checked against what the
owner granted: its capabilities, the Line it is bound to, the owner's policy
and the spend limits. Some actions need the owner's approval. By default
that includes texting or calling a new recipient. Such an action returns
`approval_required` with an `apr_…` id. The owner approves it in the console
under *Approvals*, and the agent retries with that `approval`.

The owner can withdraw a capability, unbind a Line or revoke the agent at any
time from the console. Revocation is immediate.

## Notes

- **Voice.** ORDan connects US numbers. On a Line with ORDan voice on, ORDan
  speaks the agent's text (`ordan.call.speak`) and transcribes the other
  party (`ordan.call.listen`), after a fixed opening that says the voice is
  automated. Without it, nothing is said on the call for the agent. A
  hosted connector places calls only on a Line with ORDan voice on. See
  [ORDan voice](voice.md#ordan-voice).
- **Feature switches.** SMS, call recording, transfers and messaging
  registration are switched on one at a time. Until a feature is on, its
  actions return `feature_disabled`.
- **Money.** Amounts are USD integer micros ($1 = 1000000). See the
  [API reference](api.md).
- **More.** Pairing, credentials and the SDKs are covered in
  [SDK, CLI and MCP](clients.md). Approvals and retries are in
  [errors](errors.md).
