---
updatedAt: 2026-11-16T03:45:24.000Z
agentTools:
  projectIndex: https://docs.leonardo.ai/llms.txt
---

# Connect to Leonardo.Ai with the MCP Server

Connect your AI assistant to Leonardo.Ai through the Model Context Protocol (MCP). You can generate images directly or work with the Leonardo Agent on a creative project.

# Before you start

To use the Leonardo.Ai Connector, you’ll need:

* An AI assistant that can use MCP servers, such as:
  * Cursor
  * Claude Code
  * Codex
  * ChatGPT
  * Claude
* A Leonardo.Ai account

MCP V2 uses your Leonardo.Ai account. Generation uses personal credits by default or Team credits if a team is selected.

# Connect your AI assistant

Use this server URL:

```text
https://mcp.leonardo.ai/v2/mcp
```

Follow the instructions for your assistant below. Complete the browser sign-in with the Leonardo.Ai account you want to use.

<br />

<Tabs>
  <Tab title="Cursor">
    1. Open your project's `.cursor/mcp.json` file. Create the file if it does not exist.
    2. Add the following server configuration. If the file contains other servers, add this entry to its `mcpServers` object.

    ```json
    {
      "mcpServers": {
        "leonardo-ai": {
          "url": "https://mcp.leonardo.ai/v2/mcp",
          "auth": {
            "CLIENT_ID": "cursor"
          }
        }
      }
    }
    ```

    3. Open Cursor's MCP settings.
    4. Complete authentication for `leonardo-ai`.
    5. Open an Agent conversation to use the tools.

    See the [Cursor MCP documentation](https://cursor.com/docs/mcp) for configuration details.
  </Tab>

  <Tab title="Claude Code">
    1.
    2. Add the server:

    ```bash
    claude mcp add --transport http leonardo-ai https://mcp.leonardo.ai/v2/mcp
    ```

    2. Authenticate:

    ```bash
    claude mcp login leonardo-ai
    ```

    3. Complete the browser sign-in.
    4. Run `/mcp` inside Claude Code to check the connection.

    See the [Claude Code MCP documentation](https://code.claude.com/docs/en/mcp) for client details.
  </Tab>

  <Tab title="Codex">
    1. Add the server:

    ```bash
    codex mcp add leonardo-ai --url https://mcp.leonardo.ai/v2/mcp
    ```

    2. Complete the sign-in if Codex requests it. To start sign-in separately, run:

    ```bash
    codex mcp login leonardo-ai
    ```

    3. Complete the browser sign-in.
  </Tab>

  <Tab title="Claude">
    You can add the server as a custom connector when your Claude account permits custom connectors.

    1. Open Claude's **Customize** page.
    2. Select **Add custom connector**.
    3. Add a custom connector named `Leonardo.Ai`.
    4. Enter `https://mcp.leonardo.ai/v2/mcp` as the server URL.
    5. Select "Use Claude's published identity" (CIMD)
    6. Complete the connection and browser sign-in.

    Managed accounts can restrict custom connectors. Contact your workspace administrator if the option is unavailable.
  </Tab>

  <Tab title="ChatGPT">
    Use ChatGPT on the web with an account that permits custom MCP servers.

    1. Open ChatGPT's **Plugins** page.
    2. Select **Add custom MCP server**.
    3. Enter `Leonardo.Ai` as the name.
    4. Under **Connection**, enter `https://mcp.leonardo.ai/v2/mcp` as the server URL.
    5. Select **OAuth** for authentication.
    6. Review the connection warning and select **I understand and want to continue**.
    7. Select **Create as a plugin**.
    8. Complete the Leonardo.Ai sign-in when prompted.

    Workspace permissions can restrict custom MCP servers. Contact your workspace administrator if the option is unavailable.

    See the [OpenAI instructions for custom MCP servers](https://developers.openai.com/api/docs/guides/custom-mcp-server) for connection details.
  </Tab>
</Tabs>

# Usage

## Generate Images

Ask your assistant:

> Use Leonardo.Ai to create a landscape image of a coastal village at sunrise.

## Generate Videos

Ask your assistant:

> Use Leonardo.Ai to create a video of a card driving through a coastal village at sunrise.

## Work with Leo Agent

Use [Leo Agent](https://app.leonardo.ai/agent) for creative briefs, exploration, and iterative edits within a project.<br />A project preserves the conversation and generated assets. Continue in the same project for related work.

Ask your assistant:

> Start a Leonardo Agent project for a coffee brand. Ask Leo to explore three visual directions for its packaging.<br /><br />Turn one of the options into a 15-second video.

Continue the project by asking for edits:

> Use the Leonardo Agent to cut the generated video down to a 10-second ad and a 6-second ad, with a music track playing underneath.