Content
[](https://mseep.ai/app/fengin-image-gen-server)
# Tool List
<div align="center">
<img src="images/logo_0.png" alt="Image-Gen-Server Logo" width="100%">
</div>
[](https://smithery.ai/server/@fengin/image-gen-server)
An image generation service based on MCP Server, specifically designed for integration with Cursor IDE. It receives text descriptions from Cursor, generates corresponding images, and provides image download and saving functionality.
The development process of this plugin can be found on my website: [Developing an MCP Server for Cursor Integration](https://aibook.ren/archives/mcp-server-for-cursor)
For more AI knowledge, visit AI Book (https://aibook.ren)
<div align="center">
<img src="images/example.png" alt="Image-Gen-Server Logo" width="100%">
</div>
## Features
- Perfect integration with Cursor IDE
- Supports text-to-image generation
- Automatically saves generated images
- Supports custom save paths
- Generates four images at once for more options
## Installation
### Installing via Smithery
To install Image-Gen-Server for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@fengin/image-gen-server):
```bash
npx -y @smithery/cli install @fengin/image-gen-server --client claude
```
1. Environment preparation
- Python 3.10+
- Install npm
- Install Node.js (tested with v20, other versions not verified)
- Install pip install uv
- For debugging, install: npm install -g @modelcontextprotocol/inspector@0.4.0
2. Clone the project
```bash
git clone https://github.com/fengin/image-gen-server.git
cd image-gen-server
```
3. Install dependencies
```bash
pip install -r requirements.txt
pip install uv
```
4. Set Jimeng Token and default image save path
Modify the following configurations in server.py:
```bash
# API configuration
JIMENG_API_TOKEN = "057f7addf85dxxxxxxxxxxxxx" # Your session_id obtained from Jimeng, support multiple tokens separated by commas
IMG_SAVA_FOLDER = "D:/code/image-gen-server/images" # Default image save path
```
## Cursor Integration
<div align="center">
<img src="images/cursor_config.png" alt="Image-Gen-Server Logo" width="100%">
</div>
1. Open Cursor settings
- Click the settings icon in the bottom left corner
- Select Features > MCP Servers
- Click "Add new MCP server"
2. Fill in server configuration
- Name: `image-gen-server` (or any name you prefer)
- Type: `command`
- Command:
```bash
uv run --with fastmcp fastmcp run D:\code\image-gen-service\server.py
```
Note: Replace the path with your actual project path
- Windows example: `uv run --with fastmcp fastmcp run D:/code/image-gen-service/server.py`
- macOS/Linux example: `uv run --with fastmcp fastmcp run /Users/username/code/image-gen-server/server.py`
Windows path issues may occur, try different slashes
## Usage
In Cursor, to generate images, use the agent mode and prompt it to understand the image tool usage, then directly provide the image requirements and save path.
## Obtaining Jimeng Token
1. Visit [Jimeng](https://jimeng.jianying.com/)
2. Log in to your account
3. Open developer tools by pressing F12
4. Find `sessionid` in Application > Cookies
5. Set the found sessionid to JIMENG_API_TOKEN in server.py
## Tool Function Description
### generate_image
```python
async def generate_image(prompt: str, file_name: str, save_folder: str = None, sample_strength: float = 0.5, width: int = 1024, height: int = 1024) -> list[types.TextContent | types.ImageContent | types.EmbeddedResource]:
"""Generate images based on text descriptions
Args:
prompt: Text prompt description for the image
file_name: File name of the generated image (without path, default .jpg if no suffix)
save_folder: Absolute directory path for saving images (optional, default IMG_SAVA_FOLDER)
sample_strength: Fineness of generated images (optional, range 0-1, default 0.5)
width: Width of the generated image (optional, default 1024)
height: Height of the generated image (optional, default 1024)
Returns:
List: JSON string containing generation results
"""
```
### Technical Implementation
1. server.py uses fastmcp to implement MCP server capabilities for Cursor/Claude usage
2. server.py calls the proxy.jimeng module to interact with Jimeng AI.
The proxy.jimeng module can be installed separately and provides the following main functions:
- Image generation (generate_images)
- Synchronous dialogue completion (create_completion)
- Streaming dialogue completion (create_completion_stream)
- Multi-account token support
- Complete error handling
For more details, refer to `proxy/jimeng/README.md`.
### Usage Examples
```cmd
# In Cursor agent mode
# Example 1
Based on your project requirements, help me generate a product logo and save it in the project directory images.
# Example 2
Based on project requirements, help me create the homepage with a banner image in the header.
```
## License
MIT License
Author: Feng
## Troubleshooting
1. Configuration complete, but a black window appears and disappears quickly, with the tool status changing to "No tools found"
Cause: Failure to start normally, usually due to:
- Incorrect command configuration, check if the command is correct, especially the server.py path and path slashes
- Unprepared dependencies or environments
- Incorrect terminal for dependencies, try different terminals like git bash, cmd, powershell, wsl, etc.
2. After normal operation, want to view call logs or debug
Change the command to:
```
uv run --with fastmcp fastmcp dev D:/code/image-gen-service/server.py
```
Replace the last `run` with `dev`.
Or run the following command in a terminal to enter debug mode:
```
fastmcp dev D:/code/image-gen-service/server.py
```
A debug address will be output: http://localhost:5173/, open it in a browser to use MCP Inspector for debugging. Refer to the official documentation for MCP Inspector usage.
Connection Info
You Might Also Like
OpenAI Whisper
OpenAI Whisper MCP Server - 基于本地 Whisper CLI 的离线语音识别与翻译,无需 API Key,支持...
markitdown
Python tool for converting files and office documents to Markdown.
oh-my-opencode
Background agents · Curated agents like oracle, librarians, frontend...
chatbox
User-friendly Desktop Client App for AI Models/LLMs (GPT, Claude, Gemini, Ollama...)
continue
Continue is an open-source project for seamless server management.
claude-flow
Claude-Flow v2.7.0 is an enterprise AI orchestration platform.