# Treechat MCP server

Connect Claude, Codex, Cursor or any MCP client to your Treechat account. Your assistant can read and post in your threads, upload files, and generate images, video, music and voice, paid per use. You choose what it may do and how much it may spend.

Server URL: `https://api.treechat.com/mcp`

Use the full address, ending in `/mcp`. `https://api.treechat.com` on its own will not connect.

## Connect

### Claude (claude.ai, Claude Desktop, Claude mobile)

1. Open Customize > Connectors.
2. Select Add, then Add custom connector.
3. Name: `Treechat`. URL: `https://api.treechat.com/mcp`. Click Continue.
4. Keep the settings Claude marks Detected ("Use Claude's published identity"). Leave the OAuth client ID and secret empty.
5. Click Add, then Connect, and approve on the Treechat page that opens.

On a Team or Enterprise plan, an Owner adds the connector under Organization settings > Connectors, then each member clicks Connect.

### Claude Code

`claude mcp add --transport http treechat https://api.treechat.com/mcp`

Then run `/mcp` in Claude Code and choose treechat to sign in.

### Codex

`codex mcp add treechat --url https://api.treechat.com/mcp`

### Cursor and other MCP clients

`{ "mcpServers": { "treechat": { "url": "https://api.treechat.com/mcp" } } }`

The first call opens the Treechat sign-in page.

### No MCP client

Use the CLI: https://treechat.com/cli. `treecli mcp serve` also runs the same tools as a local MCP server over treecli's own connection.

## What happens when you connect

1. Your app opens a Treechat page. Sign in, or create an account (email, Google or X).
2. The page names the website asking for access (for example claude.ai) and lists what it wants to do.
3. If the app wants to generate media or post, choose a per-action price cap and a daily spending limit.
4. Click Allow access. You can add a card for pay-as-you-go AI.

The connection renews itself. If you don't use it for 30 days, connect again. To disconnect, remove the connector in your app.

## Permissions

- Read: see your threads (including private ones), notifications and account details.
- Post: post and reply as you.
- Generate: create images, video, music and voices, charged to your account at normal prices, within the per-action cap and daily limit you set.
- Upload: upload images, audio and video to your account.
- Billing: check your billing and set up or change how AI usage is paid.

## Tools (20)

- Read: `treechat_read`, `treechat_account`, `treecli_reference`, `treecli_local_capabilities`
- Post: `quote_treechat_write`, `create_treechat_write`, `get_treechat_write`, `clear_notifications`
- Generate: `list_generation_actions`, `quote_generation`, `create_generation`, `generate_media`, `get_generation`, `get_generation_viewer_media`, `get_generation_budget`, `enable_generation`
- Upload: `register_upload`, `upload_file`, `finish_reference_upload`
- Billing: `treechat_billing`

## For agents

Setup prompt to give your agent:

1. Add the Treechat MCP server at `https://api.treechat.com/mcp` (streamable HTTP, OAuth).
2. Start sign-in and give me the link. I'll sign in, choose spending limits and approve. Never ask for my password.
3. Call `get_generation_budget` and `list_generation_actions` to see what is available.
4. Before any paid generation, call `quote_generation` and pass a price cap I approved.

Facts:

- Transport: streamable HTTP at `https://api.treechat.com/mcp`.
- Auth: OAuth 2.1 authorization code with PKCE (S256). Protected resource metadata: `https://api.treechat.com/.well-known/oauth-protected-resource/mcp`. Authorization server metadata: `https://api.treechat.com/.well-known/oauth-authorization-server`.
- Client identity: Client ID Metadata Documents are supported (`client_id_metadata_document_supported: true`): use your HTTPS metadata URL as the client_id, as a public client (`token_endpoint_auth_method: none`). There is no dynamic client registration endpoint.
- Send `resource=https://api.treechat.com/mcp` on authorization and token requests.
- Scopes: `treechat:read`, `account:read`, `treechat:write`, `generation:read`, `generation:quote`, `generation:create`, `uploads:write`, `billing:manage`. Ask only for what you need.
- Access tokens last 15 minutes. Refresh tokens rotate on every refresh; a connection unused for 30 days must be approved again.
- Spending: quote first and pass a price cap; a quote over the cap is refused before anything is charged. Calls past the daily limit fail with `daily_limit_reached`. Retries with the same quote and idempotency key are not charged twice.
- Model catalog with prices (no account needed): https://api.treechat.com/api/v1/ai/catalog

## Troubleshooting

- "Couldn't register" or asked for a client ID: check the URL ends in `/mcp`, leave the client ID and secret empty, and keep "Use Claude's published identity".
- "Couldn't reach the MCP server": the URL is wrong or incomplete. Use `https://api.treechat.com/mcp`.
- Sign-in worked before and now fails: the connection went unused for 30 days. Connect again.
- A generation was refused: it was over your per-action cap or daily limit, or billing is not set up. Ask the assistant to call `get_generation_budget`.

More: https://treechat.com/cli · https://treechat.com/ai · https://docs.treechat.com
