# AI Hero learner agent surface

Tools for an enrolled learner’s own agent: see what they own, read the outline and lessons, read Matt’s session extract at a timestamp, search, and see office hours. Every response carries `next_actions`.

## Connect

MCP (streamable HTTP, stateless): `https://www.aihero.dev/mcp`

Claude Code signs in with OAuth. Add the server, then run `/mcp`, pick `aihero` and authenticate:

```sh
claude mcp add --transport http aihero https://www.aihero.dev/mcp
```

<a id="other-agents"></a>
### Other agents and scripts

Clients without OAuth sign-in send a learner token as a header (see Sign in below).

Claude Code with a token:

```sh
claude mcp add --transport http aihero https://www.aihero.dev/mcp --header "Authorization: Bearer <token>"
```

Cursor (`~/.cursor/mcp.json`):

```json
{
  "mcpServers": {
    "aihero": {
      "url": "https://www.aihero.dev/mcp",
      "headers": {
        "Authorization": "Bearer <token>"
      }
    }
  }
}
```

Codex (`~/.codex/config.toml`):

```toml
[mcp_servers.aihero]
url = "https://www.aihero.dev/mcp"
bearer_token_env_var = "AIHERO_TOKEN"
```

<a id="sign-in"></a>
## Sign in

Sign in once, as the learner.

MCP clients with OAuth sign-in: add `https://www.aihero.dev/mcp` and nothing else. When a tool first needs the learner, the server answers 401 and the client opens an AI Hero page. The learner approves there, and the client keeps a read-only token for 90 days. No copy-paste.

Other agents and scripts, or a client without OAuth sign-in:

1. Device flow, no browser copy-paste: `POST https://www.aihero.dev/oauth/device/code`, ask the learner to open `verification_uri_complete` and approve, then poll `POST https://www.aihero.dev/oauth/token` with form fields `device_code=<code>` and `scope=learner:read`. The `access_token` it returns reads only what the learner can read, for 90 days.
2. Agent token: while signed in at https://www.aihero.dev, the learner sends `POST https://www.aihero.dev/api/learner/token` and gives you the token. `GET` lists their tokens, including ones their apps got by signing in; `DELETE` with `{ "id": "<token id>" }` revokes one.

Send the token as `Authorization: Bearer <token>` on every MCP or HTTP call. Without it you can still use `search_course` on public content. A token that is expired or revoked gets 401: sign in again.

## Tools

- `my_courses`: List the AI Hero courses the signed-in learner owns: each cohort or workshop, its workshops with open dates, whether each is open, and the next open date. Start here.
- `course_outline`: The workshops, sections and lessons of one course the learner owns, with their completion state. A workshop that has not opened shows its title and open date only.
- `read_lesson`: One lesson the learner owns: its text (the exercise), the video transcript, the session extract (the coding-agent session Matt shows on screen, timed to the video), and links to the lesson page. The solution stays hidden unless includeSolution is true; set it only when the learner asks for the solution.
- `session_extract`: The coding-agent session Matt shows on screen in one lesson video: his prompts, Claude’s replies, skill and tool calls and interrupts, each stamped with the video second it appears. Pass atSeconds to get what was on screen at that moment and the entries around it. Pass view for one slice of it: prompts (what Matt typed), corrections (each interrupt and the prompt after it), skills (each skill call, linked to its AI Hero page), errors (each failed tool call and what came next) or chapters (the session split at each prompt).
- `session_moments`: Moments from Matt’s on-screen sessions across every lesson of one course the learner can read now: prompts he typed, course corrections (an interrupt and the prompt after it), skill calls, and failed tool calls with what came next. Each moment names its lesson and video second. Embargoed workshops contribute nothing. Searches at most 30 lessons per call; past that the result says so and names a workshop to search on its own.
- `skill_usage`: Every lesson and video moment where Matt’s session runs one skill, across the courses the learner can read now (or one course), with the arguments it was given and a link to the skill’s AI Hero page when there is one. Searches at most 30 lessons per call; past that the result says so and names a workshop to search on its own.
- `search_course`: Search AI Hero. Signed in, it also matches lesson titles in the open workshops the learner owns and marks which hits they can read now. Anonymous callers search public content.
- `office_hours`: Upcoming and live office hours for the cohorts the learner owns: weekday, time in UTC and the YouTube link.
- `next_offer`: The learner’s current offer from AI Hero, priced live by the same rules as checkout: the product, what they pay now in USD cents and why, when that price ends, and when enrollment closes. A learner who owns the product gets no price. An anonymous caller gets the default price. This is the learner’s current offer, which they may ask about.

Prompts:

- `start_lesson`: Load one lesson, its exercise and Matt’s session extract into context, and work through it with the learner as a study companion.

## HTTP

Each tool is also `POST https://www.aihero.dev/api/learner/<tool>` with a JSON body, and `GET` with query parameters for read-only tools. OpenAPI: https://www.aihero.dev/api/openapi.json.

## Study companion rules

- You are this learner’s study companion for an AI Hero lesson.
- Follow the learner’s pace: ask what they want to do next before moving on.
- Use the session extract next to the video: when the learner mentions a moment, look up what Matt had on screen at that second with session_extract.
- Never reveal the solution unless the learner asks for it. Offer hints first.
- When the learner finishes, offer the next lesson from course_outline.
