Spaces:
Running
title: A1d Mcp Server
emoji: π€
colorFrom: blue
colorTo: purple
sdk: gradio
sdk_version: 5.33.0
app_file: official_app.py
pinned: false
license: mit
tags:
- mcp-server-track
A1D MCP Server - Universal AI Tools
A powerful MCP (Model Context Protocol) server built with Gradio that provides AI image and video processing tools for any MCP-compatible client. This server implements the same tools as the original A1D MCP Server but uses Gradio for easy deployment and hosting.
π₯ Demo
MCP Server in Action: View Demo Recording
The demo shows the A1D MCP Server working with Claude Desktop and other MCP clients, featuring real-time AI image processing, seamless integration, and live preview of results.
π€ Available AI Tools
Tool | Description | Use Cases |
---|---|---|
remove_bg | AI background removal | Remove backgrounds from photos, product images |
image_upscaler | AI image enhancement | Upscale images 2x, 4x, 8x, 16x resolution |
video_upscaler | AI video enhancement | Improve video quality and resolution |
image_vectorization | Convert to vectors | Turn images into scalable SVG graphics |
image_extends | Smart image extension | Expand image boundaries intelligently |
image_generator | Text-to-image AI | Generate images from text descriptions |
π Quick Setup
1. Get Your API Key
- Visit A1D.ai to get your free API key
- Optional: Purchase credits for extended usage
2. Set Environment Variable
export A1D_API_KEY=your_api_key_here
3. Install Dependencies
pip install -r requirements.txt
4. Run the Server
Option 1: Using the startup script (Recommended)
python start_server.py
Option 2: Direct execution
python app.py
Option 3: Using virtual environment
source venv/bin/activate # On Windows: venv\Scripts\activate
python start_server.py
The server will start on http://localhost:7860
with MCP server enabled.
5. Test the Installation
python test_app.py
This will run a comprehensive test suite to verify everything is working correctly.
π§ MCP Server Features
This Gradio app serves as both a web interface and a full MCP server, providing:
β Dual Interface Support
- Web UI: Interactive Gradio interface at
http://localhost:7860
- MCP Server: Protocol-compliant server at
http://localhost:7860/gradio_api/mcp/sse
β Real-time Processing
- Async Task Handling: Uses SSE for real-time status updates
- Live Preview: Immediate media preview in both web and MCP clients
- Progress Tracking: Detailed logs of API calls and processing status
β Production Ready
- Error Handling: Comprehensive error management and user feedback
- API Integration: Direct integration with A1D.ai services
- Scalable: Can handle multiple concurrent requests
π§ MCP Client Configuration
Method 1: With API Key in Headers (Recommended)
Add this to your Claude Desktop configuration file:
{
"mcpServers": {
"a1d": {
"command": "npx",
"args": [
"mcp-remote@latest",
"http://localhost:7860/gradio_api/mcp/sse",
"--header",
"API_KEY:${MCP_API_KEY}"
],
"env": {
"MCP_API_KEY": "your_a1d_api_key_here"
}
}
}
}
Method 2: With Environment Variable (Fallback)
{
"mcpServers": {
"a1d-gradio": {
"command": "npx",
"args": [
"mcp-remote",
"http://localhost:7860/gradio_api/mcp/sse"
]
}
}
}
Note: Requires A1D_API_KEY
environment variable to be set.
For Other MCP Clients
- Server URL:
http://localhost:7860/gradio_api/mcp/sse
- Transport Type: SSE (Server-Sent Events)
- Protocol: MCP 1.0 compatible
- Authentication: API key via
API_KEY
header or environment variable
Configuration File Locations
Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
π Hosted Version
This server is also available as a hosted Hugging Face Space:
- Space URL: https://huggingface.co/spaces/aigchacker/a1d-mcp-server
- MCP Endpoint:
https://aigchacker-a1d-mcp-server.hf.space/gradio_api/mcp/sse
π§ Environment Variables for Hugging Face Space
To deploy this on your own Hugging Face Space:
- Fork or duplicate this Space
- Go to Settings β Variables and secrets
- Add the following environment variable:
- Name:
A1D_API_KEY
- Value: Your A1D API key from A1D.ai
- Type: Secret (recommended for security)
- Name:
- Save and restart the Space
π MCP Client Configuration for Hosted Version
Method 1: With API Key in Headers (Recommended)
{
"mcpServers": {
"a1d-hosted": {
"command": "npx",
"args": [
"mcp-remote@latest",
"https://aigchacker-a1d-mcp-server.hf.space/gradio_api/mcp/sse",
"--header",
"API_KEY:${MCP_API_KEY}"
],
"env": {
"MCP_API_KEY": "your_a1d_api_key_here"
}
}
}
}
Method 2: Environment Variable (if Space has API key configured)
{
"mcpServers": {
"a1d-hosted": {
"command": "npx",
"args": [
"mcp-remote",
"https://aigchacker-a1d-mcp-server.hf.space/gradio_api/mcp/sse"
]
}
}
}
π‘ How to Use
Once configured, simply ask your AI assistant to help with image or video tasks:
- "Remove the background from this image: https://example.com/photo.jpg"
- "Upscale this image to 4x resolution: https://example.com/image.png"
- "Convert this photo to a vector graphic: https://example.com/logo.jpg"
- "Generate an image of a sunset over mountains"
π οΈ Development
Local Development
git clone https://github.com/your-repo/a1d-mcp-server-hf.git
cd a1d-mcp-server-hf
pip install -r requirements.txt
export A1D_API_KEY=your_api_key_here
python app.py
Project Structure
a1d-mcp-server-hf/
βββ app.py # Main Gradio application
βββ config.py # Configuration settings
βββ utils.py # Utility functions and API client
βββ mcp_handler.py # MCP request handler with header-based API keys
βββ start_server.py # Server startup script
βββ test_app.py # Test suite
βββ requirements.txt # Python dependencies
βββ .env.example # Environment variables example
βββ .gitignore # Git ignore file
βββ LICENSE # MIT license
βββ README.md # This file
π Security
- User-provided credentials: This server supports multiple API key methods:
- Header-based: API keys passed via MCP client headers (recommended)
- Environment variables: Server-side API key configuration
- No stored secrets: All API keys are handled per-request, nothing is stored server-side
- Multi-user support: Each user can use their own API key via headers
- HTTPS recommended: Use HTTPS in production environments
π€ Contributing
We welcome contributions! Please:
- Fork the repository
- Create a feature branch
- Follow the existing code style
- Add tests for new features
- Submit a pull request
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π Related Projects
- Original MCP Server: AIGC-Hackers/mcp-server
- A1D API Documentation: A1D.ai API Docs
- Gradio MCP Guide: Building MCP Server with Gradio
Built with β€οΈ by the A1D Team A1D.ai β’ GitHub β’ API Docs