AI Personal Learning
and practical guidance
豆包Marscode1

Can you draw in a code editor? This MCP turns the Cursor into a drawing board.

Recently, an image-generating MCP service caught my attention. The service is based on Together AI, which can be used with Cursor Code editor integrations such as this one allow developers to experience the joys of AI drawing without having to leave their familiar coding environment.

The MCP Server is said to utilize the powerful computational capabilities provided by Together AI, a company focused on providing artificial intelligence services, and the model used in thisblack-forest-labs/FLUX.1-schnell-FreeThe service is currently available for free. The service supports image generation up to 1024x1024 resolution and can batch generate up to 4 images at a time. In addition, MCP Server has complete path and permission checks, detailed error alerts, asynchronous processing and automatic retries.


 

Rapid deployment, instant experience

According to the developers, the deployment process of this program is very easy. All that is required is the following environment:

  • Python 3.10+ environment: It is recommended to use pyenv for versioning.
  • Node.js Environment: You can download and install it from the Node.js website.
  • uv package management tools: A high-speed Python package manager.
  • Together AI API key: You need to register and create an account on the Together AI website.

702902f7-f1c4-4119-881e-6092a0583e3c.png

After completing the environment preparation, the installation and configuration can be done in just a few steps:

  1. Cloning Project:
git clone https://github.com/chenyeju295/mcp_generate_images.git
  1. Install the dependencies (executed after entering the project directory):
python3 -m pip install fastmcp requests
  1. Configure the API key:

    show (a ticket) mcp_server.py file, which will TOGETHER_API_KEY Replace the key with your own.

  2. (Optional) Customized configuration:

It can be used as you see fit in themcp_server.pyAdjust the configuration.

CONFIG = {
"api": {
"url": "https://api.together.xyz/v1/images/generations",
"model": "black-forest-labs/FLUX.1-schnell-Free",
"timeout": 30,
"max_retries": 3,
"retry_delay": 5
},
"image": {
"max_width": 1024,
"max_height": 1024,
"default_width": 1024,
"default_height": 1024,
"default_steps": 2,
"max_batch_size": 4
},
"output": {
"base_folder": "你的默认保存路径",
"allowed_extensions": [".png", ".jpg", ".jpeg"],
"default_extension": ".png"
}
}

 

Activation and use

Start the service:

uv run --with fastmcp fastmcp run /Users/username/Documents/mcp_generate_images/mcp_server.py

In Cursor IDE, add the MCP service address, and in Agent mode, enter a prompt word, for example: "Generate a picture of an astronaut flying in space, HD style", the service will automatically process the request, save the generated picture to the specified location, and return the path to the picture.

 

Integrated development at low cost

Advantages of MCP Server over other image generation solutions:

  • development cooperation: No need to switch tools to improve development efficiency.
  • Free Models: Free models based on Together AI to reduce cost of use.
  • Customizable: Support for custom parameters and storage paths.
  • image quality: The quality of the images generated by the FLUX.1 model was tested to be generally satisfactory for use.

There are a number of other AI drawing tools on the market today, but most of them require a separate application or web interface. mCP Server provides developers with a new option for seamlessly integrating AI drawing with code editing.

May not be reproduced without permission:Chief AI Sharing Circle " Can you draw in a code editor? This MCP turns the Cursor into a drawing board.
en_USEnglish