Content

# Omni-Adapter
A multi-platform intelligent image generation adapter based on the FastMCP framework, deeply integrated with multiple AI platforms through browser plugins, providing a unified MCP (Model Context Protocol) service interface, supporting unlimited calls to text-to-image and image-to-image functions on different platforms.
## Core Features
- 🚀 **FastMCP Framework**: Provides standardized service interfaces based on the modern MCP protocol
- 🎨 **Multi-Platform Support**: Supports multiple AI platforms such as Doubao and Qwen
- 🔄 **Multi-Client Support**: Supports multiple browser instances connected simultaneously with intelligent load balancing
- ⚡ **Efficient Task Scheduling**: Task allocation using polling algorithms, supporting concurrent processing
- 🛡️ **Reliability Guarantee**: Task timeout management, automatic reconnection, and connection status monitoring
- 📸 **Intelligent Image Processing**: Automatic image upload, reference image processing, and image ratio adjustment
- 🎯 **Image Management**: Built-in image collection, preview, and batch download functions
- 📊 **Real-Time Monitoring**: Complete connection status and task status query interfaces
- 🔧 **Flexible Configuration**: Supports personalized settings such as automatic refresh and Cookie management
## System Architecture
### Core Components
1. **MCP Server** (`McpServer/`)
- FastMCP framework provides standard MCP interfaces
- WebSocket server handles browser plugin connections
- Task queue management and load balancing
- Connection status monitoring and exception handling
2. **Browser Plugin Collection**
- **Doubao Agent** (`DoubaoMcpBrowserProxy/`): Integrates Doubao client
- **Qwen Agent** (`QwenMcpBrowserProxy/`): Integrates Qwen client
- Automates text-to-image and image-to-image instruction input
- Intelligent image upload and reference image processing
- Real-time image URL collection and monitoring
- User interface enhancement functions
## Supported Platforms
### Doubao
- **Platform Address**: https://www.doubao.com
- **Functions**: Text-to-image, Image-to-image
- **Features**: High-quality image generation, supports multiple styles
### Qwen
- **Platform Address**: https://chat.qwen.ai
- **Functions**: Text-to-image, Image-to-image
- **Features**: Powerful Chinese understanding capability, supports multiple ratios
## Demo Video
https://github.com/user-attachments/assets/98ed6c08-1252-4976-90ed-53440ef13280
## System Requirements
- **Python**: 3.8 or higher
- **Browser**: Chromium kernel browser supporting Chrome extensions
- **AI Platforms**: Doubao client, Qwen web version
- **Operating System**: Windows / macOS / Linux
## Quick Start
### 1. Project Installation
```bash
# Clone the project
git clone https://github.com/HuChundong/Omni-Adapter.git
cd Omni-Adapter
# Install Python dependencies
cd McpServer
pip install -r requirements.txt
```
### 2. Install Browser Plugins
#### Doubao Agent Installation
1. Open the browser extension page (`chrome://extensions/`)
2. Enable the "Developer mode" in the top right corner
3. Click "Load unpacked"
4. Select the `DoubaoMcpBrowserProxy` directory
#### Qwen Agent Installation
1. Open the browser extension page (`chrome://extensions/`)
2. Enable the "Developer mode" in the top right corner
3. Click "Load unpacked"
4. Select the `QwenMcpBrowserProxy` directory
### 3. Configure AI Platforms
#### Doubao Client Configuration
For the best experience, it is recommended to add startup parameters to the Doubao client shortcut:
```bash
"Doubao client path" --silent-debugger-extension-api
```
Example:
```bash
"C:\Program Files\Doubao\app\Doubao.exe" --silent-debugger-extension-api
```
#### Qwen Configuration
1. Visit [https://chat.qwen.ai](https://chat.qwen.ai)
2. Log in to your account
3. Ensure the plugin is correctly installed and activated
### 4. Start the Service
```bash
# Start the service in the McpServer directory
python server.py
```
After the service starts, it will provide:
- **WebSocket Service**: `ws://localhost:8080` (browser plugin connection)
- **MCP Service**: `http://localhost:8081` (MCP client connection)
> **Note**: If deployed on a server, replace `localhost` with the actual server IP address and ensure the firewall allows access to the corresponding ports.
## Usage Guide
### MCP Client Access
#### Configure MCP Service Address
Configure the service address in the MCP client:
```text
http://192.168.2.192:8081/mcp
```
#### 1. Text-to-Image Tool
**Tool Name**: `draw_image`
**Function**: Generate images based on text prompts
**Parameters**:
- `prompt` (string): Text prompt, describing the content of the image you want to generate
- `ratio` (string, optional): Image ratio, default is "2:3"
- `platform` (string, optional): Specify the platform, optional "doubao" or "qwen", default is "doubao"
**Supported Ratios**:
- "1:1" - Square
- "2:3" - Vertical (default)
- "3:2" - Horizontal
- "16:9" - Widescreen
- "9:16" - Vertical screen
- "4:3" - Standard horizontal
- "3:4" - Standard vertical
**Return Format**:
```json
{
"status": "success",
"image_urls": ["https://...", "https://..."],
"platform": "doubao"
}
```
#### 2. Image-to-Image Tool
**Tool Name**: `edit_image`
**Function**: Generate or edit images based on reference images and text prompts
**Parameters**:
- `prompt` (string): Text description of image editing, describing the modifications you want to make to the reference image
- `reference_picture` (string): URL of the reference image, must be an accessible HTTP or HTTPS link
- `ratio` (string, optional): Generated image ratio, default is "2:3"
- `platform` (string, optional): Specify the platform, optional "doubao" or "qwen", default is "doubao"
**Return Format**:
```json
{
"status": "success",
"image_urls": ["https://...", "https://..."],
"platform": "qwen"
}
```
**Notes**:
- `reference_picture` must be a valid image URL, supporting common formats: jpg, jpeg, png, gif, webp
- The image URL must be publicly accessible and not require authentication
- It is recommended that the image size does not exceed 10MB, and the resolution is within 1024x1024
#### 3. Connection Status Query Tool
**Tool Name**: `get_connection_status`
**Function**: Get server connection status and task information
**Return Information**:
- Number of connected clients and status
- Current task queue situation
- System operation status
- Connection status of each platform
### Browser Plugin Functions
#### Automation
- Automatically receive text-to-image and image-to-image instructions sent by the MCP server
- Intelligent image upload: automatically download and upload reference images to the corresponding platform
- Simulate user input prompts and image ratios on the AI platform
- Real-time monitoring of generated images and collection of URLs
#### Image Management
- **Real-time Preview**: Pop-up display of all collected images
- **Individual Download**: Select specific images for download
- **Batch Download**: One-click download of all images
- **List Management**: Clear image list and restart collection
#### Personalized Settings
In the plugin options page (`chrome://extensions/` → Plugin details → Extension program options), you can configure:
- **Automatic Refresh**: Whether to automatically refresh the page after the task is completed
- **Cookie Management**: Whether to automatically clear Cookies (keep anonymous status)
- **Platform Selection**: Default AI platform used
## Advanced Configuration
### Server Configuration
In `McpServer/server.py`, you can adjust the following parameters:
```python
# Server configuration
SERVER_HOST = "0.0.0.0" # Server listening address
WS_PORT = 8080 # WebSocket port
MCP_PORT = 8081 # MCP service port
# Task configuration
DEFAULT_TIMEOUT = 120.0 # Default task timeout (seconds)
MAX_TASKS = 50 # Maximum task queue length
```
### Task Management Strategy
- **Polling Load Balancing**: Tasks are automatically assigned to idle clients
- **Timeout Protection**: 120-second task timeout, automatic resource release
- **Status Monitoring**: Real-time monitoring of client connections and task status
- **Exception Recovery**: Automatic cleanup of related tasks when the client disconnects
- **Image Processing**: Automatic download of reference images and upload to the corresponding platform
- **Ratio Control**: Supports multiple image ratios to meet different scenario needs
## Troubleshooting
### Common Issues
1. **Plugin Cannot Connect to Server**
- Check if the server is started (`python server.py`)
- Confirm that port 8080 is not occupied
- Check firewall settings
2. **Task Timeout or Failure**
- Ensure the AI platform is operating normally
- Check network connection stability
- Try refreshing the platform page
3. **Images Cannot Be Downloaded**
- Check browser download permissions
- Confirm image URL validity
- Try clearing browser cache
### Log Debugging
View server logs:
```bash
# Server logs will display detailed connection and task information
python server.py
```
View browser console:
```javascript
// Press F12 on the AI platform page to view Console output
// Search for related logs with "[Script]" or "[WebSocket]"
```
## Precautions and Limitations
### Usage Notes
⚠️ **Important Reminder**:
1. **Privacy Protection**: The plugin will automatically clear Cookies, and each use is in an anonymous state
2. **Page Refresh**: To ensure normal function, the plugin may automatically refresh the platform page
3. **Single Task Limitation**: Each client can only handle one image generation task at a time
4. **Network Dependency**: A stable network connection is required to ensure normal service
### Legal and Compliance
- This project is for learning and research purposes only
- Please comply with the service terms and usage agreements of each AI platform
- Prohibited for commercial use
- Prohibited from generating illegal or irregular content
### Performance Considerations
- It is recommended that the number of connected clients does not exceed 5
- A large number of concurrent requests may affect the stability of the AI platform service
- Regularly restart the service to clean up resource occupancy
## Development Guide
### Project Structure
```
Omni-Adapter/
├── McpServer/ # MCP Server
│ ├── server.py # Main service file
│ ├── requirements.txt # Python dependencies
│ └── docker-compose.yml # Docker configuration
├── DoubaoMcpBrowserProxy/ # Doubao browser plugin
│ ├── manifest.json # Plugin configuration
│ ├── content.js # Content script
│ ├── background.js # Background script
│ └── settings-panel.js # Settings panel
├── QwenMcpBrowserProxy/ # Qwen browser plugin
│ ├── manifest.json # Plugin configuration
│ ├── content.js # Content script
│ ├── background.js # Background script
│ └── settings-panel.js # Settings panel
└── README.md
```
### Adding New Platform Support
1. Create a new browser plugin directory
2. Implement platform-specific interaction logic
3. Add platform recognition in the MCP server
4. Update documentation and configuration
### Communication
You can join the Omni-bot developer exchange group, please specify omni-bot, and the robot will automatically pass through. The number of automatic passes per day is limited, please be patient.
<p align="center">
<img src="https://omni-rpa.bmwidget.com/omni-rpa.jpg" alt="Exchange Group" width="300">
<img src="https://github.com/user-attachments/assets/16db82a1-6032-4c4b-8287-8dfbb3be70ce" alt="Group Master Bot"width="300">
</p>
(If the project is useful to you, you can also buy me a cup of coffee ☕️ ~)
<p align="center">
<kbd><img src="https://github.com/user-attachments/assets/195ab37d-bc51-44a2-9330-e4df9dbf67dc" alt="Appreciation Code" width="200"/></kbd>
</p>
### Contributing Code
Welcome to submit Issues and Pull Requests! Before contributing, ensure:
1. Code complies with project specifications
2. Add necessary test cases
3. Update relevant documentation
4. Pass all existing tests
## Open Source License
This project is open-sourced under the MIT license. See [LICENSE](LICENSE) for details.
## Disclaimer
This project is for learning and research purposes only. Please do not use it for commercial purposes. The user assumes all risks and consequences of using this project. The author is not responsible for any losses caused by the project.
## Acknowledgements
Thanks to the powerful text-to-image models of Doubao and Qwen for providing technical support for this project.
## Star History
<a href="https://www.star-history.com/#HuChundong/Omni-Adapter&Date">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=HuChundong/Omni-Adapter&type=Date&theme=dark" />
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=HuChundong/Omni-Adapter&type=Date" />
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=HuChundong/Omni-Adapter&type=Date" />
</picture>
</a>
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...)
claude-flow
Claude-Flow v2.7.0 is an enterprise AI orchestration platform.
continue
Continue is an open-source project for seamless server management.