leonardo-ai-mcp-server

leonardo-ai-mcp-server

Integrates Leonardo AI image generation capabilities into MCP-compatible clients like Cursor, Claude Desktop, and VS Code, allowing natural language commands to generate, upscale, vary, and manage images.

Category
Visit Server

README

๐ŸŽจ Leonardo AI MCP Server

A remote Model Context Protocol (MCP) server for Leonardo.ai, powered by Vercel.

Generate images, manage models, check generation status, upscale, create variations โ€” all through MCP from Cursor, Claude Desktop, VS Code, or any MCP-compatible client.

โœจ Features / Tools

Tool Description
generate_image Generate images with Leonardo AI. Supports model selection, dimensions, style presets, Alchemy, PhotoReal, and Ultra mode. Polls for completion automatically.
get_generation Get the status and results of a generation job by ID
list_models List all available Leonardo AI platform models with IDs, names and descriptions
get_user_generations Get recent generation jobs for a user
get_user_info Get the authenticated user's info (username, tokens, quota)
create_variation Create a variation, outpaint, inpaint, or unzoom of an existing image
upscale_image Upscale a generated image to higher resolution
delete_generation Permanently delete a generation and its images

๐Ÿš€ Deploy to Vercel

One-Click Deploy

Deploy with Vercel

Manual Deploy

  1. Fork/clone this repository
  2. Import it in Vercel
  3. Set environment variable LEONARDO_API_KEY with your Leonardo AI API key
  4. Enable Fluid Compute in your Vercel project settings for optimal performance
  5. Deploy โ€” your MCP server will be live at https://your-project.vercel.app/mcp

๐Ÿ”‘ Get a Leonardo AI API Key

  1. Go to Leonardo.ai
  2. Sign up / log in
  3. Navigate to API Access in your settings
  4. Generate an API key

๐Ÿ”Œ Connect Your MCP Client

Cursor

Add to your Cursor MCP settings (.cursor/mcp.json):

{
  "mcpServers": {
    "leonardo-ai": {
      "url": "https://your-project.vercel.app/mcp",
      "headers": {
        "x-leonardo-api-key": "YOUR_LEONARDO_API_KEY"
      }
    }
  }
}

Claude Desktop

Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "leonardo-ai": {
      "url": "https://your-project.vercel.app/mcp",
      "headers": {
        "x-leonardo-api-key": "YOUR_LEONARDO_API_KEY"
      }
    }
  }
}

VS Code (GitHub Copilot)

Add to your VS Code MCP settings:

{
  "mcp": {
    "servers": {
      "leonardo-ai": {
        "url": "https://your-project.vercel.app/mcp",
        "headers": {
          "x-leonardo-api-key": "YOUR_LEONARDO_API_KEY"
        }
      }
    }
  }
}

Note: You can also set LEONARDO_API_KEY as an environment variable on Vercel instead of passing it as a header. If the env var is set, the header is optional.

๐Ÿ›  Local Development

# Install dependencies
pnpm install

# Set your API key
cp .env.example .env
# Edit .env and add your LEONARDO_API_KEY

# Start local dev server
pnpm dev

The MCP server will be available at http://localhost:3000/mcp.

๐Ÿ“ Project Structure

โ”œโ”€โ”€ api/
โ”‚   โ”œโ”€โ”€ server.ts           # MCP server with all tool definitions
โ”‚   โ””โ”€โ”€ leonardo-client.ts  # Leonardo AI REST API client
โ”œโ”€โ”€ public/
โ”‚   โ””โ”€โ”€ index.html          # Landing page
โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ tsconfig.json
โ”œโ”€โ”€ vercel.json             # Vercel deployment config
โ”œโ”€โ”€ .env.example
โ””โ”€โ”€ README.md

๐Ÿ“‹ API Key Options

The server resolves the Leonardo API key in this order:

  1. x-leonardo-api-key header โ€” passed by the MCP client (recommended for multi-user setups)
  2. LEONARDO_API_KEY env variable โ€” set in Vercel project settings (simpler for single-user)

๐Ÿงช Example Usage

Once connected, you can use natural language in your MCP client:

  • "Generate an image of a sunset over mountains in cinematic style"
  • "List available Leonardo AI models"
  • "Show me my recent generations"
  • "Upscale the last generated image"
  • "Create a variation of image xyz"

๐Ÿ“ License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured