Get the FREE Ultimate OpenClaw Setup Guide →

primitive-go

A Go implementation of an MCP (Model Context Protocol) server tools

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio prasanthmj-primitive-go-mcp-server /path/to/imagegen-go/bin/imagegen-go \
  --env OPENAI_API_KEY="your-api-key" \
  --env DEFAULT_DOWNLOAD_PATH="/path/to/downloads"

How to use

This MCP server is a Go implementation that exposes a single MCP tool called generate-image. It uses OpenAI's DALL-E API to produce images from text prompts and can automatically manage where those images are saved. You can connect Claude Desktop or other MCP clients and issue the generate-image tool with descriptive prompts to generate visuals. The server handles the interaction with the API and returns image outputs via the MCP protocol, making it easy to integrate image generation into larger workflows or conversational agents.

How to install

Prerequisites:

  • Go 1.19 or higher
  • OpenAI API key
  • Claude Desktop (for testing)

Install and build steps:

  1. Install Go if you haven't already. Verify with:
go version
  1. Obtain the source code for the image generator (clone the repository).

  2. Build the server:

# From the project root
go build -o ./bin/imagegen-go ./main
  1. Prepare environment variables. Create or update your Claude Desktop configuration to include the required API key and a default download path for generated images. Example environment variables:
OPENAI_API_KEY=your-api-key
DEFAULT_DOWNLOAD_PATH=/path/to/downloads
  1. Add the server to Claude Desktop configuration (as shown in the README):
{
  "mcpServers": {
    "imagegen-go": {
      "command": "/path/to/imagegen-go/bin/imagegen-go",
      "env": {
        "OPENAI_API_KEY": "your-api-key",
        "DEFAULT_DOWNLOAD_PATH": "/path/to/downloads"
      }
    }
  }
}
  1. Run the server (example, after building):
./bin/imagegen-go
  1. In Claude Desktop, point the MCP configuration to the running binary and restart Claude to load the new server.

Additional notes

Notes and tips:

  • Ensure OPENAI_API_KEY has the necessary permissions to access the DALL-E service.
  • Set DEFAULT_DOWNLOAD_PATH to a writable directory where generated images will be saved.
  • If the server cannot reach OpenAI, check your network and API key settings.
  • The MCP tool exposed is named generate-image and expects a prompt string to generate an image. You may want to test with a simple prompt first (e.g., "a futuristic city skyline at dusk").
  • In Claude Desktop, verify the server path matches the build output location and that the environment variables are properly passed.
  • Review logs for helpful error messages if image generation fails (e.g., API quota, invalid API key, or misconfigured paths).

Related MCP Servers

Sponsor this space

Reach thousands of developers