Layer.ai MCP Server

Local setup required. This server has to be cloned and prepared on your machine before you register it in Claude Code.
1

Set the server up locally

Run this once to clone and prepare the server before adding it to Claude Code.

Run in terminal
git clone https://github.com/bahadirbklg/layer-ai-mcp-server.git
cd layer-ai-mcp-server
chmod +x install.sh
./install.sh
2

Register it in Claude Code

After the local setup is done, run this command to point Claude Code at the built server.

Run in terminal
claude mcp add -e "LAYER_API_TOKEN=${LAYER_API_TOKEN}" layer-ai -- python "<FULL_PATH_TO_LAYER_AI_MCP_SERVER>/dist/index.js"

Replace <FULL_PATH_TO_LAYER_AI_MCP_SERVER>/dist/index.js with the actual folder you prepared in step 1.

Required:LAYER_API_TOKEN+ 4 optional
README.md

Generate 2D game assets using Layer.ai's AI platform

Layer.ai MCP Server

A Model Context Protocol (MCP) server for generating game assets using Layer.ai's AI platform. Generate sprites, characters, backgrounds, and other 2D assets directly from your development environment.

Made with AI - Use with caution

Features

  • Asset Generation: Generate 2D game assets using Layer.ai Forge
  • Prompt Optimization: Optimize prompts with Layer.ai Prompt Genie
  • Usage Tracking: Monitor usage against free tier limits (600 assets)
  • Workspace Management: Export and manage workspace data
  • Asset Refinement: Refine and modify existing assets
  • Auto-Save: Automatically save generated assets to your project
  • Error Handling: Robust error handling with automatic retries
  • Quota Protection: Prevents exceeding your free tier limit

Installation

Prerequisites

  • Python 3.10+ (required for MCP compatibility)
  • Git for cloning the repository
  • Layer.ai account and API token

Quick Install (Recommended)

# Clone the repository
git clone https://github.com/bahadirbklg/layer-ai-mcp-server.git
cd layer-ai-mcp-server

# Run the installation script
chmod +x install.sh
./install.sh

Manual Installation

# Clone the repository
git clone https://github.com/bahadirbklg/layer-ai-mcp-server.git
cd layer-ai-mcp-server

# Create virtual environment (recommended)
python3 -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install --upgrade pip
pip install -r requirements.txt

# Create assets directory
mkdir -p assets

# Set up credentials
python layer-mcp-server/setup.py

Installation Options

  • Production: pip install -r requirements.min.txt (core dependencies only)
  • Development: pip install -r requirements.dev.txt (includes testing and linting tools)
  • Full: pip install -r requirements.txt (recommended for most users)

Verify Installation

Test your installation to make sure everything is working:

# Run the installation test
python3 verify-install.py

This will check:

  • Python version compatibility (3.10+)
  • All required dependencies are installed
  • Project files are in place
  • Main server can be imported successfully

Configuration

Environment Variables

Create a .env file or set environment variables:

# Required: Your Layer.ai API token
LAYER_API_TOKEN=pat_your_token_here

# Optional: API base URL (defaults to https://api.layer.ai)
LAYER_API_BASE_URL=https://api.layer.ai

# Optional: Usage tracking file (defaults to .layer_usage.json)
LAYER_USAGE_FILE=.layer_usage.json

# Optional: Default save directory (defaults to ./assets)
LAYER_DEFAULT_SAVE_DIR=./assets

# Optional: Default workspace ID
LAYER_WORKSPACE_ID=your_workspace_id

Getting Your API Token

  1. Sign up at Layer.ai
  2. Go to your account settings
  3. Generate a new API token (starts with pat_)
  4. Copy the token to your .env file

MCP Client Configuration

For Kiro IDE

Add to your MCP client configuration:

{
  "mcpServers": {
    "layer-ai-comprehensive": {
      "command": "python",
      "args": ["layer-mcp-server/server.py"],
      "env": {
        "LAYER_API_TOKEN": "pat_your_token_here",
        "LAYER_WORKSPACE_ID": "your_workspace_id"
      },
      "disabled": false,
      "timeout": 180,
      "autoApprove": [
        "create_asset", "remove_background", "describe_image", 
        "generate_prompt", "get_workspace_info"
      ]
    }
  }
}
For Claude Desktop

Add to your Claude Desktop MCP configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "layer-ai": {
      "command": "python",
      "args": ["path/to/layer-mcp-server/server.py"],
      "env": {
        "LAYER_API_TOKEN": "pat_your_token_here",
        "LAYER_WORKSPACE_ID": "your_workspace_id"
      }
    }
  }
}

Usage

Available Tools

1. `create_asset` - Generate Assets

Generate sprites, characters, backgrounds, and other assets.

Parameters:

  • prompt (required): Description of the asset to generate
  • generation_type (optional): CREATE, UPSCALE, etc.
  • width/height (optional): Output dimensions (default: 512x512)
  • quality (optional): LOW, MEDIUM, HIGH (default: HIGH)
  • transparency (optional): Enable transparent backgrounds
  • save_path (optional): Local path to save the asset

Example:

{
  "prompt": "A cute pixel art character for a platformer game",
  "generation_type": "CREATE",
  "width": 512,
  "height": 512,
  "transparency": true,
  "save_path": "./sprites/player_character.png"
}
2. `get_workspace_info` - Check Status

Get information about

Tools (2)

create_assetGenerate sprites, characters, backgrounds, and other assets.
get_workspace_infoGet information about the current workspace.

Environment Variables

LAYER_API_TOKENrequiredYour Layer.ai API token
LAYER_API_BASE_URLAPI base URL
LAYER_USAGE_FILEUsage tracking file path
LAYER_DEFAULT_SAVE_DIRDefault directory to save generated assets
LAYER_WORKSPACE_IDDefault workspace ID

Configuration

claude_desktop_config.json
{"mcpServers": {"layer-ai": {"command": "python", "args": ["path/to/layer-mcp-server/server.py"], "env": {"LAYER_API_TOKEN": "pat_your_token_here", "LAYER_WORKSPACE_ID": "your_workspace_id"}}}}

Try it

Generate a 512x512 pixel art character for a platformer game and save it to my sprites folder.
Create a high-quality background image for a forest level with transparency enabled.
Check my current workspace info to see how many assets I have left in my free tier.
Generate a new sprite character based on the prompt 'a futuristic robot scout'.

Frequently Asked Questions

What are the key features of Layer.ai MCP Server?

Generate 2D game assets using Layer.ai Forge. Optimize prompts with Layer.ai Prompt Genie. Monitor usage against free tier limits. Automatically save generated assets to local project directories. Refine and modify existing assets.

What can I use Layer.ai MCP Server for?

Rapidly prototyping game character sprites during development. Generating consistent background assets for 2D platformer levels. Managing asset generation quotas directly within the IDE. Automating the export of AI-generated game assets into project folders.

How do I install Layer.ai MCP Server?

Install Layer.ai MCP Server by running: git clone https://github.com/bahadirbklg/layer-ai-mcp-server.git && cd layer-ai-mcp-server && chmod +x install.sh && ./install.sh

What MCP clients work with Layer.ai MCP Server?

Layer.ai MCP Server works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep Layer.ai MCP Server docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare