Generate images from text prompts using fal.ai via the Model Context Protocol (MCP). This project is intended for use as a backend tool in AI IDEs such as Cursor, Windsurf, or any other MCP-compatible editor.
Install Requirements
Add MCP Server to Your IDE
{
"mcpServers": {
"fal-ai-image": {
"command": "npx",
"args": ["-y", "mcp-fal-ai-image"],
"env": { "FAL_KEY": "YOUR-FAL-AI-API-KEY" }
}
}
}
YOUR-FAL-AI-API-KEY
with your actual API key.Start Generating Images
generate-image
tool from your IDE's command palette or MCP UI.Troubleshooting:
- If you see
FAL_KEY environment variable is not set
, set your API key as shown above.- If
npx
is not found, install Node.js 18+ and npm.
generate-image
fal-ai/recraft-v3
)square_hd
, square
, portrait_4_3
, portrait_16_9
, landscape_4_3
, landscape_16_9
(default: landscape_4_3
)Warning: FAL_KEY environment variable is not set. API calls will fail.
: Set your fal.ai API key in the environment as FAL_KEY
.failed to initialize: request failed
: Ensure your API key is correct and your network allows outbound HTTPS.npx: command not found
: Install Node.js 18+ and npm.Request:
{
"tool": "generate-image",
"args": {
"prompt": "A futuristic cityscape at sunset"
}
}
Response:
{
"images": [
{
"url": "https://fal.ai/generated/abc123.png",
"localPath": "/home/username/Downloads/fal_ai/a_futuristic_cityscape_at_suns_2025-04-17T10-11-11-503Z.png"
}
]
}
Generated images are saved to your local system:
~/Downloads/fal_ai
(on Linux/macOS; uses XDG standard if available)FAL_IMAGES_OUTPUT_DIR
to your desired folder. Images will be saved in <your-folder>/fal_ai
.The full file path for each image is included in the tool's response.
Contributions and suggestions are welcome! Please open issues or pull requests on GitHub.
If you want to run the MCP server manually (for development, debugging, or advanced use):
FAL_KEY=your_fal_api_key npx mcp-fal-ai-image
MIT License © 2025 Madhusudan Kulkarni
Seamless access to top MCP servers powering the future of AI integration.