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.
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
Manual Deploy
- Fork/clone this repository
- Import it in Vercel
- Set environment variable
LEONARDO_API_KEYwith your Leonardo AI API key - Enable Fluid Compute in your Vercel project settings for optimal performance
- Deploy โ your MCP server will be live at
https://your-project.vercel.app/mcp
๐ Get a Leonardo AI API Key
- Go to Leonardo.ai
- Sign up / log in
- Navigate to API Access in your settings
- 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_KEYas 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:
x-leonardo-api-keyheader โ passed by the MCP client (recommended for multi-user setups)LEONARDO_API_KEYenv 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
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
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.
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.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
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.
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.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.