Логотип Stability AI

Stability AI

Сообщество
tadasant

MCP Server integrating MCP Clients with Stability AI-powered image manipulation functionalities: generate, edit, upscale, and more.

Издательtadasant
Репозиторийmcp-server-stability-ai
ЯзыкTypeScript
Форки
29
Звёзды
84
Доступные инструменты
0
Тип транспортаstdio
Категории
ЛицензияMIT
Ссылки
  • Подключайте инструменты к рабочим процессам с ИИ

    Stability AI предоставляет возможности MCP, доступные совместимым ИИ-клиентам и агентам.

  • Доступные инструменты: 0

    Ниже представлены доступные для вызова действия с названиями и описаниями, если сервер их предоставляет.

  • Готовая конфигурация для копирования

    Используйте примеры конфигурации, чтобы настроить этот сервер в предпочитаемом MCP-клиенте.

  • Показатели интереса к открытому проекту

    Звёзды: 84, форки: 29 — в связанном репозитории.

Haven't heard about MCP yet? The easiest way to keep up-to-date is to read our weekly newsletter at PulseMCP.


This is an MCP (Model Context Protocol) Server integrating MCP Clients with Stability AI's latest & greatest Stable Diffusion image manipulation functionalities: generate, edit, upscale, and more.

Stability AI is a leading AI model provider and this server connects directly to their hosted REST API. You will need to sign up for an API Key from stability.ai to get started.

They provide 25 credits for free. Afterward, pay-as-you-go pricing is very reasonable: $0.01/credit, where 3 credits gets you an image generation on their Core model. So 100 high quality images = just $3.

This project is NOT officially affiliated with Stability AI.

Demo video, and a teaser here:

Teaser

Table of Contents

Highlights

No learning curve: This server is designed to use sensible defaults and provide simple, smooth UX for the most common actions related to generating and manipulating image files. You don't need to be technical or understand anything about image models to use it effectively.

Chain manipulations: You can generate an image, then replace an item within it, then remove the background... all in a single Claude conversation.

Minimal configuration: All you need to get started is a Stability AI API key. Set environment variables for that and a local directory path to store output images, and you're ready to go.

Leverage the best in class image models: Stability AI is the leading provider of image models exposed via API. Using this server integrates them into Claude or another MCP client - head and shoulders above an experience like using DALL-E models in ChatGPT.

Capabilities

This server is built and tested on macOS with Claude Desktop. It should work with other MCP clients as well.

Tool NameDescriptionEstimated Stability API Cost
generate-imageGenerate a high quality image of anything based on a provided prompt & other optional parameters.$0.03
generate-image-sd35Generate an image using Stable Diffusion 3.5 models with advanced configuration options.$0.04-$0.07
remove-backgroundRemove the background from an image.$0.02
outpaintExtend an image in any direction while maintaining visual consistency.$0.04
search-and-replaceReplace objects or elements in an image by describing what to replace and what to replace it with.$0.04
upscale-fastEnhance image resolution by 4x.$0.01
upscale-creativeEnhance image resolution up to 4K.$0.25
control-sketchTranslate hand-drawn sketch to production-grade image.$0.03
control-styleGenerate an image in the style of a reference image.$0.04
control-structureGenerate an image while maintaining the structure of a reference image.$0.03
replace-background-and-relightReplace the background of an image and relight it.$0.08
search-and-recolorSearch for and recolor objects in an image.$0.05

Usage Tips

  • All processed images are automatically saved to IMAGE_STORAGE_DIRECTORY, opened for preview, and made available as resources
  • Do not try to copy/paste or upload image files to Claude. Claude does not store images anywhere, so we cannot work with those with the MCP server. They have to be "uploaded" (saved to) the IMAGE_STORAGE_DIRECTORY and then they will show up as resources available in the chat.
  • You can use Prompts that come preloaded instead of writing your own verbiage:

Examples

Generate an image

  1. Generate an image of a cat
  2. Generate a photorealistic image of a cat in a cyberpunk city, neon lights reflecting off its fur, 16:9 aspect ratio
  3. Generate a detailed digital art piece of a cat wearing a space suit floating through a colorful nebula, style preset: digital-art, aspect ratio: 21:9

