一个基于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.1.tar.gz
(5.9 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.1.tar.gz.
File metadata
- Download URL: mcp_image_gen-0.1.1.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d68563fb8be32cad2da103b9bdd25e321cb824cb4bd09b12197b2afe513a8753
|
|
| MD5 |
1d18511f14fb8d5bd8867e1666dec797
|
|
| BLAKE2b-256 |
2572b3090f2a784bfe9b894194278bb21ce1717eb2edd0b1c25a4fdcf7a6e4ef
|
File details
Details for the file mcp_image_gen-0.1.1-py3-none-any.whl.
File metadata
- Download URL: mcp_image_gen-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.4 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 |
91370819b145ea4a325480e74ae5987b6e757631528f3a4d2a1e8327a56ea9b8
|
|
| MD5 |
2c2b8ff7f0cfdc2d47562758424c0537
|
|
| BLAKE2b-256 |
bc1ed3119765a75eb52a95a72f69b2b0e3d8ef234d726719eee33d1dd0788843
|