home / mcp / layer.ai mcp server
Provides asset generation and management for Layer.ai through an MCP interface to create, refine, and optimize 2D game assets.
Configuration
View docs{
"mcpServers": {
"bahadirbklg-layer-ai-mcp-server": {
"command": "python",
"args": [
"layer-mcp-server/server.py"
],
"env": {
"LAYER_API_TOKEN": "pat_your_token_here",
"LAYER_USAGE_FILE": ".layer_usage.json",
"LAYER_API_BASE_URL": "https://api.layer.ai",
"LAYER_WORKSPACE_ID": "your_workspace_id",
"LAYER_DEFAULT_SAVE_DIR": "./assets"
}
}
}
}You run a specialized MCP server that uses Layer.ai to generate 2D game assets directly from your development environment. This server exposes asset generation, prompt optimization, workspace management, and automated saving of assets, making it easier to iterate on sprites, characters, and backgrounds while keeping usage within your Layer.ai plan.
You connect to the Layer.ai MCP server from your MCP client (such as Kiro IDE or Claude Desktop) using the provided configurations. Start the local server with Python, ensuring your Layer.ai API token and workspace are available as environment variables. Once the server is running, you can request asset generation by supplying prompts and options like size, quality, and whether you want a transparent background. You can also check workspace status to confirm available features and remaining quota.
Prerequisites you must have before installation are Python 3.10 or newer, Git for cloning, and a Layer.ai account with an API token.
Quick Install (Recommended) and setup steps are shown here. Run these commands in your terminal.
# 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.shIf you prefer to set up manually, follow these steps to create a virtual environment, install dependencies, and prepare credentials.
# 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.pyChoose the option that matches your environment: production, development, or full install.
# Production: core dependencies only
pip install -r requirements.min.txt
# Development: includes testing and linting tools
pip install -r requirements.dev.txt
# Full: all dependencies
pip install -r requirements.txtAfter installation, run a quick check to verify Python version compatibility, dependencies, and that the main server module imports correctly.
# Run the installation test
python3 verify-install.pyCreate a credentials file or export environment variables with your Layer.ai token and workspace.
# 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_idUse the following configurations in your MCP client to connect to the local Python MCP server. These examples show how to run the server script with the required environment variables.
{
"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"
]
}
}
}If you use other MCP clients, you can adapt the same approach shown above for their MCP configuration. The important parts are the command to start the server, the script path, and providing the Layer.ai API token and workspace ID as environment variables.
Be mindful of the free tier limits. You can generate up to 600 assets per month on the free tier. Large assets may take longer to process, and a stable network connection is important for API calls to Layer.ai.
Generate new assets such as sprites, characters, backgrounds, or other 2D game elements using specified prompts and output settings.
Retrieve information about your Layer.ai workspace, including available features and quotas.
Remove backgrounds from existing images using AI (currently in development).
Analyze an image to produce AI-generated descriptions (currently in development).
Optimize prompts using Layer.ai Prompt Genie to improve asset generation results (currently in development).