A minimal Model Context Protocol (MCP) server for Black Forest Labs Flux models.
This project provides two tools powered by the Flux flux.1 Kontext API:
- generateImage – generate an image from a text prompt.
- editImage – edit an existing image using a prompt and optional mask.
The server is written in TypeScript and uses the official MCP TypeScript SDK.
npm install
npm run build
node build/index.js
The server requires a Black Forest Labs API key to be configured in your MCP client settings.
The server exposes MCP tools over stdio and can be used with any IDE that supports MCP, including Claude Desktop, Cursor and Windsurf.
- Open the MCP settings and add a new server
- Command:
node /path/to/mcp-flux-studio/build/index.js
- In the configuration panel:
- Click on the "Configuration" tab
- Enter your API key in the
apiKey
field - Click "Save" to apply the configuration
- Go to Settings → Features → MCP
- Add a new server with the same command as above
- In the configuration panel:
- Click on the "Configuration" tab
- Enter your API key in the
apiKey
field - Click "Save" to apply the configuration
- Edit
~/.codeium/windsurf/mcp_config.json
and add:
{
"servers": [
{
"name": "Flux MCP Server",
"command": "node",
"args": ["/path/to/mcp-flux-studio/build/index.js"],
"config": {
"apiKey": "your_api_key"
}
}
]
}
- Save the file and refresh
{
"servers": [
{
"name": "Flux MCP Server",
"command": "node",
"args": ["/path/to/mcp-flux-studio/build/index.js"],
"config": {
"apiKey": "your_api_key"
}
}
]
}
{
"servers": [
{
"name": "Flux MCP Server",
"command": "node",
"args": ["/path/to/mcp-flux-studio/build/index.js"],
"config": {
"apiKey": "your_api_key"
}
}
]
}
{
"servers": [
{
"name": "Flux MCP Server",
"command": "node",
"args": ["/path/to/mcp-flux-studio/build/index.js"],
"config": {
"apiKey": "your_api_key"
}
}
]
}
To verify that your configuration is working:
- Open your IDE's MCP tools panel
- Look for the "Flux Kontext" tools
- Try generating a simple image with a basic prompt
- If you see an error about missing API key, double-check your configuration
Generate an image from a text prompt.
Parameters
prompt
(string, required) – text describing the desired image.negative_prompt
(string, optional) – undesirable elements to avoid.width
(number, optional, default 1024)height
(number, optional, default 1024)steps
(number, optional, default 30) – number of diffusion steps.guidance_scale
(number, optional, default 7.5)
Returns the URL of the generated image.
Edit an existing image using a prompt and optional mask.
Parameters
image
(string, required) – path to the base image or base64 data URL.mask
(string, optional) – path or base64 mask image.prompt
(string, required) – text describing the desired changes.negative_prompt
(string, optional)width
(number, optional, default 1024)height
(number, optional, default 1024)steps
(number, optional, default 30)guidance_scale
(number, optional, default 7.5)
Returns the URL of the edited image.
MIT