# AI agents welcome.

Your agent can do anything in Mailpiece you can do on screen: **draft a post**, **send you a test**, **schedule** it, **publish** it and **look after your subscribers**.

It works with Claude Code, Codex, OpenCode, Cursor, Gemini CLI, Claude Desktop, GitHub Copilot, Cline and Zed.

## Running a coding agent

**The `mailpiece` CLI** reaches your whole newsletter from the terminal, so any agent that runs shell commands can work with it. **`mailpiece mcp`** serves it as MCP tools, and only reads until you pass `--writes`. **`mailpiece skill install`** gives your agent the skill for setting Mailpiece up and using it.

Each agent has its setup: [Claude Code](https://mailpiece.dev/integrations/claude-code), [Codex](https://mailpiece.dev/integrations/codex), [OpenCode](https://mailpiece.dev/integrations/opencode), [Cursor](https://mailpiece.dev/integrations/cursor), [Gemini CLI](https://mailpiece.dev/integrations/gemini-cli), [Claude Desktop](https://mailpiece.dev/integrations/claude-desktop), [GitHub Copilot CLI](https://mailpiece.dev/integrations/copilot-cli), [VS Code](https://mailpiece.dev/integrations/vscode), [Cline](https://mailpiece.dev/integrations/cline) and [Zed](https://mailpiece.dev/integrations/zed). The rest is in [Agents and the CLI](https://mailpiece.dev/docs/agents).

```sh
git clone https://github.com/mailpiece/mailpiece-cli.git
cd mailpiece-cli && make build

mailpiece auth login TOKEN --account 834206594 --api-url https://app.example.com
mailpiece skill install
claude mcp add mailpiece -- mailpiece mcp --writes
```

## Building your own

**The app's screens also answer JSON**: add `.json` to the address. Sign in with a **personal access token** made under your profile: **a read token only looks**, and **a read and write token** can also create, change and delete.

[Read the JSON API guide](https://mailpiece.dev/docs/api)

## Careful with sending

Your agent can **draft freely and send you a test whenever it is ready**, since a test mails one address, yours unless you name another. Mailing the whole list can't be undone, so the skill tells your agent **never to run `post deliver` unless you asked for exactly that**, and your readers hear from you when you say so.
