Spaces:
Running
Running
File size: 2,772 Bytes
aaa3e82 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
"""
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
}
|