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 of 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, Qwen, etc.
- 🔄 **Multi-Client Support**: Supports simultaneous connection of multiple browser instances, intelligent load balancing
- ⚡ **Efficient Task Scheduling**: Round-robin algorithm for task allocation, supports concurrent processing
- 🛡️ **Reliability Assurance**: Task timeout management, automatic reconnection, connection status monitoring
- 📸 **Intelligent Image Processing**: Automatic image uploading, reference image processing, image ratio adjustment
- 🎯 **Image Management**: Built-in image collection, preview, batch download functions
- 📊 **Real-Time Monitoring**: Complete connection status and task status query interface
- 🔧 **Flexible Configuration**: Supports automatic refresh, Cookie management, and other personalized settings
## System Architecture
### Core Components
1. **MCP Server** (`McpServer/`)
- FastMCP framework provides standard MCP interface
- WebSocket server handles browser plugin connections
- Task queue management and load balancing
- Connection status monitoring and exception handling
2. **Browser Plugin Collection**
- **Doubao Proxy** (`DoubaoMcpBrowserProxy/`): Integrates Doubao client
- **Qwen Proxy** (`QwenMcpBrowserProxy/`): Integrates Qwen client
- Automated text-to-image and image-to-image command input
- Intelligent image uploading and reference image processing
- Real-time image URL collection and monitoring
- User interface enhancement features
## Supported Platforms
### Doubao (豆包)
- **Platform Address**: https://www.doubao.com
- **Function**: Text-to-image, Image-to-image
- **Features**: High-quality image generation, supports multiple styles
### Qwen (通义千问)
- **Platform Address**: https://chat.qwen.ai
- **Function**: Text-to-image, Image-to-image
- **Features**: Powerful Chinese understanding ability, 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-based browser that supports Chrome extensions
- **AI Platform**: 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 Proxy Installation
1. Open the browser extensions page (`chrome://extensions/`)
2. Enable "Developer mode" in the upper right corner
3. Click "Load unpacked"
4. Select the `DoubaoMcpBrowserProxy` directory
#### Qwen Proxy Installation
1. Open the browser extensions page (`chrome://extensions/`)
2. Enable "Developer mode" in the upper right corner
3. Click "Load unpacked"
4. Select the `QwenMcpBrowserProxy` directory
### 3. Configure AI Platform
#### 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 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 that 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-to-image prompt, describing the content of the image you want to generate
- `ratio` (string, optional): Image ratio, defaults to "2:3"
- `platform` (string, optional): Specify the platform, can be "doubao" or "qwen", defaults to "doubao"
**Supported Ratios**:
- "1:1" - Square
- "2:3" - Portrait (default)
- "3:2" - Landscape
- "16:9" - Widescreen
- "9:16" - Vertical screen
- "4:3" - Standard landscape
- "3:4" - Standard portrait
**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 the image editing, describing the modifications you want to make to the reference image
- `reference_picture` (string): Network address URL of the reference image, must be an accessible HTTP or HTTPS link
- `ratio` (string, optional): Aspect ratio of the generated image, defaults to "2:3"
- `platform` (string, optional): Specify the platform, can be "doubao" or "qwen", defaults to "doubao"
**Return Format**:
```json
{
"status": "success",
"image_urls": ["https://...", "https://..."],
"platform": "qwen"
}
```
**Precautions**:
- `reference_picture` must be a valid image URL, supporting common formats: jpg, jpeg, png, gif, webp
- The image URL must be publicly accessible and cannot require authentication
- It is recommended that the image size does not exceed 10MB, and the resolution is recommended to be within 1024x1024
#### 3. Connection Status Query Tool
**Tool Name**: `get_connection_status`
**Function**: Get server connection status and task information
**Return Information**:
- Number and status of connected clients
- Current task queue status
- System running status
- Connection status of each platform
### Browser Plugin Features
#### Automated Operations
- Automatically receive text-to-image and image-to-image commands sent by the MCP server
- Intelligent image uploading: automatically download and upload reference images to the corresponding platform
- Simulate users entering prompts and image ratios in the AI platform
- Real-time monitoring of generated images and collection of URLs
#### Image Management
- **Real-time Preview**: Pop-up window displays all collected images
- **Individual Download**: Select specific images for download
- **Batch Download**: One-click download of all images
- **List Management**: Clear the image list and start collecting again
#### Personalized Settings
Can be configured in the plugin options page (`chrome://extensions/` → Plugin Details → Extension Options):
- **Automatic Refresh**: Whether to automatically refresh the page after the task is completed
- **Cookie Management**: Whether to automatically clear Cookies (maintain anonymous status)
- **Platform Selection**: Default AI platform to use
## Advanced Configuration
### Server Configuration
The following parameters can be adjusted in `McpServer/server.py`:
```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 time (seconds)
MAX_TASKS = 50 # Maximum length of the task queue
```
### Task Management Strategy
- **Round-Robin Load Balancing**: Tasks are automatically assigned to idle clients
- **Timeout Protection**: 120-second task timeout, automatically release resources
- **Status Monitoring**: Real-time monitoring of client connection and task status
- **Exception Recovery**: Automatically clean up related tasks when the client disconnects
- **Image Processing**: Automatically download reference images and upload them to the corresponding platform
- **Ratio Control**: Supports multiple image ratios to meet different scenario requirements
## Troubleshooting
### Common Issues
1. **Plugin cannot connect to the 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 running normally
- Check the stability of the network connection
- Try refreshing the platform page again
3. **Image cannot be downloaded**
- Check browser download permissions
- Confirm the validity of the image URL
- Try clearing the 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 the Console output
// Search for "[Script]" or "[WebSocket]" related logs
```
## Notes and Limitations
### Usage Instructions
⚠️ **Important Tips**:
1. **Privacy Protection**: The plugin automatically clears Cookies, and each use is anonymous
2. **Page Refresh**: To ensure proper functionality, the plugin may automatically refresh the platform page
3. **Single Task Limitation**: Each client can only process one image generation task at a time
4. **Network Dependency**: A stable network connection is required to ensure normal service
### Laws and Compliance
- This project is for learning and research purposes only
- Please comply with the terms of service and usage agreements of each AI platform
- Prohibited for any commercial use
- Prohibited from generating illegal content
### Performance Considerations
- It is recommended that the number of clients connected at the same time does not exceed 5
- A large number of concurrent requests may affect the stability of the AI platform service
- Restart the service regularly to clean up resource usage
## 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
```
### Add New Platform Support
1. Create a new browser plugin directory
2. Implement platform-specific interaction logic
3. Add platform identification in the MCP server
4. Update documentation and configuration
### Communication
You can join the Omni-bot developer communication group, please indicate omni-bot, the robot will automatically pass, the number of people automatically passing each day is limited, please be patient
<p align="center">
<img src="https://omni-rpa.bmwidget.com/omni-rpa.jpg" alt="交流群" width="300">
<img src="https://github.com/user-attachments/assets/16db82a1-6032-4c4b-8287-8dfbb3be70ce" alt="群主bot"width="300">
</p>
(If the project is useful to you, you can also buy me a coffee ☕️ ~)
<p align="center">
<kbd><img src="https://github.com/user-attachments/assets/195ab37d-bc51-44a2-9330-e4df9dbf67dc" alt="赞赏码" width="200"/></kbd>
</p>
### Contribute Code
Welcome to submit Issues and Pull Requests! Before contributing, please ensure:
1. The code complies with the project specifications
2. Add necessary test cases
3. Update relevant documentation
4. Pass all existing tests
## Open Source License
This project is open source under the MIT license. See the [LICENSE](LICENSE) file for details.
## Disclaimer
This project is for learning and research purposes only and should not be used for commercial purposes. The user is solely responsible for any consequences arising from the use of this project. The author is not responsible for any losses caused by the project.
## Acknowledgments
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
markitdown
Python tool for converting files and office documents to Markdown.
Fetch
Retrieve and process content from web pages by converting HTML into markdown format.
chatbox
User-friendly Desktop Client App for AI Models/LLMs (GPT, Claude, Gemini, Ollama...)
oh-my-opencode
Background agents · Curated agents like oracle, librarians, frontend...
continue
Continue is an open-source project for seamless server management.
semantic-kernel
Build and deploy intelligent AI agents with Semantic Kernel's orchestration...