# AntiWave Remote MCP Server — External Agent Playbook

> Target audience: External AI agents (Grok, Claude, Cursor, Codex, OpenClaw, custom bots) calling `https://aiwave.top/api/mcp`.
> Protocol: Streamable HTTP Remote MCP (`jsonrpc: "2.0"`, `protocolVersion: "2024-11-05"`, `serverInfo: antiwave-mcp v0.5.0`).
> Auth: `Authorization: Bearer aw_live_<PERSONAL_API_TOKEN>` (`read_write` token required for writing/generating; `read_only` allowed for `account_status`, `get_content_item`, `audit_channel_copy`, `export_x_article_html`).
>
> **Clients that disallow secrets in remote HTTP headers (e.g. Grok / sandboxed bots)**: Store the token in an environment variable (`ANTIWAVE_API_TOKEN`) and run a local bridge or `mcp-remote` that forwards JSON-RPC requests to `/api/mcp` with `Authorization: Bearer $ANTIWAVE_API_TOKEN`. Set the proxy HTTP timeout to **>= 60 seconds** (multi-channel two-stage drafting + self-fix typically takes 20–45s) and pass through `initialize.result.instructions` unchanged.

---

## 1. End-to-End Standard Workflow (Follow in Order)

### Step 1 · Preflight (`account_status`, 0 pts)
Call `account_status` once at the start of a session. Record:
- `availableCredits`, `proTrial.remaining`, `dailyFree.remaining`
- `maxInputChars` (Free: 1,200 / Paid Pro · Max · Top-Up: 50,000)
- `styleProfiles` (5 classic master preset IDs + 7 built-in X plain-text viral pack IDs `x_viral_*` + user's custom distilled style IDs)
- `supportedLanguages` (`en`, `zh`, `ja`, `ko`, `es`, `pt`, `fr`, `de`)

### Step 2 · Save Raw Lead (Optional · `save_creator_idea`, 0 pts)
If the user only wants to collect leads or wants the raw research preserved separately on the Ideas Board, call `save_creator_idea` with `title`, `body`, `source_url`, `tag`, and 2–6 `keywords`.

### Step 3 · Multi-Channel Production (`produce_multi_channel`, 4 pts single / 12 pts pack)
1. **Compress raw research first** so `topic.length + source_material.length <= maxInputChars`. Never dump raw unedited web pages that exceed `maxInputChars`.
2. Choose `style_id` from `account_status.styleProfiles` (defaults to `wang_xiaobo` if omitted; use `x_viral_listicle` / `x_viral_mentor` / `x_viral_ledger` for plain-text X long/mid-long notes, or `x_viral_maxim` / `x_viral_hook` / `x_viral_bounty` / `x_viral_rebuttal` for `<=280`-weight punchy short X posts).
3. Set `image_mode` to reflect user intent:
   - `"none"`: user explicitly asks for text-only (works for any channel, including `xhs`!) → returns `visualBriefs: []` and `imageRecommendation: "none"`.
   - `"required"`: user explicitly asks for illustrations/covers (even for `x_short`).
   - `"auto"` (default): marks `xhs`/`x_article`/`wechat` briefs as `"recommended"` and `x_short` as `"optional"`.
4. Keep `save_to_workspace: true` (default) so AntiWave persists the idea, content item, and all channel variants. When drafting from an existing saved idea (e.g., returned by Step 2 `save_creator_idea`), pass `idea_id` (or the exact `source_urls`) to link the draft directly back to that idea without creating a duplicate `MCP 自动生成` card. Pass `schedule_date` (`YYYY-MM-DD`) if the user wants it queued for Chrome Extension prefill immediately.
5. Capture from the response:
   - `contentItemId`, `linkedIdeaId`, `linkedExistingIdea`, `workspaceUrl`, `channelUrls`
   - `variants` (`title`, `subtitle`, `body`, `extra`, `slides`, `gateReport`)
   - `imageRecommendation` & `visualBriefs` (each carrying `necessity`: `"required"` / `"recommended"` / `"optional"`)

### Step 3b · Batch Unpack to Plain-Text X Posts (`unpack_x_posts_batch`, 6 pts/source standard · 8 pts/source deep)
When the user wants to decompose **1–5 long-form articles, transcripts, or research notes** into a queue of standalone plain-text X posts (`4–5` posts/source in `"standard"`, `6–8` posts/source in `"deep"`):
- Pass `sources: [{ title, body, source_url?, idea_id? }]` (keeping total characters `<= maxInputChars`; only set `source_url` if the user ALREADY has a published URL for their OWN long-form article so `reply1` drives traffic to it — omit `source_url` when unpacking an unpublished draft, and NEVER pass a third-party reference URL), `match_mode: "auto"` (auto-matches each slice across all 7 `x_viral_*` plain-text packs) or `"manual"` (`allowed_style_ids`), and optional `auto_schedule_per_day: 1..5` + `schedule_start_date` (`YYYY-MM-DD`) to stagger posts into Studio Schedule (`scheduleUrl`) and Batch Studio (`studioBatchUrl`).

### Step 4 · Optional Image Generation & Attach to Studio (`attach_variant_media`, 0 pts)
**Image generation is NEVER mandatory.** Decide in two steps:
1. **Check User Intent & Channel Need FIRST**:
   - If the user asked for text-only (`image_mode: "none"`), OR if you only produced `x_short` (X short post) and the user did not ask for an image → **skip image generation completely** and proceed directly to Step 5.
   - If visuals are requested (`"required"`) or helpful (`"recommended"` for `xhs` / `x_article` / `wechat` when the user did not exclude images) → proceed to check capability below.
2. **Check Your Own Image Generation Capability SECOND**:
   - **If you have native image generation (e.g., Grok Imagine)**:
     1. Generate clean visuals for the `required` / `recommended` entries in `visualBriefs` matching each channel's target aspect ratio (`xhs` `3:4`, `x_article` `5:2`, `wechat` `2.35:1`, `x_short` `16:9` when requested).
     2. Call `attach_variant_media` with `content_item_id`, `channel`, and `images: [{ url, role, aspect_ratio, prompt, caption, slide_index }]` (public `https://` URL or compressed base64 `data:image/(png|jpeg|webp);base64,...`, ≤ 1.5 MB each, ≤ 8 per channel).
     3. Include the returned `workspaceUrl` / `channelUrl` in the content package.
   - **If you do NOT have image generation**:
     - Skip `attach_variant_media` and guide the user to open `workspaceUrl` if they want to export AntiWave's built-in deterministic 3:4 & 5:2 typography cards (PNG/ZIP).

### Step 5 · Deliver the Content Package to the User
Always format the final response as a scannable Markdown package:
1. **Studio Direct Links**: `workspaceUrl` + per-channel `channelUrls`.
2. **Per-Channel Final Copy**: `title`, `subtitle`, `body`, plus `reply1` (X) or `pinnedComment` (XHS).
3. **Visual Assets**: list attached image thumbnails/links (or note that deterministic cards are ready to export at `workspaceUrl`).
4. **Gate Audit Summary**: highlight any remaining warnings from `gateReport.findings`.
5. **Co-Edit Prompt**: explicitly tell the user they can reply with any channel-specific tweak (e.g., *"把公众号开头改短一点"* / *"Make the X hook punchier"*), and you will update it directly in Studio.
6. **X Article Copy-to-X HTML (`export_x_article_html`, 0 pts)**: Whenever `x_article` is generated and the user wants a ready-to-paste `x-article-copy.html` package (or clean Draft.js `bodyHtml`), call `export_x_article_html` with `content_item_id`. It preserves 100% of the article's prose voice while embedding the 5:2 cover, ordered `01-..png` inline image placeholders, and 6-genre Chinese visual prompts (`editorial_blueprint`, `vintage_engraving`, `sketch_tape`, `dark_bento`, `keycaps_cad`, `micro_diorama`).

### Step 6 · Localized Co-Edit / Expansion Loop (`get_content_item` 0 pts → `rewrite_channel_variant` 2 pts)
When the user requests changes or expansion to a specific platform:
1. If you do not have `contentItemId` in context, call `get_content_item` (omit `content_item_id` to list the latest 5 Studio items).
2. Call `rewrite_channel_variant` with:
   - `content_item_id`
   - `channel` (`x_short` | `x_article` | `xhs` | `wechat`)
   - `instruction` (the user's exact tweak or expansion request)
   - `target_chars` (optional, e.g. `3000` when expanding `x_article` / `wechat` to a target length)
   - `save_to_workspace: false` (optional: preview first without overwriting the existing Studio draft)
3. AntiWave edits **directly on top of the existing draft** (preserving facts, structure, and all attached `mediaAssets`), runs deterministic gates + self-fix, and returns `previousCharCount`, `newCharCount`, updated `variant`, and `workspaceUrl`.
4. **Never re-run full `produce_multi_channel`** just to tweak one channel (that would create a duplicate item and charge extra credits).

---

## 2. Best Practice: Writing X / Twitter Posts (`x_short`) & Rich `source_material`

**Never write raw X posts directly in chat when AntiWave MCP is connected.** Calling AntiWave guarantees the user's personal voice, banned-word filters, X plain-text formatting gates (zero em-dashes, zero raw Markdown, reply-1 WAF safety, with NO artificial 280-weight ceiling on long X posts), Studio deep link, and Chrome Extension prefill queue.

### How to Fill `source_material` (Critical)
- **AntiWave does NOT fetch `source_urls`.** Everything the model knows comes from `topic` + `source_material`.
- **Match detail density to channel length** (always keeping `topic.length + source_material.length <= maxInputChars`):
  - **Concise short X post (`x_viral_maxim` / `x_viral_hook` / `x_viral_bounty` / `x_viral_rebuttal`)**: pass **focused core facts (~800–2,000 chars)** spotlighting the exact 1–3 numbers, quotes, technical boundaries, and angle you want.
  - **Long-form (`x_article` / `wechat` / `xhs` deck) & X plain-text long/mid-long posts (`x_viral_listicle` / `x_viral_mentor` / `x_viral_ledger` / extended `x_short`)**: pass the full original article or rich structured context up to `maxInputChars` (Paid Pro / Max / Top-Up: `50,000` chars; zero internal truncation across Pass-1 & Pass-2 grounding), preserving all names, numbers, timelines, and verbatim quotes.
- Recommended 4-part structure for `source_material`:
  1. `[Background & Author]` — who posted, context, engagement metrics.
  2. `[Original Post Details]` — concrete numbers, steps, before/after results, verbatim quotes.
  3. `[Replies / Debate]` — top counterpoints or author follow-up clarifications.
  4. `[User's Angle]` — the user's stance or takeaway (omit if not specified).

### Built-In X Plain-Text Viral Style Packs (`style_id`)
Use these 7 orthogonal X viral packs (`sourceKind: "viral_pack"` in `account_status.styleProfiles`) when the user wants high-retention plain-text X posts (zero raw Markdown `**` / `##` / backticks, zero em-dashes `—`, raw punchy contrasts preserved, no 280-weight gate restriction):

| `style_id` | Name | `xPostForm` | Typical Length (`x_short`) | Signature Cadence |
|---|---|---|---|---|
| `x_viral_listicle` | X 狠话清单风 (`X Viral Raw Listicle`) | `x_long_note` | 500–1600 chars (unrestricted X long post) | Urgent colon opener (`……狠狠记住：` / `……直接听话照做：`) + 8–20 punchy 10–35 char `1、2、` plain rules |
| `x_viral_maxim` | X 清醒暴击风 (`X Viral Wake-Up Maxim`) | `x_short_post` | ~50–115 CJK chars (1-paragraph quoted maxim) | `"建议所有……的人，反复阅读这句话：“……”"` single-paragraph plainspoken contrast |
| `x_viral_mentor` | X 老哥敲黑板风 (`X Viral Candid Mentor`) | `x_long_note` | 500–1500 chars (unrestricted X long post) | `"……记住一点"` + `"再给你说点实在话"` + `"我再说一遍"` airy 1-line-per-beat talk |
| `x_viral_hook` | X 冷知识反差风 (`X Viral Counter-Intuitive Hook`) | `x_short_post` | ~55–135 CJK chars (2–4 short lines) | `"我发现一个挺荒诞的现象："` / `"讲一个事实，"` / `"冷知识："` everyday scene contrast |
| `x_viral_bounty` | X 痛点悬赏问路风 (`X Viral Pain-Point Bounty`) | `x_short_post` | ~55–105 CJK chars (1-paragraph spoken post) | Casual 1-breath comma-chained question (`"普通人……可以尝试做什么来实现……的，最好是……的，……的，大家都见过什么样子的案例，什么样的……"`) |
| `x_viral_rebuttal` | X 神评抓包拆台风 (`X Viral Sharp Detail Rebuttal`) | `x_short_post` | ~25–75 CJK chars (1-paragraph surgical quip) | Pin 1 absurd detail + flip it in 1–2 spoken clauses (`"省下的……又从……贴回去了"` / `"费半天劲……结果……"`) |
| `x_viral_ledger` | X 极端账单预测风 (`X Viral Stark Ledger Forecast`) | `x_long_note` | 110–350 chars (short-clause X note) | `"做个大胆的预测："` / `"以……为分界线"` + short 8–22 char plain math + crisp verdict |

### Concrete Example: Single X Post (`channels: ["x_short"]`, 4 pts, text-only)
```json
{
  "tool": "produce_multi_channel",
  "arguments": {
    "topic": "Cutting 12 AI side projects down to 2 grew MRR from $38k to $64k — hidden maintenance debt kills solo founders faster than lack of traffic",
    "source_material": "[Background & Author]\n@indie_dev_demo (solo SaaS founder running 12 AI tools for 18 months; post got 420k views, 1.8k bookmarks).\n\n[Original Post Details]\n1. 12 AI tools plateaued at $38k MRR for 6 months.\n2. Top 2 products drove 84% of revenue ($31.9k); the other 10 made $6.1k combined while consuming 65% of weekly hours (billing webhooks, support emails, API deprecations).\n3. Shut down or sold the 10 tail products; focused 90 days on the 2 winners — rebuilt 3-minute onboarding (signup drop-off 62% -> 29%) and raised price $9 -> $19/mo.\n4. Result: MRR reached $64k, support tickets dropped 58%, weekly hours fell 60 -> 35.\n5. Quote: \"AI lets you ship a new product in a week, but AI won't carry maintenance debt for 12 half-baked apps.\"\n\n[Replies / Debate]\nTop critique: \"Beginners need to try 10 ideas to find 2 winners.\"\nAuthor reply: \"Ship fast to test, sure — just draw a 60-day kill line if a tool can't pass $500 MRR.\"\n\n[User's Angle]\nHighlight the 60-day kill line as the real differentiator.",
    "source_urls": ["https://x.com/indie_dev_demo/status/1863456789012345678"],
    "hook_angle": "Lead with the $38k -> $64k contrast and end on the 60-day kill line",
    "channels": ["x_short"],
    "locale": "zh",
    "image_mode": "none",
    "save_to_workspace": true,
    "schedule_date": "2026-12-03"
  }
}
```

### Concrete Example: Localized Tweak With Safe Preview (`rewrite_channel_variant`, 2 pts)
```json
{
  "tool": "rewrite_channel_variant",
  "arguments": {
    "content_item_id": "<contentItemId from previous step>",
    "channel": "x_short",
    "instruction": "Keep all numbers in the first two beats unchanged; make the final sentence sharper and more conversational (<= 260 weighted chars)",
    "save_to_workspace": false
  }
}
```

### Concrete Example: Long-Form X Article + X Short Post Teaser (8 pts)
Pass `channels: ["x_article", "x_short"]`, `target_chars: 6000` (range `600..12000`), `image_mode: "auto"` with the full original essay or rich `source_material` (up to `50,000` chars for Paid Pro / Max / Top-Up). AntiWave expands token budget up to `16384` (92s long-form window), checks `x_article >= 85%` of `target_chars`, recommends a `5:2` cover for `x_article` only, and keeps `x_short` optional/text-only.

---

## 3. Complete Tool Reference

| Tool | Step / Role | Credits | Scope | Purpose |
|---|---|---|---|---|
| `account_status` | Step 1 · Preflight | 0 | `read_only` | Check credits, `maxInputChars`, `styleProfiles`, languages |
| `save_creator_idea` | Step 2 · Ideation | 0 | `read_write` | Save researched notes/links to Ideas Board |
| `produce_multi_channel` | Step 3 · Produce | 4 / 8 / 12* | `read_write` | End-to-end 1–4 channel drafts (`style_id` incl. `x_viral_*`, `target_chars`, `image_mode`), `slides`, `visualBriefs`, `workspaceUrl` |
| `unpack_x_posts_batch` | Step 3b · Batch X | 6 or 8 / src* | `read_write` | Decompose 1–5 long sources into 4–8 plain-text X posts/source across `x_viral_*` packs + optional staggered daily schedule |
| `attach_variant_media` | Step 4 · Visuals | 0 | `read_write` | Attach agent-generated images to Studio channel + direct link |
| `export_x_article_html` | Step 5b · X HTML | 0 | `read_only` | Compile `x_article` into Draft.js `bodyHtml` + standalone `x-article-copy.html` |
| `rewrite_channel_variant` | Step 6 · Co-Edit | 2* | `read_write` | Localized single-channel edit/expansion (`style_id`, `target_chars`, `save_to_workspace`), preserves media |
| `get_content_item` | Context Lookup | 0 | `read_only` | Fetch one Studio item by ID or list recent 5–10 items |
| `audit_channel_copy` | Utility · Gate | 0 | `read_only` | Deterministic channel rules (`style_id` aware), banned words & slide layout audit |
| `detect_ai_slop` | Utility · Audit | 0–1 | `read_write` | Cloud semantic AI-slop score (0–100) & cliché pinpointing |
| `humanize_text` | Utility · Single | 2 | `read_write` | One-off de-slop rewrite (`style_id`, `platform: "x"`, `reply_context`) |
| `transcreate_social` | Utility · Multi-Lang | 3 | `read_write` | Native transcreation across 8 languages (`style_id` supported) + Nuance Note |

*\*Automatically falls back to Pro Trial / Daily Free quotas when credit balance is 0, and automatically refunds credits/slots on upstream LLM failure.*
