本项目是一个基于Scenario.com的MCP服务器,具备图像生成和背景移除功能。用户只需配置API密钥和模型ID,就能在开发环境中运行该服务器。
项目的文件结构如下:
python -m venv .venv
source .venv/bin/activate # MacOS/Linux
.\\.venv\\Scripts\\activate # Windows
pip install -r src/requirements.txt
config.env
文件,添加以下内容:SCENARIO_API_KEY=your_api_key
SCENARIO_API_SECRET=your_api_secret
SCENARIO_MODEL_ID=model_id
pip install mcp python-dotenv
使用以下命令启动服务器:
# MacOS/Linux
mcp-server src/scenario_mcp_server.py --config ./.env
# Windows
set SCENARIO_API_KEY=your_api_key & set SCENARIO_API_SECRET=your_api_secret & set SCENARIO_MODEL_ID=model_id & mcp-server src\scenario_mcp_server.py --config .\.env
mcp generate-image --prompt your_prompt_here [--negative-prompt your_negative_prompt] [--num-samples 5]
mcp remove-background --asset-id your_asset_id
status://info
job://{job_id}
asset://{asset_id}
在examples/client_example.py
中,用户可以找到如何调用MCP服务器的示例代码。通过运行脚本:
# MacOS/Linux
python examples/client_example.py
# Windows
python examples\client_example.py
运行以下命令以执行测试并查看文档:
python -m pytest tests/test_server.py -v
测试文件tests/test_server.py
详细记录了如何使用Scenario.com的MCP服务器,包括:
pip install mcp python-dotenv
pip install -r src/requirements.txt
config.env
文件配置正确。本项目遵循MIT许可证。请参阅LICENSE文件了解详细内容。
通过以上步骤,用户可以顺利配置并运行基于Scenario.com的MCP服务器,实现图像生成和背景移除功能。