Generate an image with SD3.5

  1. Generate an image of a woman with cybernetic wolf ears using the SD3.5 model, with the "neon-punk" style preset
  2. Generate an image of a futuristic city using the SD3.5 Large Turbo model, with aspect ratio 16:9
  3. Generate an image of an astronaut on mars using the SD3.5 Large model, with cfg scale 7.5, "analog-film" style preset, and seed 42

Remove background

  1. Remove the background from the image I just generated
  2. Remove the background from product-photo.jpg to prepare it for my e-commerce site
  3. Remove the background from group-photo.png so I can composite it with another image

Outpaint (Uncrop)

  1. Extend vacation-photo.jpg 500 pixels to the right to include more of the beach
  2. Extend family-portrait.png 300 pixels up to show more of the mountains, and 200 pixels right to include more landscape
  3. Extend artwork.png in all directions to create a wider fantasy forest scene that matches the original environment

Search and Replace

  1. In my last image, replace the red car with a blue car
  2. In portrait.png, replace the plain background with a sunset over mountains
  3. In landscape.jpg, replace the modern buildings with victorian-era architecture while maintaining the same atmosphere

Upscale

  1. Upscale profile-pic.jpg for better resolution
  2. Upscale product-photo.png to make it print-ready

And then, if the output still isn't good enough, you can upscale it again:

  1. Try again with better quality

Control Sketch

  1. Transform sketch.png into a colored illustration for a children's book
  2. Convert wireframe.jpg into a detailed 3D render for a modern architectural visualization

Control Style

  1. Generate an image in the style of the reference image

Control Structure

  1. Generate an image while maintaining the structure of the reference image

Replace Background and Relight

  1. Replace the background of the image I just generated with a sunset over mountains

Search and Recolor

  1. In my last image, make the red car be blue instead

Setup

Metadata Logging

The server can save metadata from image generation requests to help with tracking and troubleshooting.

Environment VariableDescriptionRequiredDefault Value
SAVE_METADATASave metadata for successful image generationsNtrue
SAVE_METADATA_FAILEDSave metadata for failed image generationsNfalse

When enabled, a .txt file with the same name as the generated image will be created in the same directory. This file contains:

  • Timestamp of the request
  • All request parameters (prompt, model, style preset, etc.)
  • Response information (success status, generation time)

This file will also be created for failed requests if SAVE_METADATA_FAILED is enabled.

Cheatsheet

Environment VariableDescriptionRequiredDefault ValueExample
STABILITY_AI_API_KEYYour Stability AI API key. Get one at platform.stability.aiYN/Ask-1234567890
IMAGE_STORAGE_DIRECTORYDirectory where generated images will be savedN/tmp/tadasant-mcp-server-stability-ai OR C:\\Windows\\Temp\\mcp-server-stability-ai/Users/admin/Downloads/stability-ai-images (Mac OS/Linux), C:\\Users\\Admin\\Downloads\\stability-ai-images (Windows)
SAVE_METADATASave metadata for successful image generationsNtruetrue or false
SAVE_METADATA_FAILEDSave metadata for failed image generationsNtruetrue or false
GCS_PROJECT_IDGoogle Cloud Project ID for storing imagesN (Y if using SSE)N/Ayour-project-id
GCS_CLIENT_EMAILGoogle Cloud Service Account client email for storing imagesN (Y if using SSE)N/Ayour-service-account@project.iam.gserviceaccount.com
GCS_PRIVATE_KEYGoogle Cloud Service Account private key for storing imagesN (Y if using SSE)N/A<REDACTED>\n
GCS_BUCKET_NAMEGoogle Cloud Storage bucket name for storing imagesN (Y if using SSE)N/Ayour-bucket-name

Claude Desktop

If you prefer a video tutorial, here's a quick one.

Create a folder directory somewhere on your machine to store generated/modified images. Some options:

  • /Users/<username>/Downloads/stability-ai-images
  • /Users/<username>/Library/Application Support/Claude/mcp-server-stability-ai/images

