Spaces:
Running
Running
| """ | |
| Configuration file for A1D MCP Server | |
| Contains API endpoints and tool configurations | |
| """ | |
| import os | |
| from pathlib import Path | |
| # Load .env file if it exists | |
| env_file = Path(__file__).parent / '.env' | |
| if env_file.exists(): | |
| with open(env_file, 'r') as f: | |
| for line in f: | |
| line = line.strip() | |
| if line and not line.startswith('#') and '=' in line: | |
| key, value = line.split('=', 1) | |
| os.environ[key.strip()] = value.strip() | |
| # A1D API Configuration | |
| A1D_API_BASE_URL = "https://api.a1d.ai" | |
| API_KEY = os.getenv("A1D_API_KEY", "") | |
| # Tool configurations based on the original mcp-server | |
| TOOLS_CONFIG = { | |
| "remove_bg": { | |
| "name": "remove_bg", | |
| "description": "Remove background from images using AI", | |
| "api_endpoint": "/api/remove-bg", | |
| "required_params": ["image_url"], | |
| "optional_params": [], | |
| "param_mapping": {"image_url": "imageUrl"} | |
| }, | |
| "image_upscaler": { | |
| "name": "image_upscaler", | |
| "description": "Upscale images using AI with specified scale factor", | |
| "api_endpoint": "/api/image-upscaler", | |
| "required_params": ["image_url"], | |
| "optional_params": ["scale"], | |
| "default_values": {"scale": 2}, | |
| "scale_options": [2, 4, 8, 16], | |
| "param_mapping": {"image_url": "imageUrl"} | |
| }, | |
| "video_upscaler": { | |
| "name": "video_upscaler", | |
| "description": "Upscale videos using AI", | |
| "api_endpoint": "/api/video-upscaler", | |
| "required_params": ["video_url"], | |
| "optional_params": [], | |
| "param_mapping": {"video_url": "videoUrl"} | |
| }, | |
| "image_vectorization": { | |
| "name": "image_vectorization", | |
| "description": "Convert images to vector format using AI", | |
| "api_endpoint": "/api/image-vectorization", | |
| "required_params": ["image_url"], | |
| "optional_params": [], | |
| "param_mapping": {"image_url": "imageUrl"} | |
| }, | |
| "image_extends": { | |
| "name": "image_extends", | |
| "description": "Extend images using AI", | |
| "api_endpoint": "/api/image-extends", | |
| "required_params": ["image_url"], | |
| "optional_params": [], | |
| "param_mapping": {"image_url": "imageUrl"} | |
| }, | |
| "image_generator": { | |
| "name": "image_generator", | |
| "description": "Generate images using AI from text prompts", | |
| "api_endpoint": "/api/image-generator", | |
| "required_params": ["prompt"], | |
| "optional_params": [] | |
| } | |
| } | |
| # Gradio Configuration | |
| GRADIO_CONFIG = { | |
| "title": "A1D MCP Server - Universal AI Tools", | |
| "description": "A powerful MCP server providing AI image and video processing tools", | |
| "theme": "default", | |
| "share": False, | |
| "server_name": "0.0.0.0", | |
| "server_port": 7860 | |
| } | |