> ## Documentation Index
> Fetch the complete documentation index at: https://docs.legnext.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Integrate with AI agents

> Give Claude Code, Cursor, and other AI coding agents full context on the Legnext API — an installable agent skill, docs MCP server, and llms.txt feeds.

Legnext's documentation is built to be consumed by AI coding agents. Point your agent at this site and it gets every endpoint, request/response field, and version-specific parameter behavior — no guessing, no outdated blog posts.

Four ways in, from tightest to loosest integration:

| Method                          | What it gives your agent                              | Best for                                                        |
| ------------------------------- | ----------------------------------------------------- | --------------------------------------------------------------- |
| [Agent skill](#agent-skill)     | Full integration playbook installed into your project | Claude Code, Codex, Cursor, and [70+ agents](https://skills.sh) |
| [Docs MCP server](#mcp-server)  | Live search over the docs, always current             | Claude Code, Cursor, any MCP-capable client                     |
| [Prompt block](#paste-prompt)   | Full API spec loaded on demand via `llms-full.txt`    | Any agent that can fetch a URL                                  |
| [`llms.txt` feeds](#llms-feeds) | Machine-readable doc index                            | Custom tooling, RAG pipelines                                   |

<h2 id="agent-skill">
  Agent skill
</h2>

The fastest path: install the `legnext` agent skill. It teaches your coding agent the integration methodology — submitting tasks, polling vs webhooks, persisting images before they expire, credits, child tasks (variation/upscale), error handling — not just the endpoint list.

```bash theme={null}
npx skills add legnext-ai/skills
```

Then tell your agent what to build in one sentence, e.g.:

```text theme={null}
I have LEGNEXT_API_KEY in my env. Add a Legnext image-generation endpoint to
this app: submit a diffusion task, poll for the result, and save the image
locally. Pin --v 8.2 and use a 16:9 aspect ratio.
```

The agent follows the skill's playbook and consults these docs for exact fields. The skill works with Claude Code, Codex, Cursor, and [70+ other agents](https://skills.sh/legnext-ai/skills). Source: [`legnext-ai/skills`](https://github.com/legnext-ai/skills) (MIT).

<h2 id="mcp-server">
  Docs MCP server
</h2>

This site serves a read-only Model Context Protocol server at:

```
https://docs.legnext.ai/mcp
```

No API key or authentication is required. The server exposes tools to search the documentation and to query its pages directly, so answers always come from the live site rather than a cached snapshot.

<Tabs>
  <Tab title="Claude Code">
    ```bash theme={null}
    claude mcp add --transport http legnext-docs https://docs.legnext.ai/mcp
    ```

    Verify the connection:

    ```bash theme={null}
    claude mcp list
    ```

    `legnext-docs` should show as connected. Your agent can now search these docs during any session.
  </Tab>

  <Tab title="Cursor">
    Open **Cursor Settings → MCP → Add Server**, set the type to **HTTP**, and paste:

    ```
    https://docs.legnext.ai/mcp
    ```

    The server appears in your MCP tool list immediately.
  </Tab>

  <Tab title="Other MCP clients">
    Any MCP-compatible client can connect using the streamable HTTP transport at `https://docs.legnext.ai/mcp`. See the [MCP specification](https://modelcontextprotocol.io) for client setup.
  </Tab>
</Tabs>

<Tip>
  Every page of these docs has a page menu in the top-right corner with **Copy MCP server URL**, **Copy MCP install command**, **Open in Cursor**, and **Open in VS Code** — the fastest way to connect from the page you're reading.
</Tip>

<h2 id="paste-prompt">
  Paste this prompt
</h2>

No skill support and no MCP in your tool? Paste this into any agent that can fetch URLs:

```text theme={null}
Before writing code against the Legnext API, fetch the complete API documentation at
https://docs.legnext.ai/llms-full.txt and treat it as the source of truth: every
endpoint, request/response field, and code example. Parameter behavior differs
between Midjourney model versions — when unsure whether a parameter (e.g. --cref,
--oref, --hd, --draft) is supported on a given version, check
https://docs.legnext.ai/getting-started/image-parameters before assuming.
Never invent fields or parameter names that are not in the documentation.
```

<h2 id="llms-feeds">
  `llms.txt` and `llms-full.txt`
</h2>

Both files are plain text, always in sync with the live docs, and require no authentication:

* [`llms.txt`](https://docs.legnext.ai/llms.txt) — an index of every page with a one-line description. Small; load it first when you want the agent to decide which pages to read.
* [`llms-full.txt`](https://docs.legnext.ai/llms-full.txt) — the entire documentation in a single file: every endpoint, parameter table, and example. Load it when you want full context in one shot.

## Coming soon: machine-readable parameter schema

We're publishing a public JSON schema of every image and video generation parameter and its per-version support, so agents can validate requests before they hit the API. It will be announced in the [Changelog](/changelog).

Until then, the [Image Parameters](/getting-started/image-parameters) page is the authoritative reference for which parameters each Midjourney version (including V8.2) accepts — and the docs MCP server can search it live.
