game-asset-mcp
by: MubarakHAlketbi
An MCP server for creating 2D/3D game assets from text using Hugging Face AI models.
📌Overview
Purpose: The Game Asset Generator aims to simplify and accelerate the creation of 2D and 3D game assets using AI technology.
Overview: This innovative tool leverages AI to transform text prompts into game-ready assets. It supports generating both 2D assets, like pixel art sprites, and 3D models in various formats. Integrating models from Hugging Face Spaces and utilizing the Model Context Protocol (MCP) allows for efficient interaction and processing, making it suitable for game developers and AI enthusiasts alike.
Key Features:
-
2D Asset Generation: Creates 2D game assets from text prompts, enhancing creative freedom and speed in asset creation.
-
3D Asset Generation: Generates 3D models (OBJ and GLB formats) directly from text descriptions, streamlining the workflow from concept to implementation.
-
Multiple 3D Model Spaces: Offers integration with various 3D generation models, providing flexibility in conversion processes tailored to specific requirements.
-
MCP Integration: Enables seamless interaction with AI clients using the Model Context Protocol, enhancing usability and accessibility.
-
Robust Input Validation: Utilizes Zod for secure and reliable data processing, ensuring a smooth user experience.
Game Asset Generator using MCP and Hugging Face Spaces
This project is an innovative tool that simplifies game asset creation by leveraging AI-powered generation, allowing the effortless creation of 2D and 3D game assets from text prompts. It integrates AI models from Hugging Face Spaces and uses the Model Context Protocol (MCP) for seamless interaction with AI assistants.
Table of Contents
- Project Overview
- Features
- How It Works
- Prerequisites
- Installation
- Usage
- Configuration
- File Management
- MCP Integration
- Troubleshooting
- Advanced
- Contributing
- License
Project Overview
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. Built with Node.js and the MCP TypeScript SDK (v1.7.0), it provides a robust, cross-platform solution for asset generation.
Features
- 2D Asset Generation: Create pixel art, sprites, or other 2D assets from text prompts.
- 3D Asset Generation: Generate 3D models from text descriptions, with automatic image-to-model conversion.
- Multiple 3D Model Spaces: Supports various workflows for enhanced performance.
- MCP Integration: Seamlessly interact with the tool via MCP-compatible clients.
- File Management: Automatically saves and organizes assets in a local
assets
directory. - Robust Input Validation: Ensures secure and reliable input processing.
- Multi-Client Support: Handles multiple simultaneous connections.
- Secure Remote Access: Optional HTTPS support.
- Extensible Backend: Modular design for easy integration of new models or features.
- Cross-Platform: Compatible with Windows, macOS, and Linux.
- Configurable 3D Generation: Customize generation parameters via environment variables.
How It Works
The Game Asset Generator transforms text prompts into game-ready assets through an automated pipeline:
- User Input: Submit a text prompt.
- MCP Server: Routes the prompt to the appropriate tool.
- AI Model Interaction: Processes the prompts for 2D and 3D asset generation.
- File Output: Saves assets in the
assets
directory. - Response: Returns resource URIs for immediate use.
Prerequisites
- Node.js: Version 16+.
- Git: For cloning the repository.
- Internet Access: Required for API connectivity.
- Hugging Face Account: Needed for API access.
- NPM Packages: Includes required dependencies for operation.
- Optional: Claude Desktop for enhanced interaction.
Installation
-
Clone the Repository:
git clone https://github.com/yourusername/game-asset-mcp.git cd game-asset-mcp
-
Install Dependencies:
npm install
-
Configure Environment:
- Copy the example
.env
file and edit it with your Hugging Face API token.
- Copy the example
-
Run the Server:
npm start
Usage
Interact with the server via an MCP client:
- Generate a 2D Asset:
- Command:
generate_2d_asset prompt:"pixel art sword"
- Command:
- Generate a 3D Asset:
- Command:
generate_3d_asset prompt:"isometric 3D castle"
- Command:
Configuration
Customize the server via the .env
file:
Required Settings
- HF_TOKEN: Hugging Face API token.
- MODEL_SPACE: Your duplicated 3D model space.
Optional 3D Model Settings
MODEL_3D_STEPS
,MODEL_3D_GUIDANCE_SCALE
, etc.
File Management
- Storage Location: Assets are saved in
./assets
. - Naming Convention: Files use a structured naming convention for easy tracking.
MCP Integration
The Model Context Protocol (MCP) enables this tool to serve AI clients securely.
Troubleshooting
- Check network connectivity or rate limits; review server logs.
- Verify token and model space configurations.
Advanced
API Endpoints and Integration
- Details on 2D and 3D asset generation processes.
Versioning
- Current version: 0.3.0.
Backend Architecture
- Core dependencies and performance measures.
Contributing
We welcome contributions! Please fork the repository, make changes, and submit a pull request.
License
Licensed under the MIT License.