# Hubfluencer agent kit — Claude Code (Anthropic)

Teach Claude Code to generate finished, post-ready video ads with Hubfluencer. You give a
prompt; Hubfluencer runs the whole pipeline (script → scenes → narration → voice → music →
render) and hands back an MP4.

This kit has three files:

- **`SKILL.md`** — the skill that drives the workflow.
- **`API.md`** — endpoint/credit/error reference the skill reads when it needs raw REST.
- **`README.md`** — this setup guide.

---

## 1. Connect your account

Pick one. Either way, **buy credits in the app first** — generation spends prepaid credits
(creating a draft is free; rendering a short is **15 credits**; multi-scene editor ads cost more).

**Option A — Device-link login (no copy-paste, recommended)**

```bash
npx -y @hubfluencer/mcp login
```

It prints a URL and a short code. Open the URL, approve the connection in the signed-in
Hubfluencer app, and a scoped token is saved to `~/.hubfluencer/credentials.json`. The MCP server
reads it automatically — you can skip the `HUBFLUENCER_API_TOKEN` env var entirely.

**Option B — Access token in the app**

In the Hubfluencer app, go to **Settings → Access tokens** and create a token with the
**"Generate videos"** scope (`video:generate` + `video:read`). Export it in your shell so the MCP
server can read it:

```bash
export HUBFLUENCER_API_TOKEN=your_token_here   # add to your shell profile to persist
```

Never paste a token into a committed file — use `${HUBFLUENCER_API_TOKEN}` expansion (see below).

---

## 2. Register the MCP server in Claude Code

**Quickest — one command** (writes to your local/project scope):

```bash
claude mcp add --transport stdio --env HUBFLUENCER_API_TOKEN=YOUR_TOKEN hubfluencer -- npx -y @hubfluencer/mcp
```

> All flags (`--transport`, `--env`, `--scope`) go **before** the server name; `--` separates the
> name from the command Claude Code runs. Add `--scope project` to write a team-shared
> `.mcp.json`, or `--scope user` to make it available across all your projects. If you used
> device-link login (Option A), omit the `--env` flag — the server picks up the stored token.

**Or — config file** (`.mcp.json` at the project root for a team, or `~/.claude.json` for
local/user scope):

```json
{
  "mcpServers": {
    "hubfluencer": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@hubfluencer/mcp"],
      "env": {
        "HUBFLUENCER_API_TOKEN": "${HUBFLUENCER_API_TOKEN}"
      }
    }
  }
}
```

`.mcp.json` supports `${VAR}` expansion, so the token is read from your shell env rather than
hardcoded in a committed file. (Omit the `env` block entirely if you used device-link login.)

Optional env vars the server also reads:

- `HUBFLUENCER_BASE_URL` — default `https://hubfluencer.com`.
- `HUBFLUENCER_OUTPUT_DIR` — confines where downloaded `.mp4` files may be written.

Verify and manage: `claude mcp list`, `claude mcp get hubfluencer`,
`claude mcp remove hubfluencer`; check status in a session with `/mcp`.

---

## 3. Install the skill

Copy this kit's `SKILL.md` and `API.md` into a skill directory. The **directory name** becomes the
slash command (`/hubfluencer-create`):

```bash
# Project scope (committed, shared with your team):
mkdir -p .claude/skills/hubfluencer-create
cp SKILL.md API.md .claude/skills/hubfluencer-create/

# Or personal scope (all your projects):
mkdir -p ~/.claude/skills/hubfluencer-create
cp SKILL.md API.md ~/.claude/skills/hubfluencer-create/
```

Claude auto-loads the skill when your request matches its description, or you can invoke it
explicitly with `/hubfluencer-create`.

---

## 4. Try it

Just ask Claude Code in plain language:

```
Use Hubfluencer to make me a 15s ad for my cold-brew coffee subscription.
```

Generation takes a few minutes — that's normal. You'll get a finished MP4 plus a ready-to-paste
caption. (Publishing directly to TikTok/Instagram needs a human-linked social account, so Claude
returns the file for you to post yourself.)