And make sure you have an API key from Stability AI.

Then proceed to your preferred method of configuring the server below. If this is your first time using MCP Servers, you'll want to make sure you have the Claude Desktop application and follow the official MCP setup instructions.

Manual Setup

You're going to need Node working on your machine so you can run npx commands in your terminal. If you don't have Node, you can install it from nodejs.org.

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

Windows: %APPDATA%\Claude\claude_desktop_config.json

Modify your claude_desktop_config.json file to add the following:

{
  "mcpServers": {
    "stability-ai": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-server-stability-ai"
      ],
      "env": {
        "STABILITY_AI_API_KEY": "sk-1234567890"
      }
    }
  }
}

Restart Claude Desktop and you should be ready to go:

Installing via Smithery

To install for Claude Desktop automatically via Smithery:

bash
npx @smithery/cli install mcp-server-stability-ai --client claude

SSE Mode

This server has the option to run in SSE mode by starting it with the following command:

bash
npx mcp-server-stability-ai -y --sse

This mode is useful if you intend to deploy this server for third party usage over HTTP.

You will need to set the GCS_PROJECT_ID, GCS_CLIENT_EMAIL, GCS_BUCKET_NAME, and GCS_PRIVATE_KEY environment variables, because the server will store image files in Google Cloud Storage instead of its local filesystem.

Note that the scheme for multitenancy is very naive and insecure: it uses the requestor's IP address to segment the GCS prefixes used to the store the images, and makes all images publicly accessible in order to communicate them back to the MCP client. So in theory, if someone knows your IP address and then name(s) of files you generated, they could access your images by guessing the URL.

Roadmap

Recently completed:

  • ✅ Added support for Stable Diffusion 3.5 models
  • ✅ Added support for Stable Image Ultra
  • ✅ Added metadata logging for image generation requests

These are coming soon; but PR's are welcome! See CONTRIBUTING.md.

  • inpaint - A more precise version of search-and-x functionalities, requires mananging a mask to define to area to replace.
  • Base image manipulation (crop, rotate, resize, etc.): likely as its own MCP server
  • Ability to inpaint one image into another image. Doesn't seem possible with Stability API; will probably want another MCP server hitting a different API to accomplish this.
  • MCP client custom-made for image manipulation

Contributing

External contributions are welcome! See CONTRIBUTING.md for more details.

Also please feel free to raise issues or feature requests; love seeing how people are using this and how it could be made better.

Установка

TypingMind
Требования:

Node.js 18+

{
  "mcpServers": {
    "stability-ai": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-server-stability-ai"
      ],
      "env": {
        "STABILITY_AI_API_KEY": "sk-1234567890"
      }
    }
  }
}

Используйте MCP Stability AI с разными ИИ-моделями

TypingMind подключает инструменты MCP на уровне рабочего пространства, поэтому после подключения Stability AI вы можете использовать их с разными моделями ИИ в TypingMind, не настраивая подключение отдельно для каждой модели. Эта интеграция MCP работает локально на вашем устройстве через коннектор MCP TypingMind.

Руководство по настройке локального коннектора

Выберите этот способ, если серверу MCP нужен доступ к локальным файлам, приложениям или закрытым ресурсам на вашем компьютере.

1

Откройте настройки MCP

В TypingMind откройте «Настройки», затем «Расширенные настройки», перейдите в раздел «Протокол контекста модели» и выберите «Настроить коннектор».

  1. Откройте TypingMind в браузере.
  2. Нажмите значок настроек.
  3. Перейдите в «Расширенные настройки».
  4. Откройте раздел «Протокол контекста модели».
  5. Нажмите «Настроить коннектор» и выберите «Это устройство».
Экран настройки коннектора MCP в TypingMind с выбранным вариантом «Это устройство»
2

Выполните команду коннектора

Выберите «Это устройство», скопируйте команду из TypingMind и выполните её в терминале. Не останавливайте процесс, пока используете MCP.

  1. Скопируйте команду настройки, показанную в TypingMind.
  2. Откройте «Терминал» в macOS или Windows Terminal в Windows.
  3. Вставьте и выполните команду.
  4. Подтвердите установку пакета, если терминал запросит разрешение продолжить.
  5. Не закрывайте окно терминала и не останавливайте процесс, пока используете инструменты MCP.
