# Use with AI agents

> Point Claude Code, Cursor, Codex, Windsurf or ChatGPT at Mailmanny's llms.txt and Markdown docs, and set up the SDK with one prompt.

Source: https://www.mailmanny.com/docs/ai-agents
All docs for AI agents: https://www.mailmanny.com/llms.txt

Every page of these docs is also plain Markdown, written to be read by coding agents. Point your agent at one URL and it can install the SDK, send a test email and add your first contact.

## Give your agent the docs

Each of these is plain text on `https://www.mailmanny.com`, with absolute links, so an agent can follow them from anywhere:

- `/llms.txt`: Start here. The docs index in the [llms.txt](https://llmstxt.org) format: what Mailmanny is, the setup steps, and a link to each page's Markdown.
- `/llms-full.txt`: Every docs page in one file, in reading order. For agents that read everything up front, or to attach to a chat.
- `/docs/<page>.md`: One page as Markdown: add `.md` to any docs URL, like `/docs/sending.md`. The quickstart is `/docs.md`.
- `/sdk/README.md`: The Node.js SDK's README: every method, with examples.

Each page also points to its Markdown in its `<link rel="alternate" type="text/markdown">` tag, and the **Copy page** button at the top of every page copies it as Markdown, with the code tab you picked.

## In your agent

- **Claude Code, Codex, Cursor, Windsurf** and other coding agents can read web pages. Put the llms.txt URL in your prompt (the [setup prompt](https://www.mailmanny.com/docs/ai-agents.md#setup-prompt) below does) and they open the pages they need.
- **ChatGPT, Claude and other chat assistants**: give them the URL when browsing is on, or paste a page with **Copy page**. For a long session, attach `llms-full.txt`.
- **Project instructions**: add a few lines to the file your agent reads at the start of every session (`AGENTS.md`, `CLAUDE.md` or your Cursor rules), so it knows where the docs are without being told.

**AGENTS.md**

```md
## Email: Mailmanny
- Docs for agents: https://www.mailmanny.com/llms.txt (add .md to any
  https://www.mailmanny.com/docs URL for Markdown)
- SDK: `import { Mailmanny } from "mailmanny"`, key in MAILMANNY_API_KEY,
  server-side only
- Every call returns { data, error }: check error.name instead of try/catch
```

## Set up with one prompt

Before you start, in the Mailmanny app:

1. Verify your sending domain in [Settings → Domains](https://www.mailmanny.com/settings/domains).
2. Create an API key with **Full access** in [Settings → API keys](https://www.mailmanny.com/settings/api-keys), and add it to your server's environment as `MAILMANNY_API_KEY` (for example in `.env.local`).

Then open your agent in your project's folder and paste this, with your own email address in place of `you@example.com`:

**Setup prompt**

```md
Set up Mailmanny (email API + Node.js SDK) in this project. Read
https://www.mailmanny.com/llms.txt first and open the linked .md pages you need.

1. Install the SDK with this project's package manager: `npm install mailmanny`. If
   the project sends React Email components, also install `@react-email/render`.
2. Read the API key from the `MAILMANNY_API_KEY` environment variable, in server
   code only. Never hard-code it, log it or use it in client code (the API refuses
   browser requests). If it isn't set, stop and ask me to create a key in Settings →
   API keys.
3. Create one shared client: `new Mailmanny(process.env.MAILMANNY_API_KEY)`. Every
   method returns `{ data, error }` and doesn't throw for API errors: check `error`
   and branch on `error.name`.
4. Ask me which address to send from. Its domain must be verified in Settings →
   Domains, and there's no API for domains: if a send fails with
   `invalid_from_address`, stop and ask me to verify the domain. Don't try other
   domains.
5. Send a test email to you@example.com from a small script or server route, print
   the returned id, then check it with `mm.emails.get(id)`.
6. Add me as a contact: list audiences with `mm.audiences.list()`, ask me which one
   to use, then call
   `mm.contacts.create({ audienceId, email, firstName, consentSource })`. Double
   opt-in audiences email a confirmation link, so the contact stays `pending` until
   I click it.
7. Track an event for that contact:
   `mm.events.track({ audienceId, email, name: "signup.completed" }, { idempotencyKey })`.
   It starts automations whose trigger is "API event" with the same name. Events
   need the Standard or Pro plan (402 `plan_required` otherwise) and a contact
   that's already in the audience (404 `not_found` otherwise).
8. Tell me what you changed and what I still need to do in the Mailmanny app.
```

> **Warning:** Review what the agent changes
> Agents run commands and edit files. Read the diff before you commit it, and check that your env file is in `.gitignore`: an API key in a repository is a leaked key. Revoke a leaked key in [Settings → API keys](https://www.mailmanny.com/settings/api-keys) right away.

> **Note:** No MCP server
> Mailmanny doesn't have an MCP server. Your agent writes code against the SDK or the REST API, the same code you would write, with these docs as its reference.

## Next steps

- [Sending email](https://www.mailmanny.com/docs/sending.md): Transactional email with React Email, HTML or a saved template.
- [Contacts & audiences](https://www.mailmanny.com/docs/contacts.md): Add, update and remove people, Mailchimp-style.
- [Events & automations](https://www.mailmanny.com/docs/events.md): Start automations when something happens in your app.
- [Errors](https://www.mailmanny.com/docs/errors.md): Every error name, and what to do about it.
