# Connect your agent to TrayPost

Use the TrayPost CLI to identify your approved mailbox from Claude, ChatGPT, or Cursor. If your chat runs commands in a sandbox, run these steps in your computer’s terminal. A terminal lookup verifies the CLI. To verify the chat connection, repeat the lookup from the chat’s configured tool.

<a id="controlled-client-walkthrough-on-macos"></a>
<a id="controlled-client-walkthrough-on-macos-windows-and-linux"></a>

## Install the CLI

You need Node.js 22 or later with npm and Python 3.9 or later with venv. On Windows, install the Python `py` launcher. The CLI stores each client’s credential in macOS Keychain, Windows Credential Manager, or Linux Secret Service. On Linux, use a D-Bus user session with an unlocked Secret Service keyring.

TrayPost publishes the [CLI](https://www.npmjs.com/package/@alexnpm2372/traypost-cli) and [mailbox MCP server](https://www.npmjs.com/package/@alexnpm2372/traypost-mailbox-mcp) under the npm scope `@alexnpm2372`.

Run these commands on the computer that will launch the MCP server. Claude can report Linux because its command tool runs in a separate VM, even when the desktop app runs on macOS. For a Mac desktop connection, run setup in macOS Terminal. For a Linux host, run it in the Linux user session that owns the unlocked keyring.

Run from any directory:

```sh
npm install -g @alexnpm2372/traypost-cli
traypost setup
```

## Approve and verify your mailbox

Choose your client name: `claude`, `chatgpt`, or `cursor`. Use the same name in both commands. For example, to connect Claude, generate its public approval code:

```sh
traypost claude approval
```

Sign in to your [TrayPost account](https://traypost.vercel.app/account#interface-setup). Check the mailbox address, paste the **public approval code**, and choose **Approve mailbox access**. Once approved, run:

```sh
traypost claude identify
```

Compare the returned address with the mailbox in your account. You can revoke access there with **Disconnect interface**.

## Connect the MCP server to your chat

In the same terminal and OS account used for approval, install the server and print the configuration for your local stdio MCP client:

```sh
npm install -g @alexnpm2372/traypost-mailbox-mcp
traypost-mcp config claude
```

Substitute `cursor` or `chatgpt` if that was your approval client. Merge the printed server entry into your MCP host’s local configuration, reload its tools, and ask the chat to call `identify_mailbox`. Confirm the returned mailbox matches your account. The server exposes one mailbox identification tool. If Claude reports a cloud Linux shell and has no TrayPost tool, complete setup in your computer’s terminal, configure the local MCP host, then open a new chat in that host. Verify that the new chat can call identify_mailbox. The original cloud chat does not gain access from the terminal lookup.

## HTTPS setup for clients with private credential storage

Use the HTTPS origin of this guide for all TrayPost requests. If your interface can only read public pages, explain that setup requires a private credential store and an authenticated HTTPS request tool. Do not claim success or ask the user to paste a provider key or session cookie.

1. Generate a private token inside a trusted tool using a cryptographic random generator: the literal prefix `tp_agent_` followed by 32 random bytes encoded as 64 lowercase hexadecimal characters. Save it under this TrayPost origin in private client-side credential storage. Reuse it on retries. Keep it out of chat, project files, command-line arguments and logs.
2. Compute SHA-256 of the entire UTF-8 token string (including the prefix, without a newline) and encode the digest as lowercase hex. This digest is the **public approval code**. Give the owner only this code and a link to `/account#interface-setup` on the same origin.
3. Ask the owner to sign in and approve mailbox identification using that code. If their mailbox is still provisioning, wait for it to be ready.
4. Using the stored token, send an empty HTTPS POST to `/api/agent/mailbox` on that same origin with the header `Authorization: Bearer <private token>`. Disable redirects. A 401 means approval is missing or access has been revoked. A 503 means to retry later.
5. On a 200 response, show the returned mailbox and ask the owner to confirm it is the address they approved. The dashboard shows verified after refresh. The owner can disconnect this interface independently in the dashboard.
