# SDK, CLI and MCP

The client packages are prepared for npm and PyPI but **not published
yet**. Their names will be `ordan` + `@ordan/cli` (the same CLI),
`@ordan/sdk` and `@ordan/mcp` on npm, and `ordan` on PyPI. Until a
release is announced, do not assume a similarly named public package is
ORDan's client.

## Node and Python

```ts
import { Ordan } from "@ordan/sdk";
const client = new Ordan({ apiKey: process.env.ORDAN_API_KEY,
  baseUrl: process.env.ORDAN_API_URL });
const calls = await client.calls.list();
const usage = await client.usage.retrieve();
const corrections = await client.usage.adjustments();
```

```python
import os
from ordan import Ordan
client = Ordan(api_key=os.environ["ORDAN_API_KEY"],
               base_url=os.environ["ORDAN_API_URL"])
calls = client.calls.list()
usage = client.usage.retrieve()
corrections = client.usage.adjustments()
```

Resources: `agents`, `lines`, `calls`, `messages`, `numbers`, `ports`,
`usage`, `events`, `policy`, `recordings`, `ledger`, `purchases`, plus
`messagingRegistration`. Port methods include update, requirements,
document upload and confirm. Agent credentials cannot use owner-only
registration/port endpoints merely because a method exists.

HTTP retries keep idempotency keys; reuse a key explicitly across
application-level retries too. For surfaces not wrapped, use the client's
low-level `request` or the OpenAPI contract.

## CLI and MCP

Both default to your operator's API (`ORDAN_API_URL`, or `--api-url`):

```bash
ordan agents connect --name "Assistant"
ordan-mcp            # MCP clients: { "command": "npx", "args": ["-y", "@ordan/mcp"] }
```

The MCP stdio server pairs its agent through the human device flow;
credentials remain in its connection, not the tool conversation. Tools
include `ordan.agent.create/status`,
`ordan.line.provision/list/update/release`,
`ordan.call.create/status/list/answer/hangup/transfer/dtmf/record/report`,
`ordan.sms.send/read`, `ordan.policy.check`, `ordan.usage.get`,
`ordan.ledger.read`, and delegated purchase operations. Registration and
port signing remain an authorized owner/key task — not an agent
self-approval tool.
