
spartanz51/imagegen-mcp
Developer toolsЭта страница переведена автоматически. Технические детали смотрите в оригинале. Открыть оригинал
spartanz51/imagegen-mcp - кандидат на сервер MCP, импортированный из https://github.com/spartanz51/imagegen-mcp.
Обзор
spartanz51/imagegen-mcp - кандидат на сервер MCP, импортированный из https://github.com/spartanz51/imagegen-mcp.
Обзор (машинный перевод)
Этот проект обеспечивает реализацию сервера на основе протокола Model Context Protocol (MCP), который действует как обертка вокруг API генерации и редактирования изображений OpenAI.
Особенности
- Раскрывает возможности генерации изображений OpenAI с помощью инструментов MCP.
Поддерживает генерацию
text-to-image, используя такие модели, как DALL-E 2, DALL-E 3 и gpt-image-1 (при наличии / включении). - Поддерживает редактирование
image-to-imageс использованием DALL-E 2 и gpt-изображения-1 (при наличии/включении). - Конфигурируемые через переменные среды и аргументы командной строки.
- Обрабатывает различные параметры, такие как размер, качество, стиль, формат и т. Д. Сохраняет сгенерированные / отредактированные изображения во временные файлы и возвращает путь вместе с данными base64.
Вот пример создания изображения непосредственно в Курсоре с помощью инструмента text-to-image, интегрированного через MCP:
Быстрый бег с npx
Вы можете запустить сервер непосредственно из npm, используя npx (требуется Node.js и npm):
Смотрите раздел «Запуск сервера» для получения более подробной информации о параметрах и запуске локально.
Предпосылки
Node.js (v18 или более поздняя рекомендация)
- npm или пряжу
- Ключ OpenAI API
Интеграция с курсором
Эта страница переведена автоматически. Технические детали смотрите в оригинале.
README
Показан фрагмент оригинального README. Открыть оригинал.
MCP OpenAI Image Generation Server
This project provides a server implementation based on the Model Context Protocol (MCP) that acts as a wrapper around OpenAI’s Image Generation and Editing APIs (see OpenAI documentation).
Features
- Exposes OpenAI image generation capabilities through MCP tools.
- Supports
text-to-imagegeneration using models like DALL-E 2, DALL-E 3, and gpt-image-1 (if available/enabled). - Supports
image-to-imageediting using DALL-E 2 and gpt-image-1 (if available/enabled). - Configurable via environment variables and command-line arguments.
- Handles various parameters like size, quality, style, format, etc.
- Saves generated/edited images to temporary files and returns the path along with the base64 data.
Here’s an example of generating an image directly in Cursor using the text-to-image tool integrated via MCP:
Quick Run with npx
You can run the server directly from npm using npx (requires Node.js and npm):
npx imagegen-mcp [options]
See the Running the Server section for more details on options and running locally.
Prerequisites
- Node.js (v18 or later recommended)
- npm or yarn
- An OpenAI API key
Integration with Cursor
You can easily integrate this server with Cursor to use its image generation capabilities directly within the editor:
-
Open Cursor Settings:
- Go to
File > Preferences > Cursor Settings(or use the shortcutCtrl+,/Cmd+,).
- Go to
-
Navigate to MCP Settings:
- Search for “MCP” in the settings search bar.
- Find the “Model Context Protocol: Custom Servers” setting.
-
Add Custom Server:
- Click on “Edit in settings.json”.
- Add a new entry to the
mcpServersarray. It should look something like this:
"mcpServers": [ "image-generator-gpt-image": { "command": "npx imagegen-mcp --models gpt-image-1", "env": { "OPENAI_API_KEY": "xxx" } } // ... any other custom servers ... ]- Customize the command:
- You can change the
--modelsargument in thecommandfield to specify which models you want Cursor to have access to (e.g.,--models dall-e-3or--models gpt-image-1). Make sure your OpenAI API key has access to the selected models.
- You can change the
-
Save Settings:
- Save the
settings.jsonfile.
- Save the
Установка
npx imagegen-mcp [options]Конфигурация
"mcpServers": [
"image-generator-gpt-image": {
"command": "npx imagegen-mcp --models gpt-image-1",
"env": {
"OPENAI_API_KEY": "xxx"
}
}
// ... any other custom servers ...
]