This project is an innovative tool that simplifies game asset creation by leveraging AI-powered generation. Whether you're a game developer seeking rapid prototypes or an AI enthusiast exploring generative models, this tool enables you to create 2D and 3D game assets from text prompts effortlessly. It integrates AI models from Hugging Face Spaces—powered by "gokaygokay/Flux-2D-Game-Assets-LoRA"
, "gokaygokay/Flux-Game-Assets-LoRA-v2"
, and one of three 3D model generation spaces (InstantMesh
, Hunyuan3D-2
, or Hunyuan3D-2mini-Turbo
, which you must duplicate to your account)—and uses the Model Context Protocol (MCP) for seamless interaction with AI assistants like Claude Desktop.
The Game Asset Generator (version 0.3.0) harnesses AI to streamline the creation of game assets. It supports generating 2D assets (e.g., pixel art sprites) and 3D assets (e.g., OBJ and GLB models) from text prompts, integrating with Hugging Face Spaces and the Model Context Protocol (MCP). This release introduces support for multiple 3D model generation spaces—InstantMesh
, Hunyuan3D-2
, and Hunyuan3D-2mini-Turbo
—offering flexibility and enhanced performance. Built with Node.js and the MCP TypeScript SDK (v1.7.0), it provides a robust, cross-platform solution for asset generation.
InstantMesh
, Hunyuan3D-2
, and Hunyuan3D-2mini-Turbo
for varied 3D generation workflows.assets
directory with resource URIs (e.g., asset://{type}/{id}
).The Game Asset Generator transforms text prompts into game-ready assets through an automated pipeline:
generate_2d_asset
or generate_3d_asset
)."gokaygokay/Flux-2D-Game-Assets-LoRA"
(50 steps)."gokaygokay/Flux-Game-Assets-LoRA-v2"
(30 steps)./preprocess
, /generate_mvs
, /make3d
)./generation_all
)./generation_all
) with configurable turbo modes.assets
directory.asset://3d_model/filename.glb
) for immediate use.User Prompt → MCP Server → AI Model(s) → Local File → Resource URI Response
Prompts are automatically enhanced with "high detailed, complete object, not cut off, white solid background" for optimal quality.
npm
).@gradio/client
: Interacts with Hugging Face Spaces.@huggingface/inference
: For direct model inference.@modelcontextprotocol/sdk
: Implements the MCP server.dotenv
: Loads environment variables.express
: Enables SSE transport.zod
: Ensures input validation.sharp
: Handles image processing.Clone the Repository:
git clone https://github.com/yourusername/game-asset-mcp.git
cd game-asset-mcp
Install Dependencies:
npm install
Configure Environment:
.env
file:
cp .env.example .env
.env
with your Hugging Face API token and duplicated MODEL_SPACE. See Configuration for details.Run the Server:
npm start
node src/index.js /path/to/directory
node src/index.js --sse
node src/index.js --sse --https
Requires ssl/key.pem
and ssl/cert.pem
(see ssl/README.md).Note: Uses ES modules (
"type": "module"
inpackage.json
). Ensure Node.js 16+ is installed (node --version
).
Interact with the server via an MCP client (e.g., Claude Desktop) or programmatically:
Generate a 2D Asset:
generate_2d_asset prompt:"pixel art sword"
2d_asset_generate_2d_asset_1698765432.png
) and returns its URI.Generate a 3D Asset:
generate_3d_asset prompt:"isometric 3D castle"
generate_2d_sprite prompt:"pixel art sword"
generate_3d_model prompt:"isometric 3D castle"
After configuring (see Configuration), type commands directly in the interface.
Customize the server via the .env
file:
HF_TOKEN=your_hf_token
your-username/InstantMesh
).
MODEL_SPACE=your-username/InstantMesh
Variable | Description | Valid Range/Default |
---|---|---|
MODEL_3D_STEPS | Inference steps | Varies by space (see below) |
MODEL_3D_GUIDANCE_SCALE | How closely the model follows the prompt | 0.0-100.0 (default: 5.0-5.5) |
MODEL_3D_OCTREE_RESOLUTION | Detail level of the 3D model | Varies by space (see below) |
MODEL_3D_SEED | Randomness control | 0-10000000 (default: varies) |
MODEL_3D_REMOVE_BACKGROUND | Remove image background | true /false (default: true ) |
MODEL_3D_TURBO_MODE | Generation mode (Hunyuan3D-2mini-Turbo only) | Turbo , Fast , Standard (default: Turbo ) |
MODEL_SPACE_TYPE | Override space type detection | instantmesh , hunyuan3d , hunyuan3d_mini_turbo |
256
, 384
, 512
(default: 256
)Turbo
, 10 for Fast
, 20 for Standard
)PORT=3000
Edit the config file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"game-asset-generator": {
"command": "node",
"args": ["/full/path/to/game-asset-mcp/src/index.js"]
}
}
}
Restart Claude Desktop after editing.
./assets
within the working directory.2d_asset_generate_2d_asset_1698765432_abcd1234.png
).node src/index.js /path/to/custom/directory
asset://2d_asset/filename.png
) to list or read assets.The Model Context Protocol (MCP) enables this tool to serve AI clients securely:
generate_2d_asset
, generate_3d_asset
.asset://
URIs.generate_2d_sprite
, generate_3d_model
../logs/server.log
.HF_TOKEN
and MODEL_SPACE
in .env
.node --version
).tail -f ./logs/server.log
"gokaygokay/Flux-2D-Game-Assets-LoRA"
(50 steps)."gokaygokay/Flux-Game-Assets-LoRA-v2"
(30 steps)./check_input_image
, /preprocess
, /generate_mvs
, /make3d
)./generation_all
)./generation_all
) with turbo modes.src/index.js
.package.json
.We welcome contributions! To participate:
Follow standard coding conventions and include tests where applicable.
Licensed under the MIT License. See the LICENSE file for details.
{
"mcpServers": {
"game-asset-generator": {
"env": {},
"args": [
"/full/path/to/game-asset-mcp/src/index.js"
],
"command": "node"
}
}
}
Seamless access to top MCP servers powering the future of AI integration.