Remove background from an image with Claude

Use Stability AI's Stable Diffusion model to remove the background from an image.

See it in action animation

Instructions

Make sure you are running Claude Desktop (not the web version of Claude.ai). And make sure you have npx working on your machine; we're going to be using the following MCP server:

Go to https://platform.stability.ai/ > click your account avatar in the upper right and you'll land on https://platform.stability.ai/account/keys > click “Create API Key”

  1. Open Claude Desktop and go to Claude > Settings > Developer > Edit Config
  2. This will open your claude_desktop_config.json file
  3. Replace the contents of the file with this configuration. Paste your Stability API key to replace the YOUR_API_KEY text. And update the values in /Users/YOUR_SYSTEM_USER_NAME/Downloads/SOME_FOLDER accordingly to some empty folder in your file system (this is where you will need to put your image files):

claude_desktop_config.json

{
  "mcpServers": {
    "stability-ai": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-server-stability-ai"
      ],
      "env": {
        "STABILITY_AI_API_KEY": "YOUR_API_KEY",
        "IMAGE_STORAGE_DIRECTORY": "/Users/YOUR_SYSTEM_USER_NAME/Downloads/SOME_FOLDER"
      }
    }
  }
}

Save the file and restart Claude Desktop for the changes to take effect.

Open the folder you defined in IMAGE_STORAGE_DIRECTORY (or the default). This is where Claude will look for image files. Place the image with the background you want to remove in that folder."

Use this prompt template (or something similar) in Claude:

remove-background: from [Name of your image].

A copy of your image with the background removed will land in the folder from the configuration step (IMAGE_STORAGE_DIRECTORY).

Sign up for the weekly Pulse newsletter

Weekly digest of new & trending MCP apps, use cases, servers, resources and community developments.

Check out last week's edition: Claude Opus 4.5, OpenAI vs. Google, Nano Banana Pro.