- Home
- MCP servers
- Layer.ai
Layer.ai
- python
0
GitHub Stars
python
Language
5 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
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.
How to use
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.
How to install
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.sh
Manual installation steps
If 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.py
Installation options
Choose 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.txt
Verify installation
After 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.py
Environment and credentials
Create 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_id
MCP client configuration examples
Use 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"
]
}
}
}
Additional configuration for clients
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.
Notes on usage and limits
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.
Available tools
create_asset
Generate new assets such as sprites, characters, backgrounds, or other 2D game elements using specified prompts and output settings.
get_workspace_info
Retrieve information about your Layer.ai workspace, including available features and quotas.
remove_background
Remove backgrounds from existing images using AI (currently in development).
describe_image
Analyze an image to produce AI-generated descriptions (currently in development).
generate_prompt
Optimize prompts using Layer.ai Prompt Genie to improve asset generation results (currently in development).