Skip to main content
Connect ModelsLab’s powerful AI generation capabilities to your favorite AI coding assistant. This guide covers integration with popular MCP-compatible agents and tools.

Overview

The ModelsLab MCP Web API works with any client that supports the Model Context Protocol over HTTP. This includes:
  • Claude Code - Anthropic’s CLI coding assistant
  • OpenCode - Open-source AI coding agent
  • Claude Desktop - Claude’s desktop application
  • Cursor - AI-powered code editor
  • Continue - Open-source AI code assistant
  • Custom integrations - Any MCP-compatible client

Claude Code

Claude Code is Anthropic’s agentic CLI tool for software development.

Configuration

Add ModelsLab to your Claude Code MCP settings file:
Edit ~/.claude/settings.json:
settings.json
{
  "mcpServers": {
    "modelslab": {
      "url": "https://modelslab.com/mcp/v7",
      "headers": {
        "Authorization": "Bearer YOUR_API_KEY"
      }
    }
  }
}

Usage

Once configured, you can ask Claude Code to generate images, videos, and audio directly:
claude "Generate an image of a futuristic cityscape at night using ModelsLab"
claude "Create a 5-second video of a cat walking using the ModelsLab API"

OpenCode

OpenCode is an open-source AI coding agent that runs in your terminal.

Configuration

Add ModelsLab to your OpenCode configuration:
Create or edit opencode.json in your project root:
opencode.json
{
  "mcp": {
    "servers": {
      "modelslab": {
        "type": "http",
        "url": "https://modelslab.com/mcp/v7",
        "headers": {
          "Authorization": "Bearer YOUR_API_KEY"
        }
      }
    }
  }
}

Usage

Start OpenCode and use ModelsLab tools:
opencode
Then in the interactive session:
> Generate a logo for my startup using ModelsLab's flux-dev model

Claude Desktop

Claude Desktop supports MCP servers for extended functionality.

Configuration

Edit ~/Library/Application Support/Claude/claude_desktop_config.json:
claude_desktop_config.json
{
  "mcpServers": {
    "modelslab": {
      "url": "https://modelslab.com/mcp/v7",
      "headers": {
        "Authorization": "Bearer YOUR_API_KEY"
      }
    }
  }
}

Restart Required

After updating the configuration:
  1. Completely quit Claude Desktop (not just minimize)
  2. Reopen Claude Desktop
  3. The ModelsLab tools should now be available

Cursor

Cursor is an AI-powered code editor with MCP support.

Configuration

Add ModelsLab to your Cursor MCP settings:
  1. Open Cursor Settings (Cmd/Ctrl + ,)
  2. Search for “MCP”
  3. Add the following server configuration:
{
  "mcp.servers": {
    "modelslab": {
      "url": "https://modelslab.com/mcp/v7",
      "headers": {
        "Authorization": "Bearer YOUR_API_KEY"
      }
    }
  }
}
Alternatively, edit .cursor/mcp.json in your project:
mcp.json
{
  "servers": {
    "modelslab": {
      "type": "http",
      "url": "https://modelslab.com/mcp/v7",
      "headers": {
        "Authorization": "Bearer YOUR_API_KEY"
      }
    }
  }
}

Continue

Continue is an open-source AI code assistant that works with VS Code and JetBrains IDEs.

Configuration

Edit your Continue configuration file (~/.continue/config.json):
config.json
{
  "mcpServers": [
    {
      "name": "modelslab",
      "transport": {
        "type": "http",
        "url": "https://modelslab.com/mcp/v7",
        "headers": {
          "Authorization": "Bearer YOUR_API_KEY"
        }
      }
    }
  ]
}

Generic MCP Client

For any MCP-compatible client, use the following configuration pattern:
{
  "servers": {
    "modelslab-v7": {
      "transport": "http",
      "url": "https://modelslab.com/mcp/v7",
      "headers": {
        "Authorization": "Bearer YOUR_API_KEY"
      }
    }
  }
}

Environment Variables

For security, you can use environment variables instead of hardcoding your API key:
Add to your shell profile (~/.bashrc, ~/.zshrc, etc.):
export MODELSLAB_API_KEY="your_api_key_here"
Then reference it in your config:
{
  "mcpServers": {
    "modelslab": {
      "url": "https://modelslab.com/mcp/v7",
      "headers": {
        "Authorization": "Bearer ${MODELSLAB_API_KEY}"
      }
    }
  }
}
Note: Environment variable substitution support varies by client. Check your specific client’s documentation.

Verification

After configuring your MCP client, verify the integration is working:

Test Connection

Ask your AI agent to list available models:
List the available image generation models from ModelsLab

Generate a Test Image

Generate a simple test image of a blue circle on a white background using ModelsLab

Check for Errors

If the integration isn’t working, check:
  1. API Key: Ensure your API key is valid and has sufficient credits
  2. URL: Verify the endpoint URL is correct
  3. Headers: Confirm the Authorization header format is correct
  4. Client Support: Ensure your MCP client supports HTTP transport

Troubleshooting

  • Verify the endpoint URL is correct
  • Check your network connection
  • Ensure there are no firewall rules blocking the connection
  • Verify your API key is correct
  • Check that the Authorization header uses Bearer prefix (with space)
  • Ensure your API key has not expired
  • Restart your MCP client after configuration changes
  • Check the configuration file syntax (valid JSON)
  • Verify the config file is in the correct location
  • Check your ModelsLab account for usage limits
  • Add delays between requests if making many calls
  • Consider upgrading your plan for higher limits

Next Steps