Skip to main content
Glama
meme-generator-mcp

meme-generator-mcp

by fischerafael

meme-generator-mcp

An open-source MCP server + web app that lets any AI assistant (Claude, ChatGPT, Cursor, VS Code…) generate memes through the Imgflip API.

  • No accounts, no database. You turn your Imgflip username and password into an encrypted token (AES-256-GCM). The server decrypts it on each request and forgets it.

  • MCP connector. Paste the token as the Bearer token when adding the connector in your MCP client.

  • Playground. Generate memes directly in the browser. The URL keeps the template and texts, so links are shareable.

  • 82 role-labeled templates. Every template says what each text box means (boxes[].role), when to use it, tags and an example, so the LLM puts the right text in the right place.

Generate a token

  1. Create a free account at imgflip.com.

  2. Open /setup, enter your Imgflip username and password, and press Generate token. The server makes one real Imgflip call to check the credentials, then returns mg_v1_….

Related MCP server: memewright

Connect your assistant

Any MCP client that supports remote (Streamable HTTP) servers with a Bearer token works. In Claude:

  1. In Claude: Settings → Connectors → Add custom connector.

  2. URL: https://<your-deployment>/api/mcp

  3. Authentication: Bearer token → paste the mg_v1_… token.

  4. Ask for a meme, e.g. "Make a Scooby-Doo mask reveal meme: everyone blamed the database, it was the N+1 queries."

Tools

Tool

Input

Output

suggest_templates

{ situation, limit? }

best-fitting full templates for the joke's shape

list_templates

{ query?, limit? }

compact ranked list: id, name, boxCount, usage, tags

get_template

{ id }

one full template (boxes[].role, usage, tags, example)

generate_meme

{ templateId, texts[], font?, maxFontSize? }

{ url, pageUrl } + the image itself

The server also sends workflow/style instructions on connect and exposes a make_meme prompt.

HTTP API

Method

Route

Auth

Body / Query

POST

/api/token

—

{ username, password } → { token }

GET

/api/templates

—

?q=&limit= → { items }

GET

/api/templates/:id

—

→ Template

POST

/api/memes

Bearer

{ templateId, texts[], font?, maxFontSize? } → { url, pageUrl, templateId }

POST/GET/DELETE

/api/mcp

Bearer

MCP (Streamable HTTP, stateless)

Errors look like { "error": { "code", "message" } }. Missing or invalid tokens get 401 with WWW-Authenticate: Bearer realm="meme-generator".

Local development

npm install
cp .env.example .env
node -e "console.log(require('crypto').randomBytes(32).toString('base64'))"

Put that value in TOKEN_KEY in .env, then:

npm run dev

This starts the API on :3000 (scripts/dev-api.ts, the same /api handlers Vercel runs) and Vite on :5173, which proxies /api.

npm test
npm run build

Deploy (Vercel)

Import the repo in Vercel and set the TOKEN_KEY environment variable. vercel.json builds the SPA into dist/, serves /api/* as functions (bundling data/), and falls back to index.html for client routes.

Rotating the key: add a new prefix/key pair to AesGcmCipher (e.g. mg_v2_) and make it current; v1 tokens keep working until you remove the old key.

Architecture

api/          Vercel Functions: thin inbound adapters only
backend/
  domain/       entities and rules, no dependencies
  ports/        MemeRenderer, TemplateCatalog, TokenCipher
  application/  use cases (depend on ports only)
  adapters/     outbound: Imgflip, JSON catalog, AES-GCM; inbound: HTTP, MCP
  composition-root.ts   the only place that wires concrete adapters
frontend/     Vite + React + React Router + TanStack Query + zustand + shadcn/ui
shared/       zod schemas used by both sides
data/templates-catalog.json

Frontend never imports backend/; backend never imports frontend/. Tokens and passwords are never logged.

Adding templates

Templates live in data/templates-catalog.json. Each needs the Imgflip id, boxCount, one boxes[].role per box (in Imgflip's box order), usage, tags, an example per box and previewUrl. npm test validates the file.

License

MIT © Rafael Fischer

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      Not graded
      maintenance
      A Model Context Protocol server that enables AI models and tools to generate meme images from user prompts using the ImgFlip API.
      17
      Apache 2.0
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI agents to create memes by selecting from a library of templates and rendering captions with proper typesetting.
      AGPL 3.0