darekrossman/fluxlora-mcp
If you are the rightful owner of fluxlora-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
FluxLoRA MCP Server is a platform that enables users and autonomous agents to generate high-quality images in various artistic styles by leveraging open-source LoRA models.
FluxLoRA MCP Server
An MCP (Model Context Protocol) server that lets users and autonomous agents generate high-quality images in a chosen artistic style by automatically discovering and applying open-source LoRA (Low-Rank Adaptation) models.
Features
- Tool:
generate_image
- Generate images with automatic LoRA selection based on style - Tool:
discover_loras
- Search for LoRA models from HuggingFace Hub or local directories - Tool:
save_image_to_disk
- Save generated images to the local filesystem - Resource:
lora://{name}
- Access metadata for LoRA models - Resource:
config://defaults
- View effective configuration defaults - Prompts - Helper prompts for LLMs to use the tools effectively
Project Structure
fluxlora-mcp/
āāā bin/ # Executable scripts
āāā scripts/ # Dev utility scripts
āāā src/
ā āāā config/ # Environment configuration
ā āāā mcp/ # MCP server implementation
ā āāā prompts/ # System prompts for LLMs
ā āāā resources/ # MCP resources
ā āāā services/ # External service integrations
ā ā āāā fal/ # Fal.ai client for image generation
ā ā āāā fs/ # Filesystem operations
ā ā āāā hf/ # HuggingFace Hub client
ā āāā tools/ # MCP tool implementations
ā ā āāā discover_loras.ts
ā ā āāā generate_image.ts
ā ā āāā save_image_to_disk.ts
ā āāā types/ # TypeScript type definitions
ā āāā utils/ # Utility functions
āāā IMPLEMENTATION-PLAN.md # Current status and roadmap
āāā README.md # This file
Technology Stack
- TypeScript: Type-safe JavaScript for robust development
- Zod: Runtime validation for input/output schemas
- MCP SDK: Integration with the Model Context Protocol
- Fal.ai Client: API client for image generation
- HuggingFace Hub: API client for discovering LoRA models
Installation
# Clone the repository
git clone https://github.com/yourusername/fluxlora-mcp.git
cd fluxlora-mcp
# Install dependencies
npm install
Configuration
Copy the example environment file and update with your settings:
cp .env.example .env
Required environment variables:
FAL_KEY
- Your Fal API key (get one from Fal.ai)HF_TOKEN
- Optional Hugging Face API token for increased rate limits
Development
# Start the server in development mode
npm run dev
# Build the project with TypeScript
npm run build
# Create an optimized bundle with esbuild
npm run bundle
# Run tests
npm test
# Run the MCP Inspector with your development server
npm run inspect
# Lint and typecheck your code
npm run lint
npm run typecheck
Using the MCP Inspector
The project includes integration with the MCP Inspector, an interactive developer tool for testing and debugging MCP servers.
With the Inspector, you can:
- Test your tools, resources, and prompts interactively
- Inspect server responses and error handling
- Subscribe to resources and observe real-time updates
- Verify tool schemas and input validation
To use the Inspector:
- First build your project:
npm run build
- Run the inspector:
npm run inspect
- Use the web interface that opens automatically to interact with your server
Deployment
The project supports multiple build options:
-
TypeScript Build: Standard TypeScript compilation (
npm run build
)- Output:
dist/
- Usage:
node dist/index.js
- Output:
-
Optimized Bundle: Single-file bundle with esbuild (
npm run bundle
)- Output:
dist/bundle/index.js
- Usage:
node dist/bundle/index.js
- Benefits: Faster startup, smaller deployment size, simpler dependencies
- Output:
Usage
The server exposes an MCP-compatible API that can be used with any MCP client. Here are some examples:
Generate an Image
// Using an MCP client
const response = await client.invokeTool('generate_image', {
prompt: 'A watercolor portrait of a cyberpunk cat',
style: 'watercolor',
width: 512,
height: 512
});
console.log(response.image.url);
Discover LoRA Models
const loras = await client.invokeTool('discover_loras', {
style: 'anime',
limit: 10
});
console.log(loras.results);
Save an Image
const result = await client.invokeTool('save_image_to_disk', {
url: 'https://example.com/image.png'
});
console.log(result.filePath);
Project Roadmap
Completed
- ā MCP server with protocol integration
- ā Fal.ai client implementation
- ā Image generation with parameter validation
- ā HuggingFace Hub integration for LoRA discovery
- ā Image storage utilities with security checks
- ā Configuration resource implementation
- ā System prompts for LLMs
In Progress
- š Testing infrastructure
- š Enhanced LoRA discovery with better style mapping
- š Local
.safetensor
file scanning
Planned
- ā³ LoRA resource implementation
- ā³ API response caching
- ā³ Logging infrastructure
- ā³ Performance optimization
- ā³ Documentation site
- ā³ Release automation
Future Enhancements
- Batch image generation
- Grid view outputs
- ControlNet integration
- Video and audio generation
- Optional web UI
Documentation
For more detailed documentation, see:
Dependencies
- MCP TypeScript SDK:
@modelcontextprotocol/sdk
- Fal Client:
@fal-ai/client
- HuggingFace Hub:
@huggingface/hub
- Zod:
zod
License
MIT