ME

Meme MCP Server: Imgflip API AI Meme Generator

Generate AI memes with the Imgflip API via an MCP server for fast, customizable meme creation and sharing.

Quick Install
npx -y @lidorshimoni/meme-mcp

Overview

Meme MCP Server is a lightweight Model Context Protocol (MCP) server that exposes an Imgflip-based AI meme generator as an MCP tool. It wraps Imgflip’s captioning API so you can programmatically produce captioned images from prompts or structured inputs, and integrate meme generation into chatbots, automation pipelines, and developer tools that support MCP.

By providing a standard MCP interface, the server makes meme generation accessible as a callable tool (with a tool manifest, inputs, and outputs) rather than requiring direct interaction with the Imgflip REST API. This simplifies integration with MCP-aware agents and enables consistent, low-latency meme creation within your local networks or cloud infrastructure.

Features

  • Exposes Imgflip meme-capabilities as an MCP tool
  • Accepts both free-form prompts and explicit template/box parameters
  • Returns direct image URLs and base64-encoded image content (where configured)
  • Configurable via environment variables (Imgflip credentials, port)
  • Docker-friendly for easy deployment
  • Lightweight Node.js implementation for fast startup

Installation / Configuration

Prerequisites:

  • Node.js 14+ or Docker
  • An Imgflip account (username & password) — required to call the Imgflip caption API

Clone and install:

git clone https://github.com/lidorshimoni/meme-mcp.git
cd meme-mcp
npm install

Environment variables (examples):

export IMGFLIP_USERNAME="your_imgflip_username"
export IMGFLIP_PASSWORD="your_imgflip_password"
export PORT=3000

Start locally:

npm start
# or
node index.js

Run with Docker:

docker build -t meme-mcp .
docker run -it --rm \
  -e IMGFLIP_USERNAME="your_imgflip_username" \
  -e IMGFLIP_PASSWORD="your_imgflip_password" \
  -p 3000:3000 \
  meme-mcp

The server will listen on the configured PORT (default 3000).

Available Resources

The server implements the MCP tool endpoints for the Imgflip meme generator. Common endpoints and their purposes:

EndpointMethodDescription
/mcp/toolsGETReturns a list of available tools (tool manifest list)
/mcp/tools/imgflipGETReturns the Imgflip tool manifest (inputs, description, etc.)
/mcp/tools/imgflip/runPOSTRun the Imgflip tool with a payload describing the meme to generate
/healthGETHealthcheck/status endpoint

Run payload (JSON) — two common modes:

  • Prompt mode: provide a natural-language “prompt” and optional “template_hint”
  • Structured mode: provide “template_id” and “boxes” matching Imgflip API

Example structured run payload:

{
  "input": {
    "template_id": "61579",
    "boxes": [
      {"text": "Top text"},
      {"text": "Bottom text"}
    ]
  }
}

Example prompt run payload:

{
  "input": {
    "prompt": "A surprised Pikachu meme saying 'When you realize it's Monday'"
  }
}

Response (JSON) typically contains:

  • success flag
  • image URL (imgflip response)
  • optional base64 image content or download link
  • metadata (template_id, boxes, prompt)

Use Cases

  • Chatbot meme replies: Integrate the MCP tool into a conversational agent to let users generate memes by describing the desired caption or template (e.g., “Make a ‘Distracted Boyfriend’ with X and Y captions”).
  • Slack/Discord automation: Use the server from a serverless function or bot to create memes on-the-fly and post them to channels with generated URLs.
  • Content pipelines: Auto-generate memes during content builds or social testing where templated imagery is required.
  • Testing and demos: Quickly produce example images for UI demos, documentation, or testing localization of short captions.

Concrete examples

  1. Simple two-line meme via curl (structured):
curl -X POST http://localhost:3000/mcp/tools/imgflip/run \
  -H "Content-Type: application/json" \
  -d '{
    "input": {
      "template_id": "61579",
      "boxes":[{"text":"When the code compiles"},{"text":"But tests fail"}]
    }
  }'
  1. Prompt-based call (if enabled):
curl -X POST http://localhost:3000/mcp/tools/imgflip/run \
  -H "Content-Type: application/json" \
  -d '{
    "input": {
      "prompt": "Drake hotline bling: love version - 'Use docs' vs 'Ignore docs'"
    }
  }'

Notes and Best Practices

  • Imgflip requires account authentication; do not commit credentials. Use environment variables or a secrets manager.
  • The server is stateless and suitable behind load balancers. For high-volume use, cache generated images or store URLs to avoid duplicate calls.
  • Be mindful of Imgflip’s terms of service and rate limits when using this in production automation.
  • If you need advanced typographic control (fonts, styles), extend the structured payload to include fields supported by Imgflip or pre-render text server-side and upload an image.

For developers new to MCP: treat this service as a tool manifest your agent can discover and call. The server handles the Imgflip interaction so your higher-level logic can focus on user intent and prompt-to-parameters mapping.