一个基于MCP协议的OpenAI图像生成服务器
Project description
OpenAI图像生成MCP服务 (v0.1.0)
这是一个基于MCP协议的OpenAI图像生成服务器,允许大语言模型通过MCP协议调用OpenAI的图像生成API。
安装
pip install mcp-image-gen
功能
工具 (Tools)
-
generate_image: 根据文本提示生成图像,返回Base64编码的图像数据。- 参数:
prompt: 描述想要生成的图像的文本提示size: 图像尺寸,可选1024x1024(默认),1024x1536,1536x1024quality: 图像质量,可选low,medium(默认),high,automodel: 使用的模型,默认为gpt-image-1api_key: 可选,OpenAI API密钥base_url: 可选,API基础URL
- 参数:
-
save_image_base64: 将Base64编码的图像数据保存为文件。- 参数:
base64_data: Base64编码的图像数据filename: 要保存的文件名,默认为generated_image.png
- 参数:
资源 (Resources)
openai://api/status: 检查OpenAI API的可用性状态。
在阿里云百炼中使用
在阿里云百炼平台的MCP服务配置中,使用以下JSON:
{
"mcpServers": {
"openai-image-gen": { // 服务名称,可自定义
"command": "uvx",
"args": ["mcp-image-gen"]
}
}
}
本地运行
安装后,您可以在本地通过以下方式运行:
# 使用uvx
uvx mcp-image-gen
# 使用包提供的命令
mcp-image-gen
# 使用Python -m
python -m mcp_image_gen
按 Ctrl+C 停止服务器。
配置
默认情况下,服务器使用内置的API密钥和代理URL,但您可以在调用工具时通过参数覆盖它们。
许可证
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mcp_image_gen-0.1.0.tar.gz
(6.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_image_gen-0.1.0.tar.gz.
File metadata
- Download URL: mcp_image_gen-0.1.0.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e4708d8e6c09ca3f2b3fe68df35c5dcaf8f3ce95a7dc3f981488da5cf2b1ab4
|
|
| MD5 |
f63f89be03581365ec2f0b7d234c2ac9
|
|
| BLAKE2b-256 |
89a32321fb6e79253b6ab42bfa36161e07e83843fc4c90aa11ea18c52e858699
|
File details
Details for the file mcp_image_gen-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mcp_image_gen-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e8c92eef4eefd7e43c8d35ce568c4b2bd1510e58e9a99c046b9e9900503a53fd
|
|
| MD5 |
35ae1b4790c3d0e27f470fb835940306
|
|
| BLAKE2b-256 |
902b3e98f7f3d5b288dd2c33076e519cf4dd26367f73dff4a0ed631362df8d35
|