4o-image MCP server

Provides a bridge between AI systems and the 4o-image API for generating and editing high-quality images through text prompts with real-time progress updates.
Back to servers
Setup instructions
Provider
Antipas
Release date
Apr 22, 2025
Language
TypeScript
Package
Stats
1.3K downloads
4 stars

This MCP server integrates with the 4o-image API, allowing AI systems to generate and edit images through a standardized protocol. You can create high-quality art, 3D characters, and custom images using simple text prompts through this implementation of the Model Context Protocol.

Installation and Setup

Prerequisites

  • Node.js
  • npm
  • An API key from 4o-image.app

Getting an API Key

  1. Register for an account at 4o-image.app
  2. Obtain your API key from the user dashboard
  3. You'll need this API key for server configuration

Installing the Server

Install the MCP server using npm:

npm install -g 4oimage-mcp

Using the Server

Basic Usage

Run the server with your API key:

API_KEY=your_api_key_here npx 4oimage-mcp

Integration with Claude Desktop

To use this server with Claude Desktop, add the following configuration to your claude_desktop_config.json file:

{
  "mcpServers": {
    "4o-image": {
      "command": "npx",
      "args": [
        "-y",
        "4oimage-mcp"
      ],
      "env": {
        "API_KEY": "YOUR_API_KEY_HERE"
      }
    }
  }
}

Replace YOUR_API_KEY_HERE with your actual API key from 4o-image.app.

Available Tools

Generate Image

The server provides a generateImage tool with the following capabilities:

  • Generate images based on text prompts
  • Edit existing images using text instructions
  • View real-time progress updates during image generation
  • Automatically open generated images in your browser

Parameters

  • prompt (string, required): Text description of the desired image
  • imageBase64 (string, optional): Base64-encoded image for editing or transformation

Usage Examples

Text-to-Image Generation

When interacting with Claude, you can request image generation with simple prompts:

Generate an image of a dog running on the beach at sunset

The MCP server will:

  1. Process the request
  2. Generate the image
  3. Automatically open the result in your default browser
  4. Provide a direct link to the image in Claude's response

Image Editing

To modify an existing image, include a base image and provide editing instructions:

Edit this image to make the sky more dramatic with storm clouds

The server will process the edit and display the modified result, maintaining the original composition while implementing the requested changes.

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "4o-image" '{"command":"npx","args":["-y","4oimage-mcp"],"env":{"API_KEY":"YOUR_API_KEY_HERE"}}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "4o-image": {
            "command": "npx",
            "args": [
                "-y",
                "4oimage-mcp"
            ],
            "env": {
                "API_KEY": "YOUR_API_KEY_HERE"
            }
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "4o-image": {
            "command": "npx",
            "args": [
                "-y",
                "4oimage-mcp"
            ],
            "env": {
                "API_KEY": "YOUR_API_KEY_HERE"
            }
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later