# Agent Morning Brief — setup guide for AI agents

> You are an AI agent. Your user wants a **private daily podcast** built from what you know about their day.
> Follow these steps. Product page: https://newstack.be/en/agent-morning-brief

## What it is

Agent Morning Brief is an MCP server. You send facts (a "brief"); the server writes a spoken script
(greeting by name, yesterday's recap, today's plan, action reminders), voices it with a natural voice,
adds a jingle and publishes the MP3 to a private RSS feed the user subscribes to once in their podcast app.

- MCP endpoint (Streamable HTTP, stateless): `https://agent-morning-podcast.cool.newstack.be/mcp`
- No key needed for `create_account`. Every other tool needs the API key returned by `create_account`.
- Send the key as `Authorization: Bearer mbp_...`, **or** pass it as the `api_key` argument of each tool
  if you cannot set headers.

## Step 1 — Connect

Add the remote MCP server `https://agent-morning-podcast.cool.newstack.be/mcp` to your tools if you can. If you cannot add MCP servers, call it as
JSON-RPC over HTTP (see "HTTP fallback" below).

## Step 2 — Create the account (once per user)

Call `create_account`:

```json
{ "display_name": "Camille", "language": "en", "timezone": "Europe/London", "tone": "warm and upbeat", "agent_label": "my-agent-name" }
```

- `display_name`: the user's first name (used in the greeting).
- `language`: ISO 639-1 (`en`, `fr`, `nl`, `de`, `es`…).
- `timezone`: IANA timezone of the user (quotas and dates use the user's local day).

The response contains `api_key`, `feed.rss`, `feed.apple_podcasts`, `feed.overcast`, `feed.pocket_casts`.

- **Store `api_key` securely** (secret store, environment variable, memory marked private). It is shown only once.
  Never print it in public channels or logs.
- **Send the user the subscription link** (`feed.apple_podcasts` on iPhone/Mac, otherwise `feed.rss`).
  Tell them the feed is private and should not be shared.

## Step 3 — Every day, send a brief

Call `create_episode` (recommended: every morning, e.g. 07:00 in the user's timezone):

```json
{
  "brief": {
    "yesterday": ["Shipped v2 of the app", "Signed 3 new clients"],
    "today": ["10:00 product team meeting", "Dentist at 17:30"],
    "actions": ["Send the quote to Martin before noon"],
    "news": ["The trade fair opens on Thursday"],
    "notes": "Optional free text."
  },
  "wait_seconds": 120
}
```

Rules:
- **Facts, not prose.** Short items, one fact each. The server writes the script, removes duplicates and orders by importance.
- Leave out empty sections. Do not include secrets, passwords or data the user would not want read aloud.
- `wait_seconds` (0–240) makes the call wait for the audio and return `episode.audio_url`. With `0`, poll `get_episode`.
- Optional: `target_minutes` (capped by the plan), `tone`, `jingle` (default true).

### Response statuses

| Status | Meaning | What to do |
|---|---|---|
| `queued` / `processing` | Being produced | Wait or poll `get_episode` |
| `published` | Ready | Optionally share `audio_url` with the user |
| `limited` | Free-plan limit reached | The brief is **saved for the next episode** and a short audio note is published. Tell the user the date in `next_available_date`, or suggest the Pro plan. Do not retry. |
| `failed` | Production error | Retry once later |

Errors are returned as `{"error": "<code>", "message": "..."}`: `unauthorized` (bad key), `rate_limited`,
`quota_exceeded` (paid plans), `empty_brief`, `invalid_input`.

## Several agents, one podcast

- An agent that already has the key can create a key for another agent: `create_agent_key { "label": "crm-agent" }`.
- During the day, each agent adds facts without generating an episode:
  `add_brief_items { "source": "calendar", "items": [{ "section": "today", "content": "Board meeting at 14:00" }] }`
  (`section` ∈ `yesterday`, `today`, `actions`, `news`, `notes`).
- The next `create_episode` merges every pending item (set `include_pending: false` to skip them).

## Other tools

| Tool | Use |
|---|---|
| `get_episode { "episode_id" }` | Status, script, MP3 link |
| `list_episodes { "limit": 10 }` | Recent episodes |
| `share_episode { "episode_id", "ttl_hours": 168 }` | Expiring link to one MP3 (does not reveal the feed) |
| `get_account` | Profile, plan, usage, feed links, agent keys |
| `update_profile` | Change `display_name`, `language`, `timezone`, `tone`, `voice`, `tts_provider` |
| `revoke_agent_key { "key_prefix" }` | Revoke another agent's key |
| `rotate_feed_url` | New secret feed URL if the link leaked (user must re-subscribe) |

## Free plan (current)

One episode per local day during the first month, then one every other day; up to 5 minutes; 7-day history.
Over the limit, `create_episode` returns `limited` (never an error) and keeps the brief.

## HTTP fallback (no MCP client)

```bash
curl -s https://agent-morning-podcast.cool.newstack.be/mcp \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"create_account","arguments":{"display_name":"Camille","language":"en","timezone":"Europe/London"}}}'
```

Then, with the key:

```bash
curl -s https://agent-morning-podcast.cool.newstack.be/mcp \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json, text/event-stream' \
  -H 'Authorization: Bearer mbp_YOUR_API_KEY' \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"create_episode","arguments":{"brief":{"today":["10:00 product meeting"]},"wait_seconds":120}}}'
```

The tool result is JSON text in `result.content[0].text` (also in `result.structuredContent`).
