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

# MCP Web API

> Connect AI agents to ModelsLab via two hosted MCP servers: Generation (image/video/audio/LLM) and Agent Control Plane (account management).

## What is the MCP Web API?

ModelsLab provides **two hosted MCP servers** that give AI agents complete access to the platform — no local installation required:

<CardGroup cols={2}>
  <Card title="Generation Server" icon="wand-magic-sparkles" href="/mcp-web-api/tools-reference">
    24 tools for image, video, audio, and LLM generation. Auth: API key.
  </Card>

  <Card title="Agent Control Plane" icon="gear" href="/mcp-web-api/agent-control-plane">
    10 tools for account management — auth, billing, subscriptions, teams, and more. Auth: Bearer token.
  </Card>
</CardGroup>

Both servers use the [Model Context Protocol](https://modelcontextprotocol.io/) specification over HTTP with JSON-RPC 2.0 and SSE transport.

## Endpoints

| Server | URL | Auth | Purpose |
| - | - | - | - |
| Generation | `https://modelslab.com/mcp/v7` | API key | Image, video, audio, LLM generation |
| Agent Control Plane | `https://modelslab.com/mcp/agents` | Bearer token | Account, billing, subscriptions, teams |

## Generation Server

The Generation MCP server enables AI assistants to interact with the ModelsLab V7 API for AI-powered generation capabilities including images, videos, audio, and chat completions.

### Key Features

<CardGroup cols={2}>
  <Card title="Image Generation" icon="image">
    Generate, transform, and edit images using text prompts and advanced AI models
  </Card>

  <Card title="Video Creation" icon="video">
    Create videos from text, animate images, and apply AI transformations
  </Card>

  <Card title="Audio & Speech" icon="microphone">
    Text-to-speech, speech-to-text, music generation, and voice transformation
  </Card>

  <Card title="LLM Chat" icon="comments">
    Chat with powerful language models for text generation and conversation
  </Card>
</CardGroup>

### Authentication

All requests must include your ModelsLab API key using one of the following methods:

<Tabs>
  <Tab title="Authorization Header (Recommended)">
    ```http theme={"theme":{"light":"github-light","dark":"github-dark"}}
    Authorization: Bearer YOUR_API_KEY
    ```
  </Tab>

  <Tab title="X-API-Key Header">
    ```http theme={"theme":{"light":"github-light","dark":"github-dark"}}
    X-API-Key: YOUR_API_KEY
    ```
  </Tab>
</Tabs>

<Info>
  Get your API key from the [ModelsLab Dashboard](https://modelslab.com/dashboard/api-keys).
</Info>

## Protocol

The MCP Web API uses the [Model Context Protocol](https://modelcontextprotocol.io/) specification. Communication is done via JSON-RPC 2.0 over HTTP.

### Request Format

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "tool-name",
    "arguments": {
      "param1": "value1",
      "param2": "value2"
    }
  }
}
```

### Response Format

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "content": [
      {
        "type": "text",
        "text": "..."
      }
    ]
  }
}
```

### Available Tools (Generation Server)

| Category | Tools | Description |
| - | - | - |
| **Models** | `list-models`, `list-providers` | Browse available AI models |
| **Image** | `text-to-image`, `image-to-image`, `inpaint-image`, `fetch-image` | Generate and edit images |
| **Video** | `text-to-video`, `image-to-video`, `video-to-video`, `lip-sync`, `motion-control`, `fetch-video` | Create and transform videos |
| **Audio** | `text-to-speech`, `speech-to-text`, `speech-to-speech`, `sound-generation`, `music-generation`, `song-extender`, `song-inpaint`, `dubbing`, `fetch-audio` | Audio generation and processing |
| **LLM** | `chat-completion` | Chat with AI language models |

<Card title="View Complete Tool Reference" icon="book" href="/mcp-web-api/tools-reference">
  See detailed documentation for all 24 generation tools, parameters, and examples.
</Card>

## Agent Control Plane Server

The Agent Control Plane MCP server lets AI agents manage an entire ModelsLab account lifecycle — signup, authentication, API keys, billing, subscriptions, and teams — without a browser.

<Card title="Agent Control Plane Documentation" icon="gear" href="/mcp-web-api/agent-control-plane">
  Full documentation for all 10 account management tools, setup guides, and examples.
</Card>

## Quick Example

Here's a simple example generating an image using the MCP Web API:

**1. List available models:**

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "list-models",
    "arguments": {
      "feature": "imagen",
      "limit": 5
    }
  }
}
```

**2. Generate an image:**

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/call",
  "params": {
    "name": "text-to-image",
    "arguments": {
      "model_id": "flux-dev",
      "prompt": "A futuristic city at night with neon lights",
      "width": 1024,
      "height": 1024
    }
  }
}
```

**3. Fetch the result:**

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "jsonrpc": "2.0",
  "id": 3,
  "method": "tools/call",
  "params": {
    "name": "fetch-image",
    "arguments": {
      "id": 12345
    }
  }
}
```

## Error Handling

Errors are returned in standard JSON-RPC 2.0 format:

```json theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "jsonrpc": "2.0",
  "id": 1,
  "error": {
    "code": -32600,
    "message": "Authentication required. Please provide a valid API key."
  }
}
```

### Common Error Codes

| Code | Description |
| - | - |
| `-32600` | Invalid Request |
| `-32601` | Method not found |
| `-32602` | Invalid params |
| `-32603` | Internal error |

## Server Information

| | Generation Server | Agent Control Plane |
| - | - | - |
| **Name** | `modelslab-v7-api` | `modelslab-agent-control-plane` |
| **Version** | `1.0.0` | `1.0.0` |
| **Protocol** | MCP (Model Context Protocol) | MCP (Model Context Protocol) |
| **Transport** | HTTP with JSON-RPC 2.0 / SSE | HTTP with JSON-RPC 2.0 / SSE |
| **Local name** | `v7-api` | `agent-control-plane` |

## Next Steps

<CardGroup cols={2}>
  <Card title="Generation Tools Reference" icon="wrench" href="/mcp-web-api/tools-reference">
    Complete documentation for all 24 generation MCP tools
  </Card>

  <Card title="Generation Integration" icon="robot" href="/mcp-web-api/agent-integration">
    Setup guides for Claude Code, Cursor, VS Code, and other AI agents
  </Card>

  <Card title="Agent Control Plane" icon="gear" href="/mcp-web-api/agent-control-plane">
    Account management MCP server with 10 tools
  </Card>

  <Card title="Control Plane Integration" icon="plug" href="/mcp-web-api/agent-cp-integration">
    Setup the account management MCP server in your IDE
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.