3

Добавьте Stability AI как сервер

Когда статус коннектора сменится на «Готов», нажмите «Изменить серверы» и вставьте конфигурацию сервера MCP.

  1. Дождитесь, пока статус коннектора сменится на «Готов».
  2. Нажмите «Изменить серверы».
  3. Вставьте конфигурацию сервера MCP для Stability AI.
  4. Сохраните список серверов.
  5. Обновите статус, если хотите убедиться, что коннектор по-прежнему готов к работе.
Настройки MCP в TypingMind с активным сервером и кнопкой «Изменить серверы»
{
  "mcpServers": {
    "stability-ai": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-server-stability-ai"
      ]
    }
  }
}
4

Используйте подключение с разными моделями

Сохраните список серверов, откройте раздел «Плагины», включите инструменты MCP для Stability AI, затем выберите любую поддерживаемую модель ИИ в TypingMind и используйте инструменты в чате или назначьте их ИИ-агенту.

  1. Откройте страницу «Плагины» в TypingMind.
  2. Включите инструменты MCP для Stability AI.
  3. Начните чат и выберите модель ИИ, которую хотите использовать.
  4. Используйте инструменты MCP в чате или назначьте их ИИ-агенту.
  5. При необходимости переключайтесь на другую модель ИИ без повторного подключения MCP.
Чат TypingMind с включёнными инструментами MCP и выбранной ИИ-моделью
Можете помочь мне с этой задачей с помощью Stability AI?
Stability AI
Конечно. Я всё прочитал.
Вот что я нашёл с помощью Stability AI.

Часто задаваемые вопросы

Для чего используется сервер MCP Stability AI?

Stability AI — это сервер MCP, который позволяет совместимым ИИ-клиентам подключаться к внешним инструментам и получать контекст. В TypingMind достаточно один раз добавить этот сервер MCP, чтобы его инструменты стали доступны в вашем рабочем пространстве с ИИ.

Можно ли использовать сервер MCP Stability AI с несколькими ИИ-моделями в TypingMind?

Да. TypingMind подключает инструменты MCP на уровне рабочего пространства, поэтому вы можете использовать Stability AI с разными ИИ-моделями, например Claude, ChatGPT, Gemini или другими моделями, настроенными в TypingMind, без отдельной настройки сервера MCP для каждой модели.

Зачем использовать MCP Stability AI с TypingMind?

TypingMind — один из лучших интерфейсов для чата с LLM: он объединяет разные ИИ-модели, промпты, плагины, ИИ-агентов, ключи API и инструменты MCP в одном рабочем пространстве. Подключив Stability AI, вы сможете использовать его инструменты MCP с предпочитаемыми моделями, сохраняя удобную организацию работы с чатами в TypingMind.

Как подключить сервер MCP Stability AI к TypingMind?

Stability AI работает через локальный коннектор MCP TypingMind. Этот вариант лучше всего подходит, когда серверу MCP нужен доступ к локальным файлам, настольным приложениям, инструментам командной строки или закрытым ресурсам на вашем компьютере.

Какие инструменты предоставляет сервер MCP Stability AI в TypingMind?

Stability AI предоставляет возможности MCP, которые можно включить на странице «Плагины» в TypingMind и использовать в чате или назначить ИИ-агентам.

Нужно ли передавать TypingMind свои ключи API для использования сервера MCP Stability AI?

Нет. TypingMind ориентирован прежде всего на локальную работу и позволяет вам контролировать выбор провайдеров моделей, ключи API, промпты и конфигурацию MCP. Если Stability AI требует аутентификации, при создании подключения добавьте необходимые заголовки, настройки OAuth или локальную конфигурацию для этого сервера MCP.

Похожие серверы MCP

Все

Создайте свою рабочую ИИ-среду сейчас

Подпишитесь на нашу рассылку, чтобы узнавать о новых функциях и предстоящих розыгрышах 